04 July 2011

Backup ASM database using RMAN

Backup ASM database using RMAN:



I have used FRA for storing all the backups. You may use the regular method to store the backup using log_archive_dest



SQL> sho parameter db_recovery_file_dest



NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_recovery_file_dest string +DATA

db_recovery_file_dest_size big integer 3852M



Change the FRA destination to some other diskgroup.

Create a new Disk Group.



I have already created ASM Disks: ARCH01 and ARCH02 using OracleASM as shown above.

[root@eprax01 ~]# /etc/init.d/oracleasm listdisks

ARCH01

ARCH02

DATA01

DATA02



Identify the PATH from v$asm_disk



SQL> select NAME, LABEL, PATH from v$asm_disk where LABEL like ‘%ARC%’;



NAME LABEL PATH

------------------------------ ------------------------------- ----------------------------------------------------------------------------

ARCH01 ORCL:ARCH01

ARCH02 ORCL:ARCH02


Create a new Diskgroup for FRA:



SQL> CREATE DISKGROUP ARCH EXTERNAL REDUNDANCY DISK 'ORCL:ARCH01', 'ORCL:ARCH02';



Diskgroup created.



SQL> select NAME, STATE from v$asm_diskgroup;

NAME STATE

------------------------------ -----------

DATA MOUNTED

ARCH MOUNTED



Change the FRA location:

SQL> alter system set db_recovery_file_dest='+ARCH';

System altered.



Setup RMAN for backing up database:

1. Configure RMAN for Retention policy

Window based:

Specifying a recovery window by using the CONFIGURE RETENTION POLICY TO RECOVERY WINDOW command: A recovery window is a period of time that begins with the current time and extends backward in time to the point of recoverability. The point of recoverability is the earliest time for a hypothetical point-in-time recovery (the earliest point to which a database can be recovered following a media failure).



For example, when a recovery window of five days is implemented, the window of time must extend back exactly five days from the present, so that a backup can be restored and recovered to this point. This retention policy can be implemented by executing the following RMAN command:



CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 5 DAYS;



Redundancy based:

The REDUNDANCY parameter specifies that any number of backups or copies beyond a specified number does not need to be retained. For example, the CONFIGURE RETENTION POLICY TO REDUNDANCY 3; command specifies that a maximum of three backups or copies of a data file or control file can be retained. Redundancy is the default type of retention policy.



By default, the retention policy is configured to REDUNDANCY = 1 to maintain compatibility with the behavior of the REPORT OBSOLETE command in earlier RMAN releases. The CONFIGURE RETENTION POLICY CLEAR; command can be executed to return the retention policy to the default value of one.



2. Configure RMAN for autobackup



RMAN can automatically back up the control file and server parameter file (SPFILE) in situations in which the RMAN repository data for your database has been updated in a way that affects RMAN's ability to restore your database.



With a control file autobackup, RMAN can recover the database even if the current control file, recovery catalog, and server parameter file are inaccessible. Because the path used to store the autobackup follows a well-known format, RMAN can search for and restore the server parameter file from that autobackup.

The first channel allocated during the backup job creates the autobackup and places it into its own backup set; for autobackups after database structural changes, the default disk channel makes the backup. If a server parameter file is used, it is backed up in the same backup set as the control file during a control file autobackup.



After the control file autobackup completes, the database writes a message containing the complete path of the backup piece and the device type to the alert log.



The RMAN behavior when the BACKUP command includes datafile 1 depends on the CONFIGURE CONTROLFILE AUTOBACKUP setting. If control file autobackups are ON and the backup includes datafile 1, RMAN writes the control file and SPFILE to a separate autobackup backup set. If control file autobackups are OFF and the backup includes datafile 1, then RMAN includes the current control file and SPFILE in the same backup set as the datafiles.



RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;



new RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters are successfully stored



CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+ARCH';



3. Configure RMAN for backup optimization.

Optimization makes sure that it skips already backed up copies/backup sets

RMAN> CONFIGURE BACKUP OPTIMIZATION ON;



new RMAN configuration parameters:

CONFIGURE BACKUP OPTIMIZATION ON;

new RMAN configuration parameters are successfully stored





Backup database online:

RMAN> backup database plus archivelog;





Starting backup at 04-JUL-11

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=44 device type=DISK

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=9 RECID=1 STAMP=755195883

input archived log thread=1 sequence=10 RECID=2 STAMP=755627785

input archived log thread=1 sequence=11 RECID=3 STAMP=755636559

input archived log thread=1 sequence=12 RECID=4 STAMP=755645793

channel ORA_DISK_1: starting piece 1 at 04-JUL-11

channel ORA_DISK_1: finished piece 1 at 04-JUL-11

piece handle=+ARCH/prd/backupset/2011_07_04/annnf0_tag20110704t213635_0.257.755645797 tag=TAG20110704T213635 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07

Finished backup at 04-JUL-11



Starting backup at 04-JUL-11

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=+DATA/prd/datafile/system.256.755015605

input datafile file number=00002 name=+DATA/prd/datafile/sysaux.257.755015611

input datafile file number=00005 name=+DATA/prd/datafile/example.269.755015953

input datafile file number=00003 name=+DATA/prd/datafile/undotbs1.258.755015615

input datafile file number=00004 name=+DATA/prd/datafile/users.259.755015615

channel ORA_DISK_1: starting piece 1 at 04-JUL-11

channel ORA_DISK_1: starting piece 1 at 04-JUL-11


channel ORA_DISK_1: finished piece 1 at 04-JUL-11

piece handle=+ARCH/prd/backupset/2011_07_04/nnndf0_tag20110704t213644_0.258.755645807 tag=TAG20110704T213644 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56

Finished backup at 04-JUL-11



Starting backup at 04-JUL-11

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=13 RECID=5 STAMP=755645864

channel ORA_DISK_1: starting piece 1 at 04-JUL-11

channel ORA_DISK_1: finished piece 1 at 04-JUL-11

piece handle=+ARCH/prd/backupset/2011_07_04/annnf0_tag20110704t213745_0.260.755645865 tag=TAG20110704T213745 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 04-JUL-11



Starting Control File and SPFILE Autobackup at 04-JUL-11

piece handle=+ARCH/prd/autobackup/2011_07_04/s_755645867.261.755645869 comment=NONE

Finished Control File and SPFILE Autobackup at 04-JUL-11 ---> Spfile and control files are backed up because AUTOBACKUP is on

1 comment: