Finance USA

Sep 8 2017

RMAN Backup Control File Tips #file #server #backup, #rman #backup #control #file #tips #


RMAN Backup Control File Tips

RMAN – Backing Up the Control File

As was shown in the first chapter, the control file is of great importance to the Oracle database. If the control file is lost, the database will not run. Therefore, we need to protect control files from any failure and back them up correctly. A backup of the control file can be created using RMAN as follows:

RMAN backup current controlfile;

Using the above command, a new backup set is created and the control file is backed up.

If we want to create a backup of control files each time we do a backup of the database, use the include current control file command. In this example, we backup datafile 4 and the current control file together using one command:

RMAN backup datafile 4 include current controlfile;

When the system01.dbf file is backed up, the control file and the spfile are automatically backed up. This is shown in the following example:

C:\oracle\———- dir
0 File(s) 0 bytes
RMAN backup device type disk datafile 1;
C:\oracle\——— dir

From the above example, it is obvious that even though we did not individually backup the control file and the spfile, by backing up the system01.dbf file, those files have been backed up automatically.

If the autobackup feature in RMAN configuration is enabled, then each time a structural change is made to the database, an automatic backup of the control file is performed. This concept was described in detail in Chapter 1 under the section on autobackup.

To create an image copy of the control file, use the following command:

RMAN backup as copy current controlfile format c:\bkp_controlfile.ctl;

Using this command, c:\bkp_controlfile.ctl is created. This file will be a binary copy of the current control file. This type of file may be used directly without RMAN restoration when all control files are lost. In the scenario below, we create an image copy of the control file and recover the database using this file from loss of all control files:

C:\ rman target \
RMAN backup as copy current controlfile format c:\control.ctl ;
#We take image copy of current control file
. output omitted.
output filename=C:\control.ctl tag=tag20090819t134500 recid=1
RMAN exit
Recovery Manager complete.

C:\ sqlplus / as sysdba
shutdown immediate

C:\ cd c:\oracle\product\10.2.0\oradata\test
#Below, after shutting down the database, we delete all control files
and copy newly created image copy of control file to original
C:\oracle\product\10.2.0\oradata\test del *.ctl
C:\ copy control.ctl c:\oracle\product\10.2.0\oradata\test
1 file(s) copied.
C:\ exit
startup nomount
system set
control_files= c:\oracle\product\10.2.0\oradata\test\control.ctl
System altered.
#Above, in startup nomount mode, we change control_files parameter in
spfile and indicate newly create image copy of control file. Then
shutdown the database and bring it to mount mode.

shutdown immediate
startup mount
database open;
alter database open
Error at line 1:
ORA-01589: must use resetlogs or noresetlogs option for database open
#Now, we do not need to open database in resetlogs mode, or we lose
data in redo log files. So we connect to RMAN and recover the database. RMAN automatically finds proper redo log file and apply all changes to
C:\ rman target /
RMAN recover database;
. output omitted.
archive log thread 1 sequence 2 is already on disk as file
archive log filename=C:\oracle\product\10.2.0\oradata\test\redo01.log
thread=1 sequence=2
media recovery complete, elapsed time: 00:00:01
Finished recover at 19-AUG-09

#Now, we can easily open the database using resetlogs option
RMAN alter database open resetlogs;
database opened

% Note: The resetlogs operation, performed after having applied the online redo log file in recovery, is done because the control file used is a backup control file and the resetlogs operation synchronizes datafile and redo log headers to the control file.

We can make a RMAN backup set from the control file created above. To do that, use the backup controlfilecopy command as shown below:

RMAN backup as copy current controlfile format c:\control.ctl ;
RMAN backup controlfilecopy c:\control.ctl ;
channel ora_disk_1: starting full datafile backupset
input control file copy name=C:\control.ctl

Written by auto car quote free score credit insurance rental usa finance business student

%d bloggers like this: