CONSISTENT BACKUP:
A consistent backup of the database is one taken when the database is in a consistent state, that is, one taken after the database has been shut down normally (using SHUTDOWN NORMAL, SHUTDOWN IMMEDIATE or SHUTDOWN TRANSACTIONAL). At this point, all changes in the redo log have been applied to the datafiles. If you mount the database and take a backup at this point, then you can restore the database from this backup at a later date and open it without performing media recovery.
Consistent Backup & Restore operation with RMAN
Consistent Backup at mount state
- Shutdown the database.
Shutdown immediate;
- Open the database in mount state.
rman target sys Recovery Manager: Release 11.2.0.2.0 - Production on Tue oct 06 14:35:07 2020 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
- 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
- Restore the control file.
RMAN> restore controlfile from 'E:\rman\CNTRL_7_1_983198638'; Starting restore at 06-OCT-20 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 06-OCT-20
- Make database in mount state.
RMAN> alter database mount; database mounted released channel: ORA_DISK_1
- Restore database in oracle.
RMAN> restore database; Starting restore at 06-OCT-20 Starting implicit crosscheck backup at 06-OCT-20 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=5 device type=DISK Crosschecked 6 objects Finished implicit crosscheck backup at 06-OCT-20 Starting implicit crosscheck copy at 06-OCT-20 using channel ORA_DISK_1 Finished implicit crosscheck copy at 06-OCT-20 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\2020_10_06\O1_MF_S_976114136_FHLO 89JP_.BKP File Name: D:\ORACLEXE\APP\ORACLE\FAST_RECOVERY_AREA\XE\BACKUPSET\2020_10_06\O1_MF_NNNDF_TAG20201006 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=TAG20201006T143839 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=TAG20201006T143839 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=TAG20201006T143839 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=TAG20201006T143839 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:25 Finished restore at 06-OCT-20
- Recover database(you can also skip this because you taken backup at mount state)
RMAN>recover database;
Starting recover at 06-OCT-20 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 06-OCT-20