Consistent Backup & Restore operation with RMAN

Consistent Backup & Restore operation with RMAN

Consistent Backup at mount state

1. Shutdown the database.

Shutdown immediate;

2. Open the database in mount state.

rman target sys
Recovery Manager: Release 11.2.0.2.0 - Production on Fri Aug 3 14:35:07 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
target database Password:
connected to target database (not started)
RMAN>
RMAN> startup mount
Oracle instance started
database mounted
Total System Global Area 1068937216 bytes
Fixed Size 2260048 bytes
Variable Size 687866800 bytes
Database Buffers 373293056 bytes
Redo Buffers 5517312 bytes

3. Take the backup with RMAN.

run {
allocate channel ch01 type disk;
allocate channel ch02 type disk;
allocate channel ch03 type disk;
backup AS COMPRESSED BACKUPSET format 'E:\Rman\full_db_%t_%sp%p' filesperset 10 database;
release channel ch01;
release channel ch02;
release channel ch03;
allocate channel ch00 type disk;
backup format 'E:\Rman\cntrl_%s_%p_%t' CURRENT CONTROLFILE;
backup format 'E:\Rman\spfile_%s_%p_%t' spfile;
release channel ch00;
}

Note: for testing backup empty or rename the old files in ORADATA folder
Create new folder of database name and old folder rename as old.

Restore from consistent RMAN Backup

1. Start the database in nomount state.

RMAN> startup nomount
Oracle instance started
Total System Global Area 1068937216 bytes
Fixed Size 2260048 bytes
Variable Size 687866800 bytes
Database Buffers 373293056 bytes
Redo Buffers 5517312 bytes

2. Restore the control file.

RMAN> restore controlfile from 'E:\rman\CNTRL_7_1_983198638';
Starting restore at 03-AUG-18
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=D:\ORACLEXE\APP\ORACLE\ORADATA\XE\CONTROL.DBF
Finished restore at 03-AUG-18

3. Make database in mount state.

RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1

4. Restore database in oracle.

RMAN> restore database;
Starting restore at 03-AUG-18
Starting implicit crosscheck backup at 03-AUG-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=5 device type=DISK
Crosschecked 6 objects
Finished implicit crosscheck backup at 03-AUG-18
Starting implicit crosscheck copy at 03-AUG-18
using channel ORA_DISK_1
Finished implicit crosscheck copy at 03-AUG-18
searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: D:\ORACLEXE\APP\ORACLE\FAST_RECOVERY_AREA\XE\AUTOBACKUP\2018_05_14\O1_MF_S_976114136_FHLO
89JP_.BKP
File Name: D:\ORACLEXE\APP\ORACLE\FAST_RECOVERY_AREA\XE\BACKUPSET\2018_05_14\O1_MF_NNNDF_TAG20180514
T144955_FHLO5WXF_.BKP

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 00004 to D:\ORACLEXE\APP\ORACLE\ORADATA\XE\USERS.DBF
channel ORA_DISK_1: reading from backup piece E:\RMAN\FULL_DB_983198320_1P1
channel ORA_DISK_1: piece handle=E:\RMAN\FULL_DB_983198320_1P1 tag=TAG20180803T143839
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:06:45
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 00002 to D:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSAUX.DBF
channel ORA_DISK_1: restoring datafile 00007 to D:\ORACLEXE\APP\ORACLE\ORADATA\XE\SPATAIL01.DBF
channel ORA_DISK_1: reading from backup piece E:\RMAN\FULL_DB_983198575_2P1
channel ORA_DISK_1: piece handle=E:\RMAN\FULL_DB_983198575_2P1 tag=TAG20180803T143839
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
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 00003 to D:\ORACLEXE\APP\ORACLE\ORADATA\XE\UNDOTBS1.DBF
channel ORA_DISK_1: restoring datafile 00006 to D:\ORACLEXE\APP\ORACLE\ORADATA\XE\SPATIAL_01.DBF
channel ORA_DISK_1: reading from backup piece E:\RMAN\FULL_DB_983198602_3P1
channel ORA_DISK_1: piece handle=E:\RMAN\FULL_DB_983198602_3P1 tag=TAG20180803T143839
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:16
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 D:\ORACLEXE\APP\ORACLE\ORADATA\XE\SYSTEM.DBF
channel ORA_DISK_1: restoring datafile 00005 to D:\ORACLEXE\APP\ORACLE\ORADATA\XE\AUDIT_DB.DBF
channel ORA_DISK_1: reading from backup piece E:\RMAN\FULL_DB_983198617_4P1
channel ORA_DISK_1: piece handle=E:\RMAN\FULL_DB_983198617_4P1 tag=TAG20180803T143839
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 03-AUG-18

5. Recover database(you can also skip this because you taken backup at mount state)

RMAN> recover database;

Starting recover at 03-AUG-18
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 220 is already on disk as file D:\ORACLEXE\APP\ORACLE\FAST_R
ECOVERY_AREA\XE\ONLINELOG\O1_MF_2_DX8Z3C51_.LOG
archived log file name=D:\ORACLEXE\APP\ORACLE\FAST_RECOVERY_AREA\XE\ONLINELOG\O1_MF_2_DX8Z3C51_.LOG
thread=1 sequence=220
media recovery complete, elapsed time: 00:00:02
Finished recover at 03-AUG-18

6. Open database with resetlogs.

RMAN> alter database open resetlogs;
database opened

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.