Clone using RMAN backup - Target on different server ( Source PROD11 , Target TEST ) - Oracle 11g
******************* Start ******************
**** SOURCE
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/prod11/prod11/users01.dbf
/u04/app/oracle/oradata/prod11/prod11/undotbs01.dbf
/u04/app/oracle/oradata/prod11/prod11/sysaux01.dbf
/u04/app/oracle/oradata/prod11/prod11/system01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/prod11/prod11/redo03.log
/u04/app/oracle/oradata/prod11/prod11/redo02.log
/u04/app/oracle/oradata/prod11/prod11/redo01.log
SQL> select NAME,db_unique_name from v$database;
NAME DB_UNIQUE_NAME
--------- ------------------------------
PROD11 prod11
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
prod11
**** TAKE RMAN FULL BACKUP
rman target /
connected to target database: PROD11 (DBID=4142957128)
RMAN> sql "alter session set nls_date_format=''dd.mm.yyyy hh24:mi:ss''";
RUN
{
configure controlfile autobackup on;
set command id to 'DBPROD11FULL';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
ALLOCATE CHANNEL c2 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_FULL' ;
backup archivelog all
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_ARCHIVE' ;
backup current controlfile
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_CONTROL';
release channel c1;
release channel c2;
}
**** COPY THE BACKUP PIECES on TEST SERVER
[oracle@prod backup]$ ls -ltr
total 324396
-rw-r----- 1 oracle oinstall 74383360 Feb 07 20:58 PROD11_20200212_2_1_FULL
-rw-r----- 1 oracle oinstall 185679872 Feb 07 20:58 PROD11_20200212_1_1_FULL
-rw-r----- 1 oracle oinstall 38057984 Feb 07 20:58 PROD11_20200212_4_1_ARCHIVE
-rw-r----- 1 oracle oinstall 23897088 Feb 07 20:58 PROD11_20200212_3_1_ARCHIVE
-rw-r----- 1 oracle oinstall 9797632 Feb 07 20:58 PROD11_20200212_5_1_CONTROL
[oracle@prod backup]$ scp PROD* oracle@stand.som.com:/u01/backup/
**** ON TARGET NOW ..........
**** ENV FILE
[oracle@stand ~]$ cat test.env
export ORACLE_SID=test
export ORACLE_HOME=/u04/app/oracle/11g
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$ORACLE_HOME/bin:/opt/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
**** DBS file ( init and password files ) and then NOMOUNT TEST DATABASE
[oracle@stand dbs]$ cat inittest.ora
test.__db_cache_size=251658240
test.__java_pool_size=4194304
test.__large_pool_size=4194304
test.__oracle_base='/u04/app/oracle'#ORACLE_BASE set from environment
test.__pga_aggregate_target=130023424
test.__sga_target=381681664
test.__shared_io_pool_size=0
test.__shared_pool_size=113246208
test.__streams_pool_size=0
*.audit_file_dest='/u04/app/oracle/admin/test/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u04/app/oracle/oradata/test/control01.ctl','/u04/app/oracle/oradata/test/control02.ctl'
*.db_file_name_convert='/u04/app/oracle/oradata/prod11/prod11','/u04/app/oracle/oradata/test'
*.log_file_name_convert='/u04/app/oracle/oradata/prod11/prod11','/u04/app/oracle/oradata/test'
*.db_block_size=8192
*.db_domain=''
*.db_name='test'
*.diagnostic_dest='/u04/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
##*.local_listener='LISTENER_TEST'
*.log_archive_dest_1='LOCATION=/u04/app/oracle/oraarch'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=126877696
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=380633088
*.undo_tablespace='UNDOTBS1'
[oracle@stand dbs]$ ls -ltr orapwtes*
-rw-r----- 1 oracle oinstall 1536 Feb 07 21:04 orapwtest
SQL> startup nomount pfile='inittest.ora'
ORACLE instance started.
Total System Global Area 379965440 bytes
Fixed Size 2213576 bytes
Variable Size 121637176 bytes
Database Buffers 251658240 bytes
Redo Buffers 4456448 bytes
SQL> exit
**** RMAN SCRIPT:
=========================================
[oracle@stand dbs]$ rman
RMAN> connect auxiliary /
connected to auxiliary database: TEST (not mounted)
RMAN> run
{
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
DUPLICATE DATABASE TO "TEST" BACKUP LOCATION '/u01/backup/';
}2> 3> 4> 5> 6>
...
.....
......
database opened
Finished Duplicate Db at 07-FEB-19
released channel: aux1
released channel: aux2
RMAN>
=========================================
**** VALIDATION :
[oracle@stand dbs]$ ps -ef|grep pmon
oracle 16879 1 0 21:35 ? 00:00:00 ora_pmon_test
SQL> select NAME,db_unique_name from v$database;
NAME DB_UNIQUE_NAME
--------- ------------------------------
TEST
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/test/system01.dbf
/u04/app/oracle/oradata/test/sysaux01.dbf
/u04/app/oracle/oradata/test/undotbs01.dbf
/u04/app/oracle/oradata/test/users01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/test/redo03.log
/u04/app/oracle/oradata/test/redo02.log
/u04/app/oracle/oradata/test/redo01.log
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
test
******************* END ******************
Thanks,
******************* Start ******************
**** SOURCE
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/prod11/prod11/users01.dbf
/u04/app/oracle/oradata/prod11/prod11/undotbs01.dbf
/u04/app/oracle/oradata/prod11/prod11/sysaux01.dbf
/u04/app/oracle/oradata/prod11/prod11/system01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/prod11/prod11/redo03.log
/u04/app/oracle/oradata/prod11/prod11/redo02.log
/u04/app/oracle/oradata/prod11/prod11/redo01.log
SQL> select NAME,db_unique_name from v$database;
NAME DB_UNIQUE_NAME
--------- ------------------------------
PROD11 prod11
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
prod11
**** TAKE RMAN FULL BACKUP
rman target /
connected to target database: PROD11 (DBID=4142957128)
RMAN> sql "alter session set nls_date_format=''dd.mm.yyyy hh24:mi:ss''";
RUN
{
configure controlfile autobackup on;
set command id to 'DBPROD11FULL';
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
ALLOCATE CHANNEL c2 DEVICE TYPE disk;
backup AS COMPRESSED BACKUPSET full database
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_FULL' ;
backup archivelog all
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_ARCHIVE' ;
backup current controlfile
tag PROD_FULL
format '/u01/backup/%d_%T_%s_%p_CONTROL';
release channel c1;
release channel c2;
}
**** COPY THE BACKUP PIECES on TEST SERVER
[oracle@prod backup]$ ls -ltr
total 324396
-rw-r----- 1 oracle oinstall 74383360 Feb 07 20:58 PROD11_20200212_2_1_FULL
-rw-r----- 1 oracle oinstall 185679872 Feb 07 20:58 PROD11_20200212_1_1_FULL
-rw-r----- 1 oracle oinstall 38057984 Feb 07 20:58 PROD11_20200212_4_1_ARCHIVE
-rw-r----- 1 oracle oinstall 23897088 Feb 07 20:58 PROD11_20200212_3_1_ARCHIVE
-rw-r----- 1 oracle oinstall 9797632 Feb 07 20:58 PROD11_20200212_5_1_CONTROL
[oracle@prod backup]$ scp PROD* oracle@stand.som.com:/u01/backup/
**** ON TARGET NOW ..........
**** ENV FILE
[oracle@stand ~]$ cat test.env
export ORACLE_SID=test
export ORACLE_HOME=/u04/app/oracle/11g
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=$ORACLE_HOME/bin:/opt/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
**** DBS file ( init and password files ) and then NOMOUNT TEST DATABASE
[oracle@stand dbs]$ cat inittest.ora
test.__db_cache_size=251658240
test.__java_pool_size=4194304
test.__large_pool_size=4194304
test.__oracle_base='/u04/app/oracle'#ORACLE_BASE set from environment
test.__pga_aggregate_target=130023424
test.__sga_target=381681664
test.__shared_io_pool_size=0
test.__shared_pool_size=113246208
test.__streams_pool_size=0
*.audit_file_dest='/u04/app/oracle/admin/test/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u04/app/oracle/oradata/test/control01.ctl','/u04/app/oracle/oradata/test/control02.ctl'
*.db_file_name_convert='/u04/app/oracle/oradata/prod11/prod11','/u04/app/oracle/oradata/test'
*.log_file_name_convert='/u04/app/oracle/oradata/prod11/prod11','/u04/app/oracle/oradata/test'
*.db_block_size=8192
*.db_domain=''
*.db_name='test'
*.diagnostic_dest='/u04/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
##*.local_listener='LISTENER_TEST'
*.log_archive_dest_1='LOCATION=/u04/app/oracle/oraarch'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=126877696
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=380633088
*.undo_tablespace='UNDOTBS1'
[oracle@stand dbs]$ ls -ltr orapwtes*
-rw-r----- 1 oracle oinstall 1536 Feb 07 21:04 orapwtest
SQL> startup nomount pfile='inittest.ora'
ORACLE instance started.
Total System Global Area 379965440 bytes
Fixed Size 2213576 bytes
Variable Size 121637176 bytes
Database Buffers 251658240 bytes
Redo Buffers 4456448 bytes
SQL> exit
**** RMAN SCRIPT:
=========================================
[oracle@stand dbs]$ rman
RMAN> connect auxiliary /
connected to auxiliary database: TEST (not mounted)
RMAN> run
{
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
DUPLICATE DATABASE TO "TEST" BACKUP LOCATION '/u01/backup/';
}2> 3> 4> 5> 6>
...
.....
......
database opened
Finished Duplicate Db at 07-FEB-19
released channel: aux1
released channel: aux2
RMAN>
=========================================
**** VALIDATION :
[oracle@stand dbs]$ ps -ef|grep pmon
oracle 16879 1 0 21:35 ? 00:00:00 ora_pmon_test
SQL> select NAME,db_unique_name from v$database;
NAME DB_UNIQUE_NAME
--------- ------------------------------
TEST
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/test/system01.dbf
/u04/app/oracle/oradata/test/sysaux01.dbf
/u04/app/oracle/oradata/test/undotbs01.dbf
/u04/app/oracle/oradata/test/users01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u04/app/oracle/oradata/test/redo03.log
/u04/app/oracle/oradata/test/redo02.log
/u04/app/oracle/oradata/test/redo01.log
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
test
******************* END ******************
Thanks,
No comments:
Post a Comment