RMAN – Cold Backup and Restore

A consistent backup, often called cold backup or offline backup, means that all read/write data files and control files have the same System Change Number (SCN). For achieving this, backup should be done while database is not opened (mounted status), and previously shutdown either by immediate, transaction or normal modes.

Cold backups are the easiest and reliable method to achieve a successful restore and it depends on database unavailability during backup.

This method is recommended on the following scenarios:

Just before major changes on the system like upgrades, data migration and applying patches or non productive databases, typically development resources, where you can afford loosing data until the last backup.

Permanent configuration

C:>rman target sys/oracle@shaan

Recovery Manager: Release 9.2.0.1.0 – Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database: SHAAN (DBID=4130713932)

RMAN> show all;

using target database controlfile instead of recovery catalog

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 50 DAYS;

CONFIGURE BACKUP OPTIMIZATION ON;

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘D:BACKUPRMAN_BACKUPHOTBACKUP%F’;

CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   ‘D:BACKUPRMAN_BACKUPHOTBACKUP%U’;

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘C:ORACLE1DATABASESNCFSHAAN.ORA’; # de

fault

RMAN>

Backup

RMAN> connect target /

Shutdown the target database.

RMAN> shutdown immediate

Startup mount the database

RMAN> startup mount

RMAN> Backup database tag= full_052012;

RMAN> sql ‘alter database open’;

Restore

RMAN> connect target /

Shutdown the database

RMAN> shutdown immediate

Set the DBID number, available on the backup log.

RMAN> SET DBID 4130713932

Startup the database in force nomount mode (it will use a dummy init file):

RMAN> STARTUP FORCE NOMOUNT

Restore the spfile. The example below will query for a backup within 30 days:

RMAN> RESTORE SPFILE FROM AUTOBACKUP MAXSEQ 200 MAXDAYS 30;

Restore the control file.

RMAN> restore controlfile from ‘D:BACKUPRMAN_BACKUPHOTBACKUPC-4130713932-20120423-00’;

Mount the database using restored control file and spfile:

RMAN> ALTER DATABASE MOUNT;

Restore the database:

RMAN> RESTORE DATABASE;

Recover the database:

RMAN> RECOVER DATABASE;

And if no errors occurred:

RMAN> ALTER DATABASE OPEN RESETLOGS;

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