MERCADOS FINANCIEROS

martes, 22 de septiembre de 2009

RMAN Maintaining RMAN Backups Repository

Adding User-Made Backups to the Repository

Problem

You’ve made some datafile copies on disk, which you want to add to the RMAN repository.

Solution

You can add any user-managed copies, such as a datafile copy (that you made with an operating
system utility), to the RMAN repository using the catalog command. Here’s a basic
example:

RMAN> catalog datafilecopy '/u01/app/oracl/example1.bkp';

The preceding catalog command catalogs the datafile copy you made of the example01.dbf
datafile as an RMAN-recognized backup. You can, if you want, catalog the datafile copy as an
incremental level 0 backup by issuing the following command:

RMAN> catalog datafilecopy '/u01/app/oracle/example01.bkp' level 0;

RMAN> catalog device type sbt backuppiece 'ilif2lo4_1_1';
released channel: ORA_SBT_TAPE_1
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=38 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: WARNING: Oracle Test Disk API
cataloged backuppiece
backup piece handle=ilif2lo4_1_1 recid=3878 stamp=619796430
RMAN>
You can check that the backup piece has been cataloged successfully by issuing the list
command again, as shown here:

RMAN> list backuppiece 'ilif2lo4_1_1';

If you have to catalog multiple files that you had backed up to a directory, use the catalog
start with command, as shown in the following example:

RMAN> catalog start with '/u01/app/oracle/backup' noprompt;

RMAN> catalog recovery area;

Finding Datafiles and Archivelogs That Need a Backup

RMAN> report need backup;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File bkps Name
---- ------ ---------------------------------------------------
1 0 C:\ORACLE\PRODUCT\11.1.0\ORADATA\NICK\SYSTEM01.DBF
2 0 C:\ORACLE\PRODUCT\11.1.0\ORADATA\NICK\UNDOTBS01.DBF
3 0 C:\ORACLE\PRODUCT\11.1.0\ORADATA\NICK\SYSAUX01.DBF
4 0 C:\ORACLE\PRODUCT\11.1.0\ORADATA\NICK\USERS01.DBF
5 0 C:\ORACLE\PRODUCT\11.1.0\ORADATA\NICK\EXAMPLE01.DBF


This command shows objects that require a backup to conform to a redundancy-based
retention policy:

RMAN> report need backup redundancy n;
This command shows objects that require a backup to conform to a window-based retention
policy:

RMAN> report need backup recovery window of n days
This command shows datafiles that require more than n days worth of archived redo logs
for a recovery:

RMAN> report need backup days=n;
This command shows only the required backups on disk:

RMAN> report need backup device type disk;
This command shows only required backups on tape:

RMAN> report need backup device type sbt;

Finding Datafiles Affected by Unrecoverable Operations

RMAN> report unrecoverable;
Report of files that need backup due to unrecoverable operations
File Type of Backup Required Name
----- --------------- ----------------------------------------
1 full /u01/app/oracle/data/prod1/example01.dbf

Identifying Obsolete Backups

Solution

The report obsolete command reports on any obsolete backups. Always run the crosscheck
command first in order to update the status of the backups in the RMAN repository to that on
disk and tape. In the following example, the report obsolete command shows no

obsolete

backups:

RMAN> crosscheck backup;

RMAN> report obsolete;

When using the report obsolete command, you can also specify the redundancy and
recover window options, as shown here:

RMAN> report obsolete recovery window of 5 days;

RMAN> report obsolete redundancy 2;

RMAN> report obsolete recovery window of 5 days device type disk;

Displaying Information About Database Files

RMAN> report schema;

RMAN> report schema at time 'sysdate-1';

Listing RMAN Backups

RMAN> list backup;

RMAN> list backup by file;

RMAN> list backup summary; # lists backup sets, proxy copies, and image copies

RMAN> list expired backup summary; # lists expired backups in summary form

This command lists only backup sets and proxy copies but not image copies:

RMAN> list backupset;
This command lists only datafile, archived redo log, and control file copies:

RMAN> list copy;
This command lists a particular datafile copy:

RMAN> list datafilecopy '/a01/app/oracle/users01.dbf';
This command lists backups by tag:

RMAN> list backupset tag 'weekly_full_db_backup';
This command lists backups according to when the backup was made:

RMAN> list copy of datafile 1 completed between '01-JAN-2007' AND '15-JAN-2007';
This command lists the backup by the number of times they were backed up to tape:

RMAN> list archivelog all backed up 2 times to device type sbt;
This command lists the backups of all datafiles and archivelogs of the target database:

RMAN> list backup of database;

list incarnation: Lists all incarnations of a database
list restore point: Lists all restore points
list script names:
list failure:

Listing Expired Backups

RMAN> list expired backup;
RMAN> list expired archivelog all;

Listing Only Recoverable Backups and Copies

RMAN> list recoverable backup;

Listing Restore Points

RMAN> list restore point all;

Listing Database Incarnations

RMAN> list incarnation;

Updating the RMAN Repository After Manually Deleting Backups

RMAN> change datafilecopy '/u01/app/oracle/users01.dbf' uncatalog;
Here’s another example showing how to uncatalog a specific backup piece:

RMAN> change backuppiece 'ilif2lo4_1_1' uncatalog;
uncataloged backuppiece
backup piece handle=ilif2lo4_1_1 recid=3876 stamp=619796229
Uncataloged 1 objects

Synchronizing the Repository with the Actual Backups

RMAN> delete backup;

RMAN> crosscheck backup;

RMAN> crosscheck backup;
RMAN> delete expired backup;

RMAN> crosscheck backupset of tablespace users
device type sbt completed before 'sysdate-14';

RMAN> delete expired backupset of tablespace users
device type sbt completed before 'sysdate-14';


# cross-checking just backup sets.

RMAN> crosscheck backupset;
# cross-checking a copy of a database

RMAN> crosscheck copy of database;
# cross-checking specific backupsets;

RMAN> crosscheck backupset 1001, 1002;
# cross-checking using a backup tag

RMAN> crosscheck backuppiece tag = 'weekly_backup';
# cross-checking a control file copy;

RMAN> crosscheck controlfilecopy '/tmp/control01.ctl';
# cross-checking backups completed after a specific time

RMAN> crosscheck backup of datafile "/u01/app/oracle/prod1/system01.dbf" completed
after 'sysdate-14';
# cross-checking of all archivelogs and the spfile;

RMAN> crosscheck backup of archivelog all spfile;
# cross-checking a proxy copy

RMAN> crosscheck proxy 999;
Use the completed after clause to restrict the crosscheck command to check only those
backups that were created after a specific point in time. The following command will check
only for backups of a datafile made in the last week:

RMAN> crosscheck backup of datafile 2
completed after 'sysdate -7';

Deleting Backups

RMAN> delete backup;

RMAN> delete backuppiece 999;
RMAN> delete copy of controlfile like '/u01/%';
RMAN> delete backup tag='old_production';
RMAN> delete backup of tablespace sysaux device type sbt;

RMAN> crosscheck backup;
RMAN> crosscheck copy;
RMAN> delete backup;
RMAN> delete copy;

Deleting Archived Redo Logs

RMAN> delete archivelog all;

The delete archivelog all command deletes all archived redo logs on disk that aren’t
necessary to meet the configured archived redo log deletion policy. It’s more likely that you’d want to use the following delete command, which deletes archived redo logs from disk based on whether they have been first backed up to tape a certain number of times:

RMAN> delete archivelog all
backed up 3 times to sbt;

RMAN> delete archivelog until sequence = 999;

RMAN> backup device type sbt archivelog all delete all input;

RMAN> backup archivelog like '/arch%' delete input;

RMAN> configure archivelog deletion policy to backed up 2 times to device type sbt;


Deleting Obsolete RMAN Backups


RMAN> delete obsolete;

RMAN> delete obsolete redundancy = 2;

The command shown here deletes backups that exceed the redundancy requirement of 2:

RMAN> delete obsolete recovery window of 14 days;

Changing the Status of an RMAN Backup Record

RMAN> change backupset 10 unavailable;

Changing the Status of Archival Backups

RMAN> change backup tag 'consistent_db_bkup'
keep forever;

Since this is a consistent backup, it wonít need any recovery, and as such, you wonít
need any archived redo log backups

RMAN> change backup tag 'consistent_db_backup' nokeep;

RMAN> change backupset 111 keep until time 'sysdate+180';

Testing the Integrity of an RMAN Backup

RMAN> backup validate database archivelog all;
RMAN> backup validate check logical database archivelog all;


Validating Datafiles,Backup Sets,and Data Blocks


You can validate datafiles, backup sets, or even individual data blocks by using the validate command. The following example shows how to validate a single backup set with the validate
command:

RMAN> validate backupset 7;

You can also use the validatecommand to check all datafiles at once, as shown here:
RMAN> validate database;

The validate command always skips all the data blocks that were never used, in each of the datafile it validates. The larger the value of the section sizeclause you set, the faster the validation process completes. You can use the validatecommandwith thefollowing options,
among others:

validate recovery area
validate recovery files
validate spfile
validate tablespace
validate controlfilecopy
validate backupset

No hay comentarios: