Prerequisites Specific to Active Database Duplication
When you execute
DUPLICATE
with FROM ACTIVE DATABASE
, at least one normal target channel and at least one AUXILIARY
channel are required.
When you connect RMAN to the source database as
TARGET
, you must specify a password, even if RMAN uses operating system authentication. The source database must be mounted or open. If the source database is open, then archiving must be enabled. If the source database is not open, then it must have been shut down consistently.
When you connect RMAN to the auxiliary instance, you must provide a net service name. This requirement applies even if the auxiliary instance is on the local host.
The source database and auxiliary instances must use the same
SYSDBA
password, which means that both instances must have password files. You can create the password file with a single password so you can start the auxiliary instance and enable the source database to connect to it.
The
DUPLICATE
behavior for password files varies depending on whether your duplicate database acts as a standby database. If you create a duplicate database that is not a standby database, then RMAN does not copy the password file by default. You can specify the PASSWORD FILE
option to indicate that RMAN should overwrite the existing password file on the auxiliary instance. If you create a standby database, then RMAN copies the password file to the standby host by default, overwriting the existing password file. In this case, the PASSWORD FILE
clause is not necessary.
You cannot use the
UNTIL
clause when performing active database duplication. RMAN chooses a time based on when the online data files have been completely copied, so that the data files can be recovered to a consistent point in time.Source database name = orcl
Duplicate database name = test
Catalog database name= catalog
tnsname for target =orcl
tnsnames for catalog= catalog
Step 1:
Create a backup of the source database, if a suitable one doesn't already exist.
Create a password file for the duplicate instance.
$ rman target=/
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
Step 2:Create a password file for the duplicate instance.
$ orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwtest password=password entries=10
Step 3: Add the listener for the test database
listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = test)
)
)
listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = test)
)
)
Add the tnsname for the test database
tnsnames.ora:
CLONE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)
Restart the listener
$ lsnrctl stop
$ lsnrctl start
Step 4: create pfile from the "orcl" database
SQL> create pfile from spfile;
SQL> create pfile from spfile;
Step 5: copy pfile to target server and rename the pfile as inittest.ora
Edit inittest.ora file for duplicate database.
Edit inittest.ora file for duplicate database.
*.control_files='/disk1/app/oracle/oradata/test/control01.ctl'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'
*.db_file_multiblock_read_count=16
*.db_name='test'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/disk1/app/oracle/admin/test/udump'
*.compatible='10.2.0.1.0'
*.core_dump_dest='/disk1/app/oracle/admin/test/cdump'
*.db_block_size=8192
db_file_name_convert='/disk1/app/oracle/oradata/orcl','/u01/app/oracle/oradata/test'
log_file_name_convert='/disk1/app/oracle/oradata/orcl','/u01/app/oracle/oradata/test'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/disk1/app/oracle/admin/test/udump'
*.compatible='10.2.0.1.0'
*.core_dump_dest='/disk1/app/oracle/admin/test/cdump'
*.db_block_size=8192
db_file_name_convert='/disk1/app/oracle/oradata/orcl','/u01/app/oracle/oradata/test'
log_file_name_convert='/disk1/app/oracle/oradata/orcl','/u01/app/oracle/oradata/test'
Note : parameters marked in red are important
Step 6: Set the environment for the dulplicate database.
$export ORACLE_SID=test
Step 7: Start the database
$sqlplus / as sysdba
Sql>startup nomount
Step 8: Connect to RMAN
$rman target=system/system@orcl catalog=rman/rman@catalog auxiliary system/system@test
connected to target database: ORCL (DBID=231273269)
connected to recovery catalog database
connected to auxiliary database: TEST(DBID=99469477)
Rman >run{
run {
allocate channel ch device type disk;
allocate auxiliary channel aux device type disk;
duplicate database to "test" FROM ACTIVE DATABASE SPFILE NOFILENAMECHECK;
}
OUTPUT
allocated channel: aux1
channel aux1: sid=156 devtype=DISK
Starting Duplicate Db at 01-JAN-10
contents of Memory Script:
.......................................................
........................................................
....................................................
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db
Step 9: Create spflile from memory
Step 10: check whether is there any invalid objects or not.
Step 11: check dba_directory for invalid paths. if there is any resolve them.
Step 12: check dba_db_links. if there is any resolve them.
Step 13: Add an entry in /etc/oratab file
Step 14: Register with the rman recovery catalog if necessary.
NOTE:
Remove "DB_UNIQUE_NAME" from parameter file
It gives cant open database in exclusive mode' issue
Remove "DB_UNIQUE_NAME" from parameter file
It gives cant open database in exclusive mode' issue