Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Monday, 23 April 2012

RMAN – Cold backup 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:\BACKUP\RMAN_BACKUP\HOTBACKUP\%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:\BACKUP\RMAN_BACKUP\HOTBACKUP\%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:\ORACLE1\DATABASE\SNCFSHAAN.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:\BACKUP\RMAN_BACKUP\HOTBACKUP\C-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;

0 comments:

Post a Comment