Oracle : Restore script for HRTEST
Run PT_CONFIG_TABLE_EXP.DMS to capture tools tables from target environment - hrtest
From HRPROD:
>rman target / catalog hrprod19/bkup_123@rmprod auxiliary sys/cZQwV3EqQy9K_M@hrtest
RMAN> spool log to /usr/local/oracle/restorehrtestMay2nd.txt;
RMAN> run {
startup clone nomount;
allocate auxiliary channel aux1 device type disk;
set until scn 125141640077;
DUPLICATE target database to hrtest
nofilenamecheck
db_file_name_convert = (
'hrprod','hrtest'
);
}
spool log off
On HRPROD:
oracle-pshrdb602.tmw.com:hrprod:/usr/opt/app/oracle/orahome>rman target / catalog hrprod19/bkup_123@rmprod
Recovery Manager: Release 19.0.0.0.0 - Production on Fri Jun 20 10:18:21 2025
Version 19.27.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: HRPROD (DBID=3518093084)
connected to recovery catalog database
RMAN> list backup of controlfile completed before '21-JUN-2025';
list backup of controlfile completed before '21-JUN-2025';
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1772710 Full 26.73M DISK 00:00:00 20-JUN-25
BP Key: 1772712 Status: AVAILABLE Compressed: NO Tag: TAG20250620T022956
Piece Name: /usr/opt/app/dbdump/hot_backup/HRPROD/HRPROD_AutoCTL_c-3518093084-20250620-00.bak
Control File Included: Ckp SCN: 125141640077 Ckp time: 20-JUN-25
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1772762 Full 26.73M DISK 00:00:00 20-JUN-25
BP Key: 1772765 Status: AVAILABLE Compressed: NO Tag: TAG20250620T093052
Piece Name: /usr/opt/app/dbdump/hot_backup/HRPROD/HRPROD_AutoCTL_c-3518093084-20250620-01.bak
Control File Included: Ckp SCN: 125143085087 Ckp time: 20-JUN-25
RMAN>
oracle-pshrtstdb602.tmw.com:hrtest:/usr/local/oracle/rman_HRTEST>rman target / catalog hrtest19/bkup_123@rmprod
Recovery Manager: Release 19.0.0.0.0 - Production on Mon Nov 29 11:21:54 2021
Version 19.12.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: HRTEST (DBID=3790096553, not open)
connected to recovery catalog database
RMAN> drop database noprompt;
database name is "HRTEST" and DBID is 3790096553
database dropped
RMAN> exit
Recovery Manager complete.
RMAN> spool log to /usr/local/oracle/restorehrtestJan21st.txt;
RMAN> run {
startup clone nomount;
allocate auxiliary channel aux1 device type disk;
set until scn 48980484328;
set newname for datafile 96 to '/usr/opt/app/oracle/admin/hrtest/data02/psimage_01.dbf';
set newname for datafile 97 to '/usr/opt/app/oracle/admin/hrtest/data02/psimage_02.dbf';
DUPLICATE target database to hrtest
nofilenamecheck
db_file_name_convert = (
'hrprod','hrtest'
);
}
spool log off
RMAN> spool log to /usr/local/oracle/restorehrtestMar4th.txt;
RMAN> run {
startup clone nomount;
allocate auxiliary channel aux1 device type disk;
set until scn 45681049900;
DUPLICATE target database to hrtest
nofilenamecheck
db_file_name_convert = (
'/usr/opt/app/oracle/admin/hrprod/data01', '/usr/opt/app/oracle/admin/hrtest/data02'
'/usr/opt/app/oracle/admin/hrprod/ndx01', '/usr/opt/app/oracle/admin/hrtest/ndx01'
'/usr/opt/app/oracle/admin/hrprod/flash01', '/usr/opt/app/oracle/admin/hrtest/flash01'
'/usr/opt/app/oracle/admin/hrprod/redo01', '/usr/opt/app/oracle/admin/hrtest/redo01'
'/usr/opt/app/oracle/admin/hrprod/redo02', '/usr/opt/app/oracle/admin/hrtest/redo02'
'/usr/opt/app/oracle/admin/hrprod/system01', '/usr/opt/app/oracle/admin/hrtest/system02'
'/usr/opt/app/oracle/admin/hrprod/temp01', '/usr/opt/app/oracle/admin/hrtest/temp01'
'/usr/opt/app/oracle/admin/hrprod/undo01', '/usr/opt/app/oracle/admin/hrtest/undo02'
'/usr/opt/app/oracle/admin/hrprod/arch', '/usr/opt/app/oracle/admin/hrtest/arch');
}
spool log off
It is preferred that you use 'set until . . . ' else rman will look for most recent archive logs if you don't use that clause,
and you can get these errors while restoring: RMAN-06053 and RMAN-06025
Comments
Post a Comment