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/restorehrtestMarch11th.txt;
RMAN> run {
startup clone nomount;
allocate auxiliary channel aux1 device type disk;
set until scn 126523242282;
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 Tue Mar 10 12:35:24 2026
Version 19.28.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 '11-MAR-2026';
list backup of controlfile completed before '11-MAR-2026';
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1912393 Full 26.86M DISK 00:00:00 10-MAR-26
BP Key: 1912395 Status: AVAILABLE Compressed: NO Tag: TAG20260310T021545
Piece Name: /usr/opt/app/dbdump/hot_backup/HRPROD/HRPROD_AutoCTL_c-3518093084-20260310-00.bak
Control File Included: Ckp SCN: 126523242282 Ckp time: 10-MAR-26
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1912451 Full 26.86M DISK 00:00:00 10-MAR-26
BP Key: 1912455 Status: AVAILABLE Compressed: NO Tag: TAG20260310T123133
Piece Name: /usr/opt/app/dbdump/hot_backup/HRPROD/HRPROD_AutoCTL_c-3518093084-20260310-01.bak
Control File Included: Ckp SCN: 126524962082 Ckp time: 10-MAR-26
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/restorehrtestMar11th.txt;
RMAN> run {
startup clone nomount;
allocate auxiliary channel aux1 device type disk;
set until scn 126523242282;
DUPLICATE target database to hrtest
nofilenamecheck
db_file_name_convert = (
'/usr/opt/app/oracle/admin/hrprod/data01', '/usr/opt/app/oracle/admin/hrtest/data01'
'/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/system01'
'/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/undo01'
'/usr/opt/app/oracle/admin/hrprod/xdb_wallet', '/usr/opt/app/oracle/admin/hrtest/xdb_wallet'
'/usr/opt/app/oracle/admin/hrprod/ext01', '/usr/opt/app/oracle/admin/hrtest/ext01'
'/usr/opt/app/oracle/admin/hrprod/rman_dir', '/usr/opt/app/oracle/admin/hrtest/rman_dir'
'/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