20 May, 2013

BACKUP CURRENT CONTROLFILE creates a Snapshot Controlfile

A short post today.

Recently, there was a discussion on forums about when a Snapshot controlfile is created.  It is known that the snapshot controlfile is created to re-synchronise with the Catalog.

But in my test database environment, I don't use a Catalog.  I only use the controlfile (and backups of it).

One poser said that he ran BACKUP DATABASE followed by BACKUP CURRENT CONTROLFILE. He asked if the same snapshot controlfile was used [through the two commands].  I pointed out that since they were two *separate* BACKUP calls, Oracle would create a separate Snapshot Controlfile for the second BACKUP command.

Here is a simple demo (note : I don't use a Catalog)

First the current state of the directory ($ORACLE_HOME/dbs in my case) where the Snapshot Controlfile would be created :

[oracle@localhost dbs]$ pwd
/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs
[oracle@localhost dbs]$ date
Mon May 20 08:17:46 PDT 2013
[oracle@localhost dbs]$ ls -ltr|tail -3
-rw-r----- 1 oracle oracle 1536 Oct  2  2010 orapworcl
-rw-rw---- 1 oracle oracle 1544 May 20 08:16 hc_orcl.dat
-rw-r----- 1 oracle oracle 3584 May 20 08:16 spfileorcl.ora
There is no snapshot currently present.

Next, I run a BACKUP CURRENT CONTROLFILE :

[oracle@localhost dbs]$ rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Mon May 20 08:17:53 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1229390655)

RMAN> backup current controlfile;

Starting backup at 20-MAY-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=69 device type=DISK
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
channel ORA_DISK_1: starting piece 1 at 20-MAY-13
channel ORA_DISK_1: finished piece 1 at 20-MAY-13
piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_20/o1_mf_ncnnf_TAG20130520T081800_8snhob80_.bkp tag=TAG20130520T081800 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-MAY-13

RMAN> quit


Recovery Manager complete.
The controlfile backup got written to the FRA.

 Is there a snapshot controlfile ?

[oracle@localhost dbs]$ ls -ltr|tail -3
-rw-rw---- 1 oracle oracle    1544 May 20 08:16 hc_orcl.dat
-rw-r----- 1 oracle oracle    3584 May 20 08:16 spfileorcl.ora
-rw-rw---- 1 oracle oracle 9748480 May 20 08:18 snapcf_orcl.f
[oracle@localhost dbs]$ 
Yes, a snapshot controlfile did get created !

.
.
.

2 comments:

Mahir M. Quluzade said...

Hi Hemant!

Very nice post, thanks for sharing.

We know Snapshot control file is for Synchronize with Recovery Catalog, and create as you shown when backup control file and we can't restore control file from Snapshot control file. We can restore only from auto backup or consistent backup of database.

Can you explain :
what is current control file? if we are using multiplexed control files, then which is current control file (CONTROL01.CTL,CONTROL02.CTL or CONTROL03.CTL)?
RMAN take which controlfile backup?

Thank you very much!
Mahir M. Quluzade
http://www.mahir-quluzade.com

p.s. I wrote a mail to your gmail address.

Hemant K Chitale said...

Mahir,

CONTROL01.CTL, CONTROL02.CTL and CONTROL03.CTL are mirrors of each other. Logically, it is one control file with 3 physical mirrors. This logical 1 controlfile is the CURRENT CONTROLFILE. Oracle may copy any one of three mirrors.

Hemant