Sunteți pe pagina 1din 10

P6 EPPM Clone:

Author: Vinoth Kumar Subramani


SOURCE ENVIRONMENT:
Check the account status of the Primavera Schemas:
SQL> select USERNAME,ACCOUNT_STATUS,DEFAULT_TABLESPACE,PROFILE from dba_users where
USERNAME in ('ADMUSER','PRIVUSER','PUBUSER','PXRPTUSER','BGJOBUSER');
USERNAME

ACCOUNT_STATUS

DEFAULT_TABLESPACE

PROFILE

------------------------------ -------------------------------- ------------------------------ -----------------------------PXRPTUSER

OPEN

PMDB_PX_DAT1

DEFAULT

PRIVUSER

OPEN

PMDB_DAT1

DEFAULT

PUBUSER

OPEN

PMDB_DAT1

DEFAULT

BGJOBUSER

OPEN

PMDB_DAT1

DEFAULT

ADMUSER

OPEN

PMDB_DAT1

DEFAULT

Create a directory:
SQL> create directory UMTN5O AS '/umtn5o/log';
Directory created.

Grant Permissions:
SQL> grant read,write on directory UMTN5O to SYS;
Grant succeeded.
SQL> select * from dba_directories;
OWNER

DIRECTORY_NAME

------------------------------ -----------------------------DIRECTORY_PATH
--------------------------------------------------------------------------------

SYS

UMTN5O

/umtn5o/log

Take the backup of the source environment as below:


expdp \"/ as sysdba\" directory=UMTN5O dumpfile=ADMUSER_%U.dmp logfile=expADMUSER.log
SCHEMAS=ADMUSER
expdp \"/ as sysdba\" directory=UMTN5O dumpfile=PRIVUSER_%U.dmp logfile=expPRIVUSER.log
SCHEMAS=PRIVUSER
expdp \"/ as sysdba\" directory=UMTN5O dumpfile=PUBUSER_%U.dmp logfile=expPUBUSER.log
SCHEMAS=PUBUSER
expdp \"/ as sysdba\" directory=UMTN5O dumpfile=PXRPTUSER_%U.dmp logfile=expPXRPTUSER.log
SCHEMAS=PXRPTUSER
expdp \"/ as sysdba\" directory=UMTN5O dumpfile=BGJOBUSER_%U.dmp logfile=expBGJOBUSER.log
SCHEMAS=BGJOBUSER
For E.g. I have given ADMUSER schema export.
[orumtn5o@fldadbadm04 log]$ expdp \"/ as sysdba\" directory=UMTN5O dumpfile=ADMUSER_%U.dmp
logfile=expADMUSER.log SCHEMAS=ADMUSER
Export: Release 11.2.0.4.0 - Production on Thu Jul 23 16:30:28 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": "/******** AS SYSDBA" directory=UMTN5O
dumpfile=ADMUSER_%U.dmp logfile=expADMUSER.log SCHEMAS=ADMUSER
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 4.274 GB
Processing object type SCHEMA_EXPORT/USER

Processing object type SCHEMA_EXPORT/SYSTEM_GRANT


Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/TYPE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/SEQUENCE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/PACKAGE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/FUNCTION/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PROCEDURE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type
SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/FUNCTIONAL_INDEX/INDEX

List the dump files:


[orumtn5o@fldadbadm04 log]$ pwd

/umtn5o/log
[orumtn5o@fldadbadm04 log]$ ls -ltr *dmp
-rw-r----- 1 orumtn5o asmadmin 2467287040 Jul 23 16:31 ADMUSER_01.dmp
-rw-r----- 1 orumtn5o asmadmin

376832 Jul 23 16:33 PRIVUSER_01.dmp

-rw-r----- 1 orumtn5o asmadmin

176128 Jul 23 16:34 PUBUSER_01.dmp

-rw-r----- 1 orumtn5o asmadmin

614400 Jul 23 16:34 PXRPTUSER_01.dmp

-rw-r----- 1 orumtn5o asmadmin

180224 Jul 23 16:34 BGJOBUSER_01.dmp

GO TO THE TARGET ENVIRONMENT:


Create a directory:
SQL> create directory DMTN5O AS '/dmtn5o/log/imp';
Directory created.

Grant Permissions:
SQL> grant read,write on directory DMTN5O to sys;
Grant succeeded.

Check the status of the users in Target DB:


SQL> select USERNAME,ACCOUNT_STATUS,DEFAULT_TABLESPACE,PROFILE from dba_users where
USERNAME in ('ADMUSER','PRIVUSER','PUBUSER','PXRPTUSER','BGJOBUSER');
USERNAME

ACCOUNT_STATUS

DEFAULT_TABLESPACE

PROFILE

------------------------------ -------------------------------- ------------------------------ -----------------------------ADMUSER

OPEN

PMDB_DAT1

DEFAULT

BGJOBUSER

OPEN

PMDB_DAT1

DEFAULT

PUBUSER

OPEN

PMDB_DAT1

DEFAULT

PRIVUSER

OPEN

PMDB_DAT1

DEFAULT

PXRPTUSER

OPEN

PMDB_PX_DAT1

DEFAULT

Drop the existing schemas in the Target system:


NOTE: FYI, Sometime ADMUSER might fail to drop, then open the DB in restrict mode and drop the
same.
Follow the below order to drop the schemas:
SQL> drop user BGJOBUSER cascade;
User dropped.
SQL> drop user PUBUSER cascade;
User dropped.
SQL> drop user PXRPTUSER cascade;
User dropped.
SQL> drop user PRIVUSER cascade;
User dropped.
In case, if PRIVUSER holds sessions, kill the sessions as shown below.
SQL> select SID,serial# from v$session where USERNAME='PRIVUSER';
no rows selected
alter system kill session '&SID,&SN';
SQL> drop user ADMUSER cascade;
User dropped.

Copy the dump file to target:


scp *.dmp ordmtn5o@ZAFLDODAOCN31.next.mtn.com:/dmtn5o/log/imp

Restart the target Database and import the schema in the below order:

impdp \"/ as sysdba\" directory=DMTN5O dumpfile=PRIVUSER_01.dmp logfile=impPRIVUSER.log


SCHEMAS=PRIVUSER
impdp \"/ as sysdba\" directory=DMTN5O dumpfile=PXRPTUSER_01.dmp logfile=impPXRPTUSER.log
SCHEMAS=PXRPTUSER
impdp \"/ as sysdba\" directory=DMTN5O dumpfile=PUBUSER_01.dmp logfile=impPUBUSER.log
SCHEMAS=PUBUSER
impdp \"/ as sysdba\" directory=DMTN5O dumpfile=BGJOBUSER_01.dmp logfile=impBGJOBUSER.log
SCHEMAS=BGJOBUSER
impdp \"/ as sysdba\" directory=DMTN5O dumpfile=ADMUSER_01.dmp logfile=impADMUSER.log
SCHEMAS=ADMUSER
Note: While importing PRIVUSER and PXRPTUSER you can see some warnings in VIEW. After importing
all the schemas run @?/rdbms/admin/utlrp.sql; to clear the warnings in VIEW:

Run @?/rdbms/admin/utlrp.sql; to clear the warnings in VIEW


SQL> @?/rdbms/admin/utlrp.sql;
TIMESTAMP
-----------------------------------------------------------------------------------------------------------------------------------------COMP_TIMESTAMP UTLRP_BGN 2015-07-23 18:00:32
DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC>

number should decrease with time.

DOC>

SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);

DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC>
DOC>

should increase with time.


SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;

DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC>
DOC>

SELECT job_name FROM dba_scheduler_jobs


WHERE job_name like 'UTL_RECOMP_SLAVE_%';

DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC>
DOC>
DOC>#

SELECT job_name FROM dba_scheduler_running_jobs


WHERE job_name like 'UTL_RECOMP_SLAVE_%';

PL/SQL procedure successfully completed.


TIMESTAMP
-----------------------------------------------------------------------------------------------------------------------------------------COMP_TIMESTAMP UTLRP_END 2015-07-23 18:00:58
DOC> The following query reports the number of objects that have compiled
DOC> with errors.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS


------------------0

DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------

0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.

Then, to check the view:


select owner,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where OBJECT_TYPE='VIEW' and
OWNER in ('ADMUSER','PRIVUSER','PUBUSER','PXRPTUSER','BGJOBUSER');
select owner,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where OBJECT_TYPE='VIEW' and
OWNER in ('ADMUSER','PRIVUSER','PUBUSER','PXRPTUSER','BGJOBUSER') and status!='VALID';

POST CLONE STEPS


Change the 5 schema passwords:
alter user ADMUSER identified by AAA_tQ79hv9VTKQN;
alter user PRIVUSER identified by AAA_tQ79hv9VTKQN;
alter user PUBUSER identified by AAA_tQ79hv9VTKQN;
alter user PXRPTUSER identified by AAA_tQ79hv9VTKQN;
alter user BGJOBUSER identified by AAA_tQ79hv9VTKQN;

Now run databaselogins.sh and update PRIVUSER password.


-bash-3.2$ pwd
/dmtn5o/primavera/product/eppm/151/database
-bash-3.2$ ./databaselogins.sh
Now run the ./dbconfigpv.sh.
-bash-3.2$ pwd

/dmtn5o/primavera/product/eppm/151/p6
-bash-3.2$ ./dbconfigpv.sh
Run adminpv.sh
pwd
/dmtn5o/primavera/product/eppm/151/p6
-bash-3.2$ ./adminpv.sh
By this EPPM clone is complete.

S-ar putea să vă placă și