Restore SINGLE database to different client
Envirenment
- Master Server: Netbackup-master (NBU 7.7.3)
- Source node: MC-PMS-DB(OEL6.7, Oracle database 11.2.0.4)
- Destination Client: MC-POSHIS-DB (OEL6.7, Oracle database 11.2.0.4)
- DBID=2147825860
requirements
- Successful Netbackup backup of set.
- Same version of database.
- Record Source DBID/DATAFILE/TABLESPACE.
- Install database software only on Destination client.
- Install Netbackup client software on Destination client.
Touch the file on the master server: => /usr/openv/netbackup/db/altnames/No.Restrictions
SQL> select name from v$datafile; Press Return to Continue SQL> select name from v$tempfile; SQL> select name from v$controlfile; SQL> select member from v$logfile;
Master Server hosts file
Netbackup-master:/home/maintenance # tail -5 /etc/hosts
192.168.74.151 MC-PMS-DB 192.168.80.155 Netbackup-master 192.168.80.152 oem 192.168.80.162 MC-POSHIS-DB
Client/Media Server
Master&Media
Netbackup-master: ~# cat /usr/openv/netbackup/bp.conf
- Source Client (MC-PMS-DB)
[oracle@MC-PMS-DB ~]$ cat /usr/openv/netbackup/bp.conf SERVER = Netbackup-master CLIENT_NAME = MC-PMS-DB CONNECT_OPTIONS = localhost 1 0 2
- Destination Client (MC-POSHIS-DB)
[root@MC-POSHIS-DB ~]# cat /usr/openv/netbackup/bp.conf SERVER = Netbackup-master CLIENT_NAME = MC-POSHIS-DB CONNECT_OPTIONS = localhost 1 0 2
Excute restore
Create initPMSDB.ora & orapwd file
copy pfile from Source client MC-PMS-DB OR create new one.
HDPMS.__db_cache_size=4160749568 HDPMS.__java_pool_size=16777216 HDPMS.__large_pool_size=33554432 HDPMS.__oracle_base='/oracle/app/oracle'#ORACLE_BASE set from environment HDPMS.__pga_aggregate_target=894498816 HDPMS.__sga_target=3066719232 HDPMS.__shared_io_pool_size=0 HDPMS.__shared_pool_size=805306368 HDPMS.__streams_pool_size=16777216 *.audit_file_dest='/oracle/app/oracle/admin/HDPMS/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/oracle/app/oracle/oradata/HDPMS/control01.ctl','/oracle/app/oracle/oradata/HDPMS/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='HDPMS' *.diagnostic_dest='/oracle/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=HDPMSXDB)' *.log_archive_dest_1='LOCATION=/oradata/HDPMS/archlog' *.open_cursors=300 *.pga_aggregate_target=1684013056 *.processes=1500 *.remote_login_passwordfile='EXCLUSIVE' *.sessions=1655 *.sga_target=5052039168 *.undo_retention=7200 *.undo_tablespace='UNDOTBS1'
- option
[oracle@MC-POSHIS-DB dbs]$ orapwd password=Systec36 file=orapwPMSDB
create directories
mkdir -pv /oracle/app/oracle/admin/HDPMS/adump mkdir -pv /oracle/app/oracle/oradata/HDPMS mkdir -pv /oradata/HDPMS/archlog mkdir -pv /oradata/HDPMS/datafiles/
restore controlfile
- find out correct controlfile in Netbackup
/usr/openv/netbackup/bin/bplist -S Netbackup-master -C MC-PMS-DB -t 4 -l -R / | tee nbu_backupsdate +%F_MC-PMS-DB.txt
$ export ORACLE_SID=HDPMS
$ rman target / catalog rman/rman@orcl
RMAN> startup nomount;
RMAN> set DBID=2147825860
run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
restore controlfile from '/cntrl_HDPMS_set11_piece1_20180913_0btd0ica_1_1';
RELEASE CHANNEL ch00;
}
RMAN> startup mount- Output
~$ rman target / catalog rman/rman@orcl
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Sep 13 15:50:24 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
connected to recovery catalog database
RMAN> startup nomount;
Oracle instance started
Total System Global Area 5044088832 bytes
Fixed Size 2261928 bytes
Variable Size 1442843736 bytes
Database Buffers 3590324224 bytes
Redo Buffers 8658944 bytes
RMAN> set DBID=2147825860
executing command: SET DBID
database name is "HDPMS" and DBID is 2147825860
RMAN> run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
restore controlfile from '/cntrl_HDPMS_set11_piece1_20180913_0btd0ica_1_1';
RELEASE CHANNEL ch00;
}
2> 3> 4> 5> 6>
allocated channel: ch00
channel ch00: SID=1423 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
sent command to channel: ch00
Starting restore at 2018-09-13 15:52:16
channel ch00: restoring control file
channel ch00: restore complete, elapsed time: 00:00:07
output file name=/oracle/app/oracle/oradata/HDPMS/control01.ctl
output file name=/oracle/app/oracle/oradata/HDPMS/control02.ctl
Finished restore at 2018-09-13 15:52:23
released channel: ch00
RMAN>
restore database
- Following is the very important script that one can use to check the recoverability of the DB.
spool log to rman_restore-PMSDB-preview.log
set echo on
show all;
report schema;
list backup summary;
list backup;
list copy;
run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
crosscheck backupset of database;
restore database preview;
restore database validate;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
}
spool log offRMAN>
spool log to rman_restore-PMSDB-v1.log
set echo on
run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
restore database;
restore archivelog all;
recover database;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
}
spool log off- Output
Spooling started in log file: rman_restore-PMSDB-v1.log
Recovery Manager11.2.0.4.0
RMAN> set echo on
echo set on
RMAN> run {
2> ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
3> SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
4> ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
5> SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';
6> restore database;
7> restore archivelog all;
8> RELEASE CHANNEL ch00;
9> RELEASE CHANNEL ch01;
10> }
allocated channel: ch00
channel ch00: SID=1423 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
sent command to channel: ch00
allocated channel: ch01
channel ch01: SID=1707 device type=SBT_TAPE
channel ch01: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
sent command to channel: ch00
sent command to channel: ch01
Starting restore at 2018-09-13 14:45:18
skipping datafile 1; already restored to file /oradata/HDPMS/system01.dbf
skipping datafile 2; already restored to file /oradata/HDPMS/sysaux01.dbf
skipping datafile 3; already restored to file /oradata/HDPMS/undotbs01.dbf
skipping datafile 4; already restored to file /oradata/HDPMS/users01.dbf
channel ch00: starting datafile backup set restore
channel ch00: specifying datafile(s) to restore from backup set
channel ch00: restoring datafile 00006 to /oradata/HDPMS/datafiles/HDPMS02.dbf
channel ch00: reading from backup piece HDPMS_set2_piece1_20180913_02td0i8q_1_1
channel ch01: starting datafile backup set restore
channel ch01: specifying datafile(s) to restore from backup set
channel ch01: restoring datafile 00005 to /oradata/HDPMS/datafiles/HDPMS01.dbf
channel ch01: reading from backup piece HDPMS_set1_piece1_20180913_01td0i8q_1_1
channel ch00: piece handle=HDPMS_set2_piece1_20180913_02td0i8q_1_1 tag=TAG20180913T111849
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:04:25
channel ch01: piece handle=HDPMS_set1_piece1_20180913_01td0i8q_1_1 tag=TAG20180913T111849
channel ch01: restored backup piece 1
channel ch01: restore complete, elapsed time: 00:05:45
Finished restore at 2018-09-13 14:51:04
Starting restore at 2018-09-13 14:51:04
channel ch00: starting archived log restore to default destination
channel ch00: restoring archived log
archived log thread=1 sequence=3
channel ch00: reading from backup piece arch_HDPMS_set9_piece1_20180913_09td0ic2_1_1
channel ch01: starting archived log restore to default destination
channel ch01: restoring archived log
archived log thread=1 sequence=4
channel ch01: reading from backup piece arch_HDPMS_set10_piece1_20180913_0atd0ic2_1_1
channel ch00: piece handle=arch_HDPMS_set9_piece1_20180913_09td0ic2_1_1 tag=TAG20180913T112034
channel ch00: restored backup piece 1
channel ch00: restore complete, elapsed time: 00:00:07
channel ch01: piece handle=arch_HDPMS_set10_piece1_20180913_0atd0ic2_1_1 tag=TAG20180913T112034
channel ch01: restored backup piece 1
channel ch01: restore complete, elapsed time: 00:00:07
Finished restore at 2018-09-13 14:51:12
released channel: ch00
released channel: ch01
RMAN> run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so64';
SEND 'NB_ORA_SERV=Netbackup-master, NB_ORA_CLIENT=MC-PMS-DB';2> 3>
4> recover database;
5> RELEASE CHANNEL ch00;
6> }
allocated channel: ch00
channel ch00: SID=1994 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 7.7.3 (2016051915)
sent command to channel: ch00
Starting recover at 2018-09-13 16:29:39
starting media recovery
archived log for thread 1 with sequence 3 is already on disk as file /oradata/HDPMS/archlog/1_3_984912390.dbf
archived log for thread 1 with sequence 4 is already on disk as file /oradata/HDPMS/archlog/1_4_984912390.dbf
archived log file name=/oradata/HDPMS/archlog/1_3_984912390.dbf thread=1 sequence=3
archived log file name=/oradata/HDPMS/archlog/1_4_984912390.dbf thread=1 sequence=4
unable to find archived log
archived log thread=1 sequence=5
released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/13/2018 16:29:40
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 5 and starting SCN of 1817651$ export ORACLE_SID=HDPMS; sqlplus / as sysdba
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1817651 generated at 09/13/2018 11:20:33 needed for thread 1
ORA-00289: suggestion : /oradata/HDPMS/archlog/1_5_984912390.dbf
ORA-00280: change 1817651 for thread 1 is in sequence #5
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
==> CANCEL
Media recovery cancelled.* Output v2
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1817378 generated at 09/13/2018 11:18:50 needed for thread 1
ORA-00289: suggestion : /oradata/HDPMS/archlog/1_3_984912390.dbf
ORA-00280: change 1817378 for thread 1 is in sequence #3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
CANCEL
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/oradata/HDPMS/system01.dbf'
ORA-01112: media recovery not started
Open database
SQL> alter database open resetlogs; Database altered.
- Output
SQL> alter database open resetlogs; alter database open resetlogs * ERROR at line 1: ORA-01152: file 1 was not restored from a sufficiently old backup ORA-01110: data file 1: '/oradata/HDPMS/system01.dbf'
