Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups Configuring RMAN in Oracle: Recovery Manager (RMAN) is an Oracle utility that can back up, restore, and recover database files. The product is a feature of the Oracle database server and does not require separate installation. Recovery Manager is a client/server application that uses database server sessions to perform backup and recovery. It stores metadata about its operations in the control file of the target database and, optionally, in a recovery catalog schema in an Oracle database. You can invoke RMAN as a command-line executable from the operating system prompt or use some RMAN features through the Enterprise Manager GUI. plmdev:orapld> rman target / Recovery Manager: Release 10.2.0.2.0 - Production on Thu Feb 12 10:47:38 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to target database: PLD (DBID=1100434956) RMAN> Isn’t it so simple to invoke RMAN……. RMAN configuration parameters are: RMAN> show all; CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SNCFKEYSTONE.ORA'; # default Standard Production RMAN Configuration Settings CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 5 DAYS; ##Keeps 5 days worth of backups on disk CONFIGURE BACKUP OPTIMIZATION ON; Page 1 of 8 Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups CONFIGURE CONTROLFILE AUTOBACKUP ON; ##Simplifies restores without the use of a catalog database. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/dbbackups/REMDEV10G_backup/rman_backup/REMDEV10G_cf_%F.bkp'; ##Standard format for a AUTOBACKUP Control File CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 4; ##Enable COMPRESSION, Set PARALLISM to 4. Configuring the Default Backup Type for Disk Backups You can configure backup sets or image copies as the default, using either of the following commands: RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY; # image copies RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET; # uncompressed The default for backups to disk, as with tape, is backup set. Configuring Compressed Backupsets as Default for Tape or Disk You can configure RMAN to use compressed backupsets by default on a particular device type, by using the CONFIGURE DEVICE TYPE command with the BACKUP TYPE TO COMPRESSED BACKUPSET option, as shown in the following examples. The following commands let you set the default backup type to compressed backup sets for different device types: RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET; RMAN> CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO COMPRESSED BACKUPSET; Restoring Default RMAN Configuration Settings: CONFIGURE... CLEAR You can return any setting you change with the CONFIGURE command to its default value by running the CONFIGURE command with the CLEAR option, as in: CONFIGURE BACKUP OPTIMIZATION CLEAR; ONFIGURE RETENTION POLICY CLEAR; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR; More details on the internet Page 2 of 8 Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups Block change tracking: Oracle 10g can be configured to track changed blocks for faster incremental backup with the help of block change tracking file. When tracking file is used with RMAN incremental backup database doesn’t have to read each data file to determine the changed block, instead it can directly fetch only changed block by referring to block address from the block change tracking file. The minimum size of tracking file is 10MB, but actual size will be approximately 1/30,000 the size of the data blocks to be tracked. Oracle does not enable block tracking by default; you can enable it with following command options. To store tracking file in Oracle managed file system, set DB_ CREATE_FILE_DEST before issuing following SQL statement in SQL*Plus prompt. SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING; You can also choose the tracking file location, using following SQL statement. SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/u03/oradata/TEMPDB/bct.dbf'; Oracle provides V$BLOCK_CHANGE_TRACKING view to query the information about tracking file. Example: SQL> col FILENAME format a50 SQL> set linesize 80 SQL> select * from V$BLOCK_CHANGE_TRACKING; STATUS FILENAME BYTES ---------- -------------------------------------------------- ------------------------------ENABLED /u03/oradata/TEMPDB/bct.dbf 11599872 If you need to relocate the tracking file, you have following two options. Option1: 1. Shutdown the database. 2. Move tracking file to new location using operating system command. 3. Bring up the database, at mount state issue following SQL statement. ALTER DATABASE RENAME FILE '/u03/oradata/TEMPDB/bct.dbf ' TO '/bct.dbf’; Page 3 of 8 Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups Option2: 1. Disable block change tracking on your database. ALTER DATABASE DISABLE BLOCK CHANGE TRACKING; 2. Re-enable block tracking feature at new location. SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/bct.dbf' REUSE; NOTE: In Option2 you will loose the block change tracking information stored on tracking file, any immediate RMAN incremental backup will force entire data file scan until you perform level 0 backup. Page 4 of 8 Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups Incremental Merge backup: Oracle 10g RMAN can incrementally update backup to full database backup. By doing this DBA’s doesn’t have to maintain incremental backup set separately for recoverability. With Incremental merge backup full database backup is regularly rolled-forward by merging latest incremental backup into full database backup, Thus it reduces recovery time. The implementation of incremental merge is simple and straightforward; it can be better explained with RMAN command as below shown. RMAN> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG "INCR_MERGE" DATABASE; RECOVER COPY OF DATABASE WITH TAG "INCR_MERGE" ; Here RMAN create Level - 1 backup with the with the tag "INCR_MERGE. If there is no image copy found on the disk with same tag name then it will actually creates image copy of datafiles. The second command "RECOVER COPY OF DATABASE WITH TAG "INCR_MERGE;" will actually merge incremental backup to data file copies on the disk with the same tag. Page 5 of 8 Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups RMAN Maintenance: RMAN 'Format_String' clause The formatting of this information varies by platform. Syntax: %c The copy number of the backup piece within a set of duplexed backup pieces. If you did not duplex a backup, then this variable is 1 for backup sets and 0 for proxy copies. If one of these commands is enabled, then the variable shows the copy number. The maximum value for %c is 256. %d The name of the database. %D The current day of the month (in format DD) %F Combination of DBID, day, month, year, and sequence into a unique and repeatable generated name. %M The month (format MM) %n The name of the database, padded on the right with x characters to a total length of eight characters. (AKA: Porn star alias name) For example, if the scott is the database name, %n= scottxxx. %p The piece number within the backup set. This value starts at 1 for each backup set and is incremented by 1 as each backup piece is created. Note: If you specify PROXY, then the %p variable must be included in the FORMAT string either explicitly or implicitly within %U. %s The backup set number. This number is a counter in the control file that is incremented for each backup set. The counter value starts at 1 and is unique for the lifetime of the control file. If you restore a backup control file, then duplicate values can result. Also, CREATE CONTROLFILE initializes the counter back to 1. %t The backup set time stamp, which is a 4-byte value derived as the number of seconds elapsed since a fixed reference time. The combination of %s and %t can be used to form a unique name for the backup set. %T The year, month, and day (YYYYMMDD) %u An 8-charac ter name constituted by compressed representations of the backup set number and the time the backup set was created. Page 6 of 8 Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups %U A convenient shorthand for %u_%p_%c that guarantees uniqueness in generated backup filenames. If you do not specify a format, RMAN uses %U by default. %Y The year (YYYY) %% Specifies the '%' character. e.g. %%Y translates to %Y. RMAN> list backup; #List all your backup sets. RMAN>LIST BACKUPSET; #Lists only backup sets and proxy copies. RMAN>LIST COPY; #Lists of Image copies and Archive Logs. RMAN>LIST EXPIRED BACKUP; #Backups did not found after crosscheck. That is backup is manually moved or deleted from OS. RMAN>LIST BACKUP BY FILE; #List backup by Datafile, controlfile, spfile. RMAN>LIST BACKUP SUMMARY; #Lists backup sets, proxy copies, and disk copies. LIST BACKUP OF DATABASE; LIST ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE DISK; REPORT NEED BACKUP; # Determine which database files need backup under a specific retention policy. REPORT UNRECOVERABLE; #Report which database files require backup because they have been affected by some NOLOGGING operation. REPORT SCHEMA; #Lists and displays information about the database files. REPORT OBSOLETE; #REPORT OBSOLETE displays the backups that are obsolete according to the current retention policy. Deletion of Obsolete Backups and Copies The DELETE OBSOLETE command provides a convenient way to physically delete backups and copies that are no longer needed, as well as remove their catalog records. It uses the same REDUNDANCY, RECOVERY WINDOW, and ORPHAN options as the REPORT OBSOLETE command. If you have configured a retention policy, then you can run DELETE OBSOLETE periodically to delete all backups and copies considered obsolete by this policy. For example, you can run DELETE OBSOLETE as a script every night using a scheduling utility. In this way, you keep your disk drives uncluttered by removing all unnecessary files. Deletion of Expired Backups Page 7 of 8 Implementing RMAN, Block Change Tracking and Incremental Merge RMAN backups The CROSSCHECK command marks a backup or copy as expired when it cannot locate it at the location to which it was backed up. In short, expired means "not found." You can view the expired backups and copies by running the CROSSCHECK command as in the following example: RMAN> CROSSCHECK BACKUP; crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=0ad8d32i_1_1 recid=10 stamp=445025363 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=c-1334876723-20011105-00 recid=11 stamp=445025367 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=0cd8d361_1_1 recid=12 stamp=445025473 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=c-1334876723-20011105-01 recid=13 stamp=445025475 Crosschecked 4 objects The DELETE EXPIRED command removes the recovery catalog records for expired backups and copies, and updates their control file records to status DELETED. This command is especially useful if you inadvertently delete RMAN backups or archived logs from disk using an operating system utility. If you do this, then the RMAN repository is not synchronized with the physical reality of what is on disk. By running the CROSSCHECK command, RMAN marks the backups and copies that it cannot find as expired. Then, you can run DELETE EXPIRED to remove the records for these files. Page 8 of 8