RMAN needs
to get a consistent view of the control file when it sets out to make backup of
every datafile. It only needs to know the most recent checkpoint information
and file schematic information at the time backup begins. After the backup
starts, RMAN needs this information to stay consistent for duration of the
backup operation; in other words, it needs a read consistent view of the
control file. With the constant updates from the database, this is nearly impossible
- unless RMAN were to lock the control file for the duration of the backup. But
that would mean the database could not advance checkpoint or switch logs or
produce new archive logs. Impossible.
To get around this, RMAN uses the snapshot control file, an exact copy of your control file that is only used by RMAN during backup and resync operations. At the beginning of these operations, RMAN refreshes the snapshot control file from the actual control file, thus putting a momentary lock on the control file. Then, RMAN switches to the snapshot and uses it for the duration of the backup; in this way, it has read consistency without holding up database activity.
To get around this, RMAN uses the snapshot control file, an exact copy of your control file that is only used by RMAN during backup and resync operations. At the beginning of these operations, RMAN refreshes the snapshot control file from the actual control file, thus putting a momentary lock on the control file. Then, RMAN switches to the snapshot and uses it for the duration of the backup; in this way, it has read consistency without holding up database activity.
ie , When
RMAN needs to resynchronize from a read-consistent version of the control file,
it creates a temporary snapshot control file. RMAN needs a snapshot control
file only when resynchronizing with the recovery catalog or when making a
backup of the current control file.
The default
value for the snapshot control file is platform-specific and depends on the
Oracle home. For example, the default filename on some UNIX platforms in Oracle
Database 10g is $ORACLE_HOME/dbs/snapcf_@.f. Note that if you have a flash
recovery area configured, the default location for the snapshot control file
isnot the flash recovery area.
You can see
the current snapshot location by running the SHOW command. This example shows a
snapshot location that is determined by the default rule:
RMAN>
SHOW SNAPSHOT CONTROLFILE NAME;
CONFIGURE
SNAPSHOT CONTROLFILE NAME TO '/oracle/dbs/snapcf_trgt.f'; # default
This
example shows a snapshot control file that has a nondefault filename:
RMAN>
SHOW SNAPSHOT CONTROLFILE NAME;
CONFIGURE
SNAPSHOT CONTROLFILE NAME TO '/oracle/oradata/trgt/snap_trgt.ctl';
Use the
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'filename' command to change the name of
the snapshot control file. Subsequent snapshot control files that RMAN creates
use the specified filename.
For
example, start RMAN and then enter:
RMAN>CONFIGURE
SNAPSHOT CONTROLFILE NAME TO '/oracle/oradata/trgt/snap_trgt.ctl';
If one RMAN
job is already backing up the control file while another needs to create a new
snapshot control file, you may see the following message:
waiting
for snapshot control file enqueue
Under
normal circumstances, a job that must wait for the control file enqueue waits
for a brief interval and then successfully retrieves the enqueue. Recovery
Manager makes up to five attempts to get the enqueue and then fails the job.
The conflict is usually caused when two jobs are both backing up the control
file, and the job that first starts backing up the control file waits for
service from the media manager.
Identical
copies of the control file must be maintained on every node that participates
in the RAC backup process. Therefore, each node must have an identical
directory location to store a snapshot of the current control file ,So it is
necessary in RAC environments that the snapshot controlfile is located on
shared storage. Otherwise your RMAN backup may fail.For this reason you can put
the snapshot controlfile into ASM .
For
example
RMAN>
configure snapshot controlfile name to '+FRA/snapcf_oralin.f';
When
it will get generated?
Basically the
snapshot controlfile is created when oracle needs a "read-consistent
version" of the controlfile.In my case I have a catalog database which is
synchronized at the beginning of the backup so the snapshot controlfile is
created at the beginning of the backup.If you backup with rman without a
catalog it will be at the end of the backup.
Is the snapshot control file ever needed during
recovery?
Short and
right answer is "no".
Read the
definition of the (RMAN) "Snapshot Control File" below.
Generally I
would consider the (RMAN) "Snapshot Control File" worthless as it
knows *nothing* about the backup (sets) currently being completed/made
Meaning the
last backup metadata is not *in* the "Snapshot Control File", as it
was "snapped" before the back started/completed.
*HOWEVER*
it is a copy of the controlfie at the beginning of your current backup and
while it knows nothing about the current backup, it "still" has
knowledge/metadata about all previous RMAN backups (not deleted, marked missing
or obsolete by RMAN).
I can
invision a scenario where I lost *ALL* controlfiles on disk and on tape *AND* I
do not use a RMAN Recovery Catalog. I would try and use the last known
available RMAN "Snapshot Control File" to restore my database from an
*older* (than the Snapshot Control File) backup and recovery my database.
Hi Mahesh,
ReplyDeleteThis means snapshot control use is only maintain read consistency of controlfile during RMAN backup ?
Yes
Deletethank your very much!, pretty simple
ReplyDeleteNice article!!!
ReplyDelete