Oracle Backup and Restore
Case Scenarios - Case Study 1
Case 1: Simple backup and
restore operation using RMAN
Steps followed:
1. Connect to the target database.
2. Backup the database
3. Shutdown
4. Simulate failure by renaming a datafile
5. Connect to the target database
6. Try to startup (which will fail aftere mount stage)
7. Restore the database.
8. Recover the database.
9. Open the database.
1. Connect to the
target database.
[oracle@localhost
archive]$ rman target /
Recovery
Manager: Release 11.2.0.4.0 - Production on Thu Sep 21 20:26:34 2017
Copyright
(c) 1982, 2011, Oracle and/or its affiliates.
All rights reserved.
connected
to target database: ORADB1 (DBID=2294695355)
2. Backup the
database
RMAN>
backup database;
Starting
backup at 21-SEP-2017 20:26:51
using
target database control file instead of recovery catalog
allocated
channel: ORA_DISK_1
channel
ORA_DISK_1: SID=1 device type=DISK
channel
ORA_DISK_1: starting full datafile backup set
channel
ORA_DISK_1: specifying datafile(s) in backup set
input
datafile file number=00001 name=/u01/app/oracle/oradata/ORADB1/system01.dbf
input
datafile file number=00002 name=/u01/app/oracle/oradata/ORADB1/sysaux01.dbf
input
datafile file number=00005 name=/u01/app/oracle/oradata/ORADB1/example01.dbf
input
datafile file number=00003 name=/u01/app/oracle/oradata/ORADB1/undotbs01.dbf
input
datafile file number=00004 name=/u01/app/oracle/oradata/ORADB1/users01.dbf
channel
ORA_DISK_1: starting piece 1 at 21-SEP-2017 20:26:52
channel
ORA_DISK_1: finished piece 1 at 21-SEP-2017 20:27:38
piece
handle=/u01/app/oracle/fast_recovery_area/ORADB1/backupset/2017_09_21/o1_mf_nnndf_TAG20170921T202652_dw7nsnwt_.bkp
tag=TAG20170921T202652 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:46
channel
ORA_DISK_1: starting full datafile backup set
channel
ORA_DISK_1: specifying datafile(s) in backup set
including
current control file in backup set
including
current SPFILE in backup set
channel
ORA_DISK_1: starting piece 1 at 21-SEP-2017 20:27:39
channel
ORA_DISK_1: finished piece 1 at 21-SEP-2017 20:27:40
piece
handle=/u01/app/oracle/fast_recovery_area/ORADB1/backupset/2017_09_21/o1_mf_ncsnf_TAG20170921T202652_dw7nv3qo_.bkp
tag=TAG20170921T202652 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished
backup at 21-SEP-2017 20:27:40
RMAN>
Check the backup.
RMAN>
list backup;
List
of Backup Sets
===================
BS
Key Type LV Size Device Type Elapsed Time Completion
Time
-------
---- -- ---------- ----------- ------------ --------------------
1 Full
1.12G DISK 00:00:36 21-SEP-2017 20:27:28
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20170921T202652
Piece Name: /u01/app/oracle/fast_recovery_area/ORADB1/backupset/2017_09_21/o1_mf_nnndf_TAG20170921T202652_dw7nsnwt_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------------------
----
1
Full 1171090 21-SEP-2017
20:26:52 /u01/app/oracle/oradata/ORADB1/system01.dbf
2
Full 1171090 21-SEP-2017
20:26:52 /u01/app/oracle/oradata/ORADB1/sysaux01.dbf
3
Full 1171090 21-SEP-2017
20:26:52 /u01/app/oracle/oradata/ORADB1/undotbs01.dbf
4 Full 1171090 21-SEP-2017 20:26:52
/u01/app/oracle/oradata/ORADB1/users01.dbf
5
Full 1171090 21-SEP-2017
20:26:52 /u01/app/oracle/oradata/ORADB1/example01.dbf
BS
Key Type LV Size Device Type Elapsed Time Completion
Time
-------
---- -- ---------- ----------- ------------ --------------------
2 Full
9.36M DISK 00:00:01 21-SEP-2017 20:27:39
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20170921T202652
Piece Name: /u01/app/oracle/fast_recovery_area/ORADB1/backupset/2017_09_21/o1_mf_ncsnf_TAG20170921T202652_dw7nv3qo_.bkp
SPFILE Included: Modification time:
21-SEP-2017 20:17:34
SPFILE db_unique_name: ORADB1
Control File Included: Ckp SCN: 1171111 Ckp time: 21-SEP-2017 20:27:38
RMAN>
Shut the database
down.
RMAN>
shutdown immediate;
database
closed
database
dismounted
Oracle
instance shut down
RMAN>
exit
Recovery
Manager complete.
4. Simulate
failure by renaming a datafile
[oracle@localhost
ORADB1]$ mv /u01/app/oracle/oradata/ORADB1/users01.dbf
/u01/app/oracle/oradata/ORADB1/users.bkup
5. Connect to
target database.
[oracle@localhost
ORADB1]$ rman target /
Recovery
Manager: Release 11.2.0.4.0 - Production on Thu Sep 21 20:31:03 2017
Copyright
(c) 1982, 2011, Oracle and/or its affiliates.
All rights reserved.
connected
to target database (not started)
6. Try to startup
(which will fail aftere mount stage)
RMAN>
startup
Oracle
instance started
database
mounted
RMAN-00571:
===========================================================
RMAN-00569:
=============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571:
===========================================================
RMAN-03002:
failure of startup command at 09/21/2017 20:31:19
ORA-01157:
cannot identify/lock data file 4 - see DBWR trace file
ORA-01110:
data file 4: '/u01/app/oracle/oradata/ORADB1/users01.dbf'
Startup mount will
fail as database is already mounted.
RMAN>
startup mount;
database
is already started
Restore database.
RMAN>
restore database;
Starting
restore at 21-SEP-2017 20:33:31
allocated
channel: ORA_DISK_1
channel
ORA_DISK_1: SID=19 device type=DISK
channel
ORA_DISK_1: starting datafile backup set restore
channel
ORA_DISK_1: specifying datafile(s) to restore from backup set
channel
ORA_DISK_1: restoring datafile 00001 to
/u01/app/oracle/oradata/ORADB1/system01.dbf
channel
ORA_DISK_1: restoring datafile 00002 to
/u01/app/oracle/oradata/ORADB1/sysaux01.dbf
channel
ORA_DISK_1: restoring datafile 00003 to
/u01/app/oracle/oradata/ORADB1/undotbs01.dbf
channel
ORA_DISK_1: restoring datafile 00004 to
/u01/app/oracle/oradata/ORADB1/users01.dbf
channel
ORA_DISK_1: restoring datafile 00005 to
/u01/app/oracle/oradata/ORADB1/example01.dbf
channel
ORA_DISK_1: reading from backup piece
/u01/app/oracle/fast_recovery_area/ORADB1/backupset/2017_09_21/o1_mf_nnndf_TAG20170921T202652_dw7nsnwt_.bkp
channel
ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORADB1/backupset/2017_09_21/o1_mf_nnndf_TAG20170921T202652_dw7nsnwt_.bkp
tag=TAG20170921T202652
channel
ORA_DISK_1: restored backup piece 1
channel
ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished
restore at 21-SEP-2017 20:34:17
Recover database.
RMAN>
recover database;
Starting
recover at 21-SEP-2017 20:35:09
using
channel ORA_DISK_1
starting
media recovery
media
recovery complete, elapsed time: 00:00:01
Finished
recover at 21-SEP-2017 20:35:10
Open the database.
RMAN>
alter database open;
database
opened
RMAN>
No comments:
Post a Comment
Leave a Reply...