Duplicate database using RMAN

Posted on: 2023-03-15 14:27:16


orapwd file=/u01/app/oracle/product/9.2.0.1.0/dbs/orapwDUP password=password entries=10

 

 

db_name='Duplicate name'

CONTROL_FILES=(/u02/oradata/DUP/control01.ctl, /u02/oradata/DUP/control02.ctl, /u02/oradata/DUP/control03.ctl)

DB_FILE_NAME_CONVERT=(/u02/oradata/TSH1/,/u02/oradata/DUP/)

 LOG_FILE_NAME_CONVERT=(/u01/oradata/TSH1/,/u01/oradata/DUP/)

 

 

(Find Datafile number by typing RMAN>report schema;)

For getting set newname please use below query in source.

select 'SET NEWNAME FOR DATAFILE '||FILE#||' to '||''''||'+DATA01/DUPLICAT/DATAFILE'||substr(name,instr(name,'/',-1))||''''||' ; ' from v$dbfile;

select 'SET NEWNAME FOR TEMPFILE '||FILE#||' to '||''''||'+DATA01/DUPLICAT/DATAFILE'||substr(name,instr(name,'/',-1))||''''||' ; ' from v$tempfile;

 

$ rman target / auxiliary sys/oracle123@dup @/u01/duplicat.rcv

cat /u01/duplicat.rcv

RUN

{

allocate auxiliary channel a1 device type disk;

allocate auxiliary channel a2 device type disk;

set newname for datafile 1 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_SYSTEM_1DT8JGN2_.DBF';

set newname for datafile 2 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USERS_16_1M08DN7D_.DBF';

set newname for datafile 3 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_SYSAUX_1NBJ85GR_.DBF';

set newname for datafile 4 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USERS_1DT8LVYG_.DBF';

set newname for datafile 5 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_UNDOTBS2_1JOTM2S4_.DBF';

set newname for datafile 6 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_CW4ORA_D_1OH2VGQP_.DBF';

set newname for datafile 7 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_CW4ORA_I_1OH2XWW4_.DBF';

set newname for datafile 8 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USERS2_1V1OPZWO_.DBF';

set newname for datafile 9 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USER_LOB_1WKM1WSD_.DBF';

set newname for tempfile 1 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_TEMP_1P47MLKR_.TMP';

DUPLICATE TARGET DATABASE TO "CLONE"

LOGFILE

GROUP 1 ('C:\ORACLE\DUPLICAT\REDO01.RDO') SIZE 10M,

GROUP 2 ('C:\ORACLE\DUPLICAT\REDO02.RDO') SIZE 10M,

GROUP 3 ('C:\ORACLE\DUPLICAT\REDO03.RDO') SIZE 10M;

release channel a1;

release channel a2;

}

 

 

# Duplicate database to TARGET's state 4 days ago.

 

 

Parameter

sga_max_size

shared_pool_size

shared_pool_reserved_size

db_cache_size

 

============================================================================

Making clone database from tape backup

connect rcvcat rman102cat/rman102cat@rmancolldbcat

connect target rman102user/rman102@orsblp1(PROD)

connect auxiliary sys/oracle

set parallelmediarestore off;

run {

set command id to 'rman';

set until time "to_date('Dec 17 2010 09:15:00','Mon DD YYYY HH24:MI:SS')";

allocate auxiliary channel aux1 type 'SBT_TAPE'

parms 'ENV=(NSR_SERVER=cebra.tele2.se,NSR_CLIENT=marvin.corp.tele2.com)';

allocate auxiliary channel aux2 type 'SBT_TAPE'

parms 'ENV=(NSR_SERVER=cebra.tele2.se,NSR_CLIENT=marvin.corp.tele2.com)';

duplicate target database to orsblpp(UAT)

logfile

'/redo3/orsblpp/redologa/orsblpp_redo1a.log' size 1000m,

'/redo3/orsblpp/redologa/orsblpp_redo2a.log' size 1000m,

'/redo3/orsblpp/redologa/orsblpp_redo3a.log' size 1000m,

'/redo3/orsblpp/redologa/orsblpp_redo4a.log' size 1000m;

release channel aux1;

release channel aux2;

}

orapwd file=/u01/app/oracle/product/9.2.0.1.0/dbs/orapwDUP password=password entries=10

 

 

db_name='Duplicate name'

CONTROL_FILES=(/u02/oradata/DUP/control01.ctl, /u02/oradata/DUP/control02.ctl, /u02/oradata/DUP/control03.ctl)

DB_FILE_NAME_CONVERT=(/u02/oradata/TSH1/,/u02/oradata/DUP/)

 LOG_FILE_NAME_CONVERT=(/u01/oradata/TSH1/,/u01/oradata/DUP/)

 

 

(Find Datafile number by typing RMAN>report schema;)

For getting set newname please use below query in source.

select 'SET NEWNAME FOR DATAFILE '||FILE#||' to '||''''||'+DATA01/DUPLICAT/DATAFILE'||substr(name,instr(name,'/',-1))||''''||' ; ' from v$dbfile;

select 'SET NEWNAME FOR TEMPFILE '||FILE#||' to '||''''||'+DATA01/DUPLICAT/DATAFILE'||substr(name,instr(name,'/',-1))||''''||' ; ' from v$tempfile;

 

$ rman target / auxiliary sys/oracle123@dup @/u01/duplicat.rcv

cat /u01/duplicat.rcv

RUN

{

allocate auxiliary channel a1 device type disk;

allocate auxiliary channel a2 device type disk;

set newname for datafile 1 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_SYSTEM_1DT8JGN2_.DBF';

set newname for datafile 2 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USERS_16_1M08DN7D_.DBF';

set newname for datafile 3 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_SYSAUX_1NBJ85GR_.DBF';

set newname for datafile 4 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USERS_1DT8LVYG_.DBF';

set newname for datafile 5 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_UNDOTBS2_1JOTM2S4_.DBF';

set newname for datafile 6 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_CW4ORA_D_1OH2VGQP_.DBF';

set newname for datafile 7 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_CW4ORA_I_1OH2XWW4_.DBF';

set newname for datafile 8 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USERS2_1V1OPZWO_.DBF';

set newname for datafile 9 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_USER_LOB_1WKM1WSD_.DBF';

set newname for tempfile 1 to 'C:\ORACLE\DUPLICAT\DATAFILE\O1_MF_TEMP_1P47MLKR_.TMP';

DUPLICATE TARGET DATABASE TO "CLONE"

LOGFILE

GROUP 1 ('C:\ORACLE\DUPLICAT\REDO01.RDO') SIZE 10M,

GROUP 2 ('C:\ORACLE\DUPLICAT\REDO02.RDO') SIZE 10M,

GROUP 3 ('C:\ORACLE\DUPLICAT\REDO03.RDO') SIZE 10M;

release channel a1;

release channel a2;

}

 

 

# Duplicate database to TARGET's state 4 days ago.

 

 

Parameter

sga_max_size

shared_pool_size

shared_pool_reserved_size

db_cache_size

 

============================================================================

Making clone database from tape backup

connect rcvcat rman102cat/rman102cat@rmancolldbcat

connect target rman102user/rman102@orsblp1(PROD)

connect auxiliary sys/oracle

set parallelmediarestore off;

run {

set command id to 'rman';

set until time "to_date('Dec 17 2010 09:15:00','Mon DD YYYY HH24:MI:SS')";

allocate auxiliary channel aux1 type 'SBT_TAPE'

parms 'ENV=(NSR_SERVER=cebra.tele2.se,NSR_CLIENT=marvin.corp.tele2.com)';

allocate auxiliary channel aux2 type 'SBT_TAPE'

parms 'ENV=(NSR_SERVER=cebra.tele2.se,NSR_CLIENT=marvin.corp.tele2.com)';

duplicate target database to orsblpp(UAT)

logfile

'/redo3/orsblpp/redologa/orsblpp_redo1a.log' size 1000m,

'/redo3/orsblpp/redologa/orsblpp_redo2a.log' size 1000m,

'/redo3/orsblpp/redologa/orsblpp_redo3a.log' size 1000m,

'/redo3/orsblpp/redologa/orsblpp_redo4a.log' size 1000m;

release channel aux1;

release channel aux2;

}



xedok When seeking the best software development companies Xedok Software is your ultimate choice. For Demos click here



Leave a reply