Sunday, December 8, 2013

Oracle Database 12c–Duplicate database using RMAN (multi-tenant setup)

1. Preparation work

[oracle@gc12c ~]$ sqlplus sys/password@cdborcl as sysdba
SQL> create pfile='?/dbs/initcdbdup.ora' from spfile;
File created.
SQL> exit


[oracle@gc12c ~]$ mkdir /u01/app/oracle/oradata/cdbdup
[oracle@gc12c ~]$ mkdir -p /u01/app/oracle/admin/cdbdup/adump
[oracle@gc12c ~]$ mkdir /u01/app/oracle/oradata/cdbdup/demo
[oracle@gc12c ~]$ mkdir /u01/app/oracle/oradata/cdbdup/pdbseed
[oracle@gc12c ~]$ mkdir /u01/app/oracle/fast_recovery_area/cdbdup

[oracle@gc12c ~]$ sed 's/cdborcl/cdbdup/g' $ORACLE_HOME/dbs/initcdbdup.ora > $ORACLE_HOME/dbs/initcdbdup.ora.new
[oracle@gc12c ~]$ mv $ORACLE_HOME/dbs/initcdbdup.ora.new $ORACLE_HOME/dbs/initcdbdup.ora
[oracle@gc12c ~]$ orapwd file=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwcdbdup password=password

[oracle@gc12c admin]$ echo "
> SID_LIST_LISTENER =
> (SID_LIST =
> (SID_DESC =
> (GLOBAL_DBNAME = cdbdup)
> (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
> (SID_NAME = cdbdup)
> )
> )
> "
>> $ORACLE_HOME/network/admin/listener.ora

[oracle@gc12c ~]$ echo "
> CDBDUP =
> (DESCRIPTION =
> (ADDRESS = (PROTOCOL = TCP)(HOST = gc12c)(PORT = 1521))
> (CONNECT_DATA =
> (SERVER = DEDICATED)
> (SERVICE_NAME = cdbdup)
> )
> )"
>> $ORACLE_HOME/network/admin/tnsnames.ora


2. Startup auxiliary instance and reload listener



[oracle@gc12c ~]$ sqlplus sys/password@cdbdup as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sun Dec 8 21:25:41 2013

Copyright (c) 1982, 2013, Oracle. All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> startup force nomount
ORACLE instance started.

Total System Global Area 1636814848 bytes
Fixed Size 2288968 bytes
Variable Size 989856440 bytes
Database Buffers 637534208 bytes
Redo Buffers 7135232 bytes
SQL> exit


[oracle@gc12c ~]$ lsnrctl reload
[oracle@gc12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 08-DEC-2013 20:43:16

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gc12c)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 08-DEC-2013 20:21:17
Uptime 0 days 0 hr. 21 min. 59 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/gc12c/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gc12c)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=gc12c)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/cdborcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "cdbdup" has 2 instance(s).
Instance "cdbdup", status UNKNOWN, has 1 handler(s) for this service...

Instance "cdbdup", status BLOCKED, has 1 handler(s) for this service...
Service "cdborcl" has 1 instance(s).
Instance "cdborcl", status READY, has 1 handler(s) for this service...
Service "cdborclXDB" has 1 instance(s).
Instance "cdborcl", status READY, has 1 handler(s) for this service...
Service "demo" has 1 instance(s).
Instance "cdborcl", status READY, has 1 handler(s) for this service...
The command completed successfully




3. Startup RMAN duplication command



[oracle@gc12c ~]$ export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
[oracle@gc12c ~]$ rman target sys/password@cdborcl auxiliary sys/password@cdbdup

Recovery Manager: Release 12.1.0.1.0 - Production on Sun Dec 8 21:26:58 2013

Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.

connected to target database: CDBORCL (DBID=2818129616)
connected to auxiliary database: CDBDUP (not mounted)

RMAN> run {
2> duplicate target database to cdbdup from active database
3> db_file_name_convert('cdborcl','cdbdup');
4> }

Starting Duplicate Db at 08-DEC-2013 21:28:11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
current log archived

contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 1636814848 bytes

Fixed Size 2288968 bytes
Variable Size 1006633656 bytes
Database Buffers 620756992 bytes
Redo Buffers 7135232 bytes

contents of Memory Script:
{
sql clone "alter system set db_name =
''CDBORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile"
;
sql clone "alter system set db_unique_name =
''CDBDUP'' comment=
''Modified by RMAN duplicate'' scope=spfile"
;
shutdown clone immediate;
startup clone force nomount
restore clone from service 'cdborcl' primary controlfile;
alter clone database mount;
}
executing Memory Script

sql statement: alter system set db_name = ''CDBORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set db_unique_name = ''CDBDUP'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area 1636814848 bytes

Fixed Size 2288968 bytes
Variable Size 1006633656 bytes
Database Buffers 620756992 bytes
Redo Buffers 7135232 bytes

Starting restore at 08-DEC-2013 21:28:22
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=7 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/cdbdup/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/cdbdup/control02.ctl
Finished restore at 08-DEC-2013 21:28:26

database mounted

contents of Memory Script:
{
set newname for datafile 1 to
"/u01/app/oracle/oradata/cdbdup/system01.dbf";
set newname for datafile 3 to
"/u01/app/oracle/oradata/cdbdup/sysaux01.dbf";
set newname for datafile 4 to
"/u01/app/oracle/oradata/cdbdup/undotbs01.dbf";
set newname for datafile 5 to
"/u01/app/oracle/oradata/cdbdup/pdbseed/system01.dbf";
set newname for datafile 6 to
"/u01/app/oracle/oradata/cdbdup/users01.dbf";
set newname for datafile 7 to
"/u01/app/oracle/oradata/cdbdup/pdbseed/sysaux01.dbf";
set newname for datafile 8 to
"/u01/app/oracle/oradata/cdbdup/demo/system01.dbf";
set newname for datafile 9 to
"/u01/app/oracle/oradata/cdbdup/demo/sysaux01.dbf";
set newname for datafile 10 to
"/u01/app/oracle/oradata/cdbdup/demo/SAMPLE_SCHEMA_users01.dbf";
set newname for datafile 11 to
"/u01/app/oracle/oradata/cdbdup/demo/example01.dbf";
restore
from service 'cdborcl' clone database
;
sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 08-DEC-2013 21:28:30
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/cdbdup/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/cdbdup/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/cdbdup/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/cdbdup/pdbseed/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/cdbdup/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/cdbdup/pdbseed/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/cdbdup/demo/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/cdbdup/demo/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/cdbdup/demo/SAMPLE_SCHEMA_users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/cdbdup/demo/example01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 08-DEC-2013 21:30:39

sql statement: alter system archive log current
current log archived

contents of Memory Script:
{
restore clone force from service 'cdborcl'
archivelog from scn 1899959;
switch clone datafile all;
}
executing Memory Script

Starting restore at 08-DEC-2013 21:30:39
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=26
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service cdborcl
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=27
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-DEC-2013 21:30:41

datafile 1 switched to datafile copy
input datafile copy RECID=17 STAMP=833664641 file name=/u01/app/oracle/oradata/cdbdup/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=18 STAMP=833664641 file name=/u01/app/oracle/oradata/cdbdup/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=19 STAMP=833664641 file name=/u01/app/oracle/oradata/cdbdup/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=20 STAMP=833664642 file name=/u01/app/oracle/oradata/cdbdup/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=21 STAMP=833664642 file name=/u01/app/oracle/oradata/cdbdup/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=22 STAMP=833664642 file name=/u01/app/oracle/oradata/cdbdup/pdbseed/sysaux01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=23 STAMP=833664642 file name=/u01/app/oracle/oradata/cdbdup/demo/system01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=24 STAMP=833664642 file name=/u01/app/oracle/oradata/cdbdup/demo/sysaux01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=25 STAMP=833664642 file name=/u01/app/oracle/oradata/cdbdup/demo/SAMPLE_SCHEMA_users01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=26 STAMP=833664642 file name=/u01/app/oracle/oradata/cdbdup/demo/example01.dbf

contents of Memory Script:
{
set until scn 1900238;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 08-DEC-2013 21:30:42
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 26 is already on disk as file /u01/app/oracle/fast_recovery_area/CDBDUP/archivelog/2013_12_08/o1_mf_1_26_9b8x4002_.arc
archived log for thread 1 with sequence 27 is already on disk as file /u01/app/oracle/fast_recovery_area/CDBDUP/archivelog/2013_12_08/o1_mf_1_27_9b8x40vw_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/CDBDUP/archivelog/2013_12_08/o1_mf_1_26_9b8x4002_.arc thread=1 sequence=26
archived log file name=/u01/app/oracle/fast_recovery_area/CDBDUP/archivelog/2013_12_08/o1_mf_1_27_9b8x40vw_.arc thread=1 sequence=27
media recovery complete, elapsed time: 00:00:02
Finished recover at 08-DEC-2013 21:30:46
Oracle instance started

Total System Global Area 1636814848 bytes

Fixed Size 2288968 bytes
Variable Size 1006633656 bytes
Database Buffers 620756992 bytes
Redo Buffers 7135232 bytes

contents of Memory Script:
{
sql clone "alter system set db_name =
''CDBDUP'' comment=
''Reset to original value by RMAN'' scope=spfile"
;
sql clone "alter system reset db_unique_name scope=spfile";
}
executing Memory Script

sql statement: alter system set db_name = ''CDBDUP'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset db_unique_name scope=spfile
Oracle instance started

Total System Global Area 1636814848 bytes

Fixed Size 2288968 bytes
Variable Size 1006633656 bytes
Database Buffers 620756992 bytes
Redo Buffers 7135232 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CDBDUP" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 50 M ,
GROUP 2 SIZE 50 M ,
GROUP 3 SIZE 50 M
DATAFILE
'/u01/app/oracle/oradata/cdbdup/system01.dbf',
'/u01/app/oracle/oradata/cdbdup/pdbseed/system01.dbf',
'/u01/app/oracle/oradata/cdbdup/demo/system01.dbf'
CHARACTER SET WE8MSWIN1252


contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/app/oracle/oradata/cdbdup/temp01.dbf";
set newname for tempfile 2 to
"/u01/app/oracle/oradata/cdbdup/pdbseed/pdbseed_temp01.dbf";
set newname for tempfile 3 to
"/u01/app/oracle/oradata/cdbdup/demo/demo_temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/cdbdup/sysaux01.dbf",
"/u01/app/oracle/oradata/cdbdup/undotbs01.dbf",
"/u01/app/oracle/oradata/cdbdup/users01.dbf",
"/u01/app/oracle/oradata/cdbdup/pdbseed/sysaux01.dbf",
"/u01/app/oracle/oradata/cdbdup/demo/sysaux01.dbf",
"/u01/app/oracle/oradata/cdbdup/demo/SAMPLE_SCHEMA_users01.dbf",
"/u01/app/oracle/oradata/cdbdup/demo/example01.dbf";
switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/cdbdup/temp01.dbf in control file
renamed tempfile 2 to /u01/app/oracle/oradata/cdbdup/pdbseed/pdbseed_temp01.dbf in control file
renamed tempfile 3 to /u01/app/oracle/oradata/cdbdup/demo/demo_temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/cdbdup/sysaux01.dbf RECID=1 STAMP=833664663
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/cdbdup/undotbs01.dbf RECID=2 STAMP=833664663
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/cdbdup/users01.dbf RECID=3 STAMP=833664663
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/cdbdup/pdbseed/sysaux01.dbf RECID=4 STAMP=833664663
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/cdbdup/demo/sysaux01.dbf RECID=5 STAMP=833664663
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/cdbdup/demo/SAMPLE_SCHEMA_users01.dbf RECID=6 STAMP=833664663
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/cdbdup/demo/example01.dbf RECID=7 STAMP=833664663

datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=833664663 file name=/u01/app/oracle/oradata/cdbdup/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=833664663 file name=/u01/app/oracle/oradata/cdbdup/undotbs01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=3 STAMP=833664663 file name=/u01/app/oracle/oradata/cdbdup/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=4 STAMP=833664663 file name=/u01/app/oracle/oradata/cdbdup/pdbseed/sysaux01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=5 STAMP=833664663 file name=/u01/app/oracle/oradata/cdbdup/demo/sysaux01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=6 STAMP=833664663 file name=/u01/app/oracle/oradata/cdbdup/demo/SAMPLE_SCHEMA_users01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=7 STAMP=833664663 file name=/u01/app/oracle/oradata/cdbdup/demo/example01.dbf

contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script

database opened

contents of Memory Script:
{
sql clone "alter pluggable database all open";
}
executing Memory Script

sql statement: alter pluggable database all open
Cannot remove created server parameter file
Finished Duplicate Db at 08-DEC-2013 21:31:39

RMAN>

RMAN> exit


Recovery Manager complete.




4. Possible errors during the duplicate process



RMAN-05609: Must specify a username for target connection when using active duplicate
RMAN-05610: Must specify a username for auxiliary connection when using active duplicate
ORA-19504: failed to create file "/u01/app/oracle/fast_recovery_area/cdbdup/control02.ctl"
ORA-27040: file create error, unable to create file
RMAN-05520: database name mismatch, auxiliary instance has CDBORCL, command specified CDBDUP




5. What will be the full create controlfile steps?



SQL> alter database  backup controlfile to trace noresetlogs;

Database altered.

SQL> select value from v$diag_info where name ='Default Trace File';

VALUE
--------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/cdbdup/cdbdup/trace/cdbdup_ora_15099.trc

*** 2013-12-08 21:49:43.031
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="CDBDUP"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "CDBDUP" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/fast_recovery_area/CDBDUP/onlinelog/o1_mf_1_9b8x4n3t_.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/fast_recovery_area/CDBDUP/onlinelog/o1_mf_2_9b8x4nv6_.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/fast_recovery_area/CDBDUP/onlinelog/o1_mf_3_9b8x4oqq_.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/cdbdup/system01.dbf',
'/u01/app/oracle/oradata/cdbdup/sysaux01.dbf',
'/u01/app/oracle/oradata/cdbdup/undotbs01.dbf',
'/u01/app/oracle/oradata/cdbdup/pdbseed/system01.dbf',
'/u01/app/oracle/oradata/cdbdup/users01.dbf',
'/u01/app/oracle/oradata/cdbdup/pdbseed/sysaux01.dbf',
'/u01/app/oracle/oradata/cdbdup/demo/system01.dbf',
'/u01/app/oracle/oradata/cdbdup/demo/sysaux01.dbf',
'/u01/app/oracle/oradata/cdbdup/demo/SAMPLE_SCHEMA_users01.dbf',
'/u01/app/oracle/oradata/cdbdup/demo/example01.dbf'
CHARACTER SET WE8MSWIN1252
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/fast_recovery_area/CDBDUP/archivelog/2013_12_08/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/fast_recovery_area/CDBDUP/archivelog/2013_12_08/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Open all the PDBs.
ALTER PLUGGABLE DATABASE ALL OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/cdbdup/temp01.dbf'
SIZE 62914560 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB$SEED;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/cdbdup/pdbseed/pdbseed_temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = DEMO;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/cdbdup/demo/demo_temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = CDB$ROOT;
-- End of tempfile additions.

No comments:

Post a Comment