DB Cloning through RMAN active database
On Auxiliary DB (in this case TEST):
1. Make
sure that the “db_name” parameter is TEST.
SQL> show parameter
db_name
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
db_name string TEST
SQL>
2. Shutdown
the database
SQL> shutdown immediate
3. Delete
the datafiles from OS level (as you do for Step-6 in clone document). Control
files also must be deleted
4. Make
sure that tnsping works for both target & Auxiliary databases from both the
Servers.
tnsping PROD
tnsping TEST
5. Start
TEST DB in nomount state.
SQL> startup nomount
6. Execute
the below command on amxd07db02 Server.
rman target sys/<password>@PROD
auxiliary sys/<password>@TEST @/home/is_sup/oracle/clone_PROD_to_TEST.rcv
log /u01/log/TEST_duplicate_active_<DDMMYYYY>.log &
>!more
clone_PROD_to_TEST.rcv
>!more
clone_PROD_to_TEST.rcv
run
{
allocate
channel t1 type disk;
allocate
channel t2 type disk;
allocate
auxiliary channel c1 type disk;
allocate
auxiliary channel c2 type disk;
allocate
auxiliary channel c3 type disk;
allocate
auxiliary channel c4 type disk;
set
newname for tempfile 1 to '/TEST/data01/temp01.dbf';
set
newname for tempfile 2 to '/TEST/data01/temp02.dbf';
set
newname for tempfile 3 to '/TEST/data01/temp03.dbf';
set
newname for tempfile 4 to '/TEST/data01/temp04.dbf';
set
newname for tempfile 5 to '/TEST/data01/temp05.dbf';
duplicate
database to TEST from active database nofilenamecheck logfile GROUP 1 ('/TEST/data01/log01a.dbf','/TEST/data01/log01b.dbf')
SIZE 1024M, GROUP 2 ('/LMINF
1/data01/log02a.dbf','/TEST/data01/log02b.dbf')
SIZE 1024M;
release
channel t1;
release
channel t2;
release
channel c1;
release
channel c2;
release
channel c3;
release
channel c4;
}
clone_PROD_
Common Errors:
Ø Make
sure that the auxiliary database to which it connects during restore should be
TEST. If not, then please verify the pfile as mentioned in Step-1.
Connected to target database :PROD (DBID= #)
Connected to auxiliary database : TEST ( not mounted)
Ø If
the above db_name parameter mentioned in Step-1 has PROD, then:
a. Create
pfile from the spfile
SQL> create pfile from spfile;
b. Shutdown
TEST
SQL> shutdown immediate
c. Edit
the “db_name” parameter in pfile as “TEST”
pfile
location=/TEST/ora01/oracle/product/11.2.0.3/dbs/initTEST.ora
*.DB_NAME= 'TEST' #Reset to original
name by RMAN
d. Create
spfile from pfile and Start TEST DB
SQL> create spfile from pfile;
SQL> startup nomount
Ø If
tnsping fails at Step-4, then add the TNS entry of the respective database in
tnsnames.ora file on that Server and test the tnsping connection again on both
the Servers for both the databases.
Ø If
sys password doesn’t work on TEST:
a. Take
backup of the existing password file of TEST
b. Copy
the password file of PROD to amxd07db02 and rename it as orapwTEST, so that
rman command succeeds.
No comments:
Post a Comment