Active database duplication copies the target database over the network to the destination and then creates the duplicate database.
The duplication work is performed by an auxiliary channel. This channel corresponds to a server session on the auxiliary instance on the auxiliary host
This documents will focus on the steps that needs to be perform while cloning the database using
RMAN.
Roadmap:
1. Create the parameter file (initdup.ora) with proper parameters eg: db_file_name_convert,
Log_file_name_convert, undo_tablespace, controlfile etc…
2. Create a password file.
3. Establish Oracle Net Connectivity to the Auxiliary Instance
4. Create the directories which are required for the duplicate database.
5. Start the Auxiliary/target instance from Sqlplus
6. Test connectivity to auxiliary and target instance from the Both Sides.
7. Connect to the auxiliary Database Instances check the space availability on file system/ ASM
8. Run the RMAN duplicate command.
1. Creating initialization Parameter file for the Duplicate database.
If we don’t have the p/spfile with us for new database, we need to create a new pfile to start the
instance with minimum below parameters in it.
DB_NAME=
CONTROL_FILES=
DB_BLOCK_SIZE=
DB_FILE_NAME_CONVERT=
LOG_FILE_NAME_CONVERT=
UNDO_TABLESPACE = should have same name as that of the source DB UNDO tablespace.
Create a pfile in “$ORACLE_HOME/dbs/” path with only above parameters.
2. Create a password file.
Now we have to create the password file with the same password as that of the source database
cd $ORACLE_HOME/dbs
orapwd password=ORCL file=orapwDUP_DB
3. Establish Oracle Net Connectivity to the Auxiliary Instance
Now we need to make an entry of the source database into the “tsnames.ora” file of the auxiliary
database as shown below
PROD_DB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD_DB)
)
)
DUP_DB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DUP_DB)
)
)
4. Create the directories which are required for the duplicate database.
Now if we are using the conventional file system, we need to create a desired directory
structure on destination server using ‘ mkdir’ command but if we are using ASM as a underlying
file system, we no need to create a directory structure. We have already set the
DB_FILE_NAME_CONVERT & LOG_FILE_NAME_CONVERT parameters in pfile.
5. Start the Auxiliary instance from Sqlplus
Now we need to start the auxiliary database instance till NOMOUNT state only with newly
created pfile in step 1.
Export ORACLE_SID=DUP_DB
Export ORACLE_HOME=
Sqlplus / as sysdba
SQL>startup nomount pfile=’<PATH OF PFILE’>;
Eg: SQL> startup nomount pfile='/oracle/RQ1/112_64/dbs/initRQ1.ora';
6. Test connectivity to auxiliary and target instance from the Both Sides.
Now we have to test the connectivity between source & auxiliary database we setup in step 4.
sqlplus sys/xxxx@PROD_DB as sysdba
sqlplus sys/xxxx@DUP_DB as sysdba
7. Connect to the auxiliary DB & check the space availability on file system/ ASM
Now we need to check if there is enough free space available & which can accommodate the
data of new database here.
Export ORACLE_SID=+ASM
Export ORACLE_HOME=
Sqlplus / as sysasm
Set linesize 200
column pct_free format 99.99
select name, total_mb/1024 TotalGB, free_mb/1024 FreeeGB, (total_mb -free_mb)/1024 used_gb,
free_mb/total_mb *100 pct_free from v$asm_diskgroup;
8. Run the RMAN duplicate command.
Once all the above steps are set, we are good to go with the actual RMAN Duplicate command.
rman TARGET sys/xxxx@PROD_DB AUXILIARY sys/xxxx@DUP_DB
RMAN> DUPLICATE TARGET DATABASE TO RQ1 FROM ACTIVE DATABASE;
As part of the duplicating operation, RMAN automates the following steps:
1) Create Spfile in memory
2) Shut down the instance started with pfile
3) startup with the newly created in memory spfile
4) Restore the control file
5) Mount the database
6) set newname for the datafiles
7) restotre the datafiles
8) Recover the newly restored database (Untill SCN).
9) Create a new controlfile with new/duplicate DB name
10) Open the database in resetlogs mode.
Note: If there is any small error even at the last step of the duplicate command, we need to repeat all the steps from step 5 ie: starting the instance using pfile, which is very time consuming process. So please keenly monitor the duplicate database status for any errors
No comments:
Post a Comment