KS-PPS Testowo, Kasowanie i zakładania użytkowników

W przypadku gdy potrzebujemy potestować bazę KS-PPS przyda się skrypt, który skasuje i założy od nowa użytkowników KS i PPS.
Najpierw logujemy się do bazy:
sqlplus.exe SYSTEM AS SYSDBA
A następnie wklejamy skrypt:

DROP USER PPS CASCADE;
DROP USER KS CASCADE;

CREATE USER KS PROFILE DEFAULT
IDENTIFIED BY ks_password DEFAULT TABLESPACE KS
TEMPORARY TABLESPACE TEMP
QUOTA UNLIMITED ON KS
ACCOUNT UNLOCK;
GRANT CREATE DATABASE LINK TO KS;
GRANT CREATE PUBLIC SYNONYM TO KS;
GRANT CREATE SYNONYM TO KS;
GRANT CREATE TYPE TO KS;
GRANT CREATE MATERIALIZED VIEW TO KS;
GRANT CREATE ROLE TO KS;
GRANT CREATE TABLE TO KS;
GRANT CREATE VIEW TO KS;
GRANT CREATE PROCEDURE TO KS;
GRANT CREATE SEQUENCE TO KS;
GRANT CREATE TRIGGER TO KS;
GRANT CREATE SESSION TO KS;
GRANT EXECUTE ON DBMS_LOCK TO KS WITH GRANT OPTION;
GRANT EXECUTE ON UTL_SMTP TO KS WITH GRANT OPTION;
GRANT CONNECT TO KS;
GRANT RESOURCE TO KS;

CREATE USER PPS PROFILE DEFAULT
IDENTIFIED BY kspps DEFAULT TABLESPACE PPS
TEMPORARY TABLESPACE TEMP
QUOTA UNLIMITED ON PPS
ACCOUNT UNLOCK;
GRANT CREATE DATABASE LINK TO PPS;
GRANT CREATE PUBLIC SYNONYM TO PPS;
GRANT CREATE SYNONYM TO PPS;
GRANT CREATE TYPE TO PPS;
GRANT CREATE MATERIALIZED VIEW TO PPS;
GRANT CREATE ROLE TO PPS;
GRANT CREATE TABLE TO PPS;
GRANT CREATE VIEW TO PPS;
GRANT CREATE PROCEDURE TO PPS;
GRANT CREATE SEQUENCE TO PPS;
GRANT CREATE TRIGGER TO PPS;
GRANT CREATE SESSION TO PPS;
GRANT EXECUTE ON DBMS_LOCK TO PPS WITH GRANT OPTION;
GRANT EXECUTE ON UTL_SMTP TO PPS WITH GRANT OPTION;
GRANT CONNECT TO KS;
GRANT RESOURCE TO KS;

Dwie pierwsze linijki to oczywiście skasowanie użytkowników, ale już kolejne to ich założenie.
Oczywiście nie należy zapomnieć o odtworzeniu danych z backupów.

0 Shares