PeopleSoft

RMAN Info

October 31, 2008 · Leave a Comment

RMAN General Info Oracle

RMAN’s %s format represents the backup set number and is essentially a counter in the controlfile that is incremented for each backupset. The counter starts at 1 and is unique for the lifetime of the control file. If you restore a backup control file, then it is possible duplicate values could result. You can initialize the counter back to 1 by issuing a CREATE CONTROLFILE command.

The %s doesn’t represent the same number that is in the BS_KEY column in the RC_BACKUP_SET RMAN Catalog view.

There are two different numbers tracked for the backup sets, BS_KEY which is a unique value within the catalog and the RECID which is unique to the controlfile.

example:

connect / as sysdba
select max(recid) from v$backup_set;

execute an RMAN backup:

configure channel type disk format ‘….’;

select max(set_count) from v$backup_set;

in the catalog: connect rman/rman@rman.db.name.com

select max(bs_key) from rc_backup_set;

The RESTORE command supports a PREVIEW option, which identifies the backups (backup sets or image copies, on disk or sequential media like tapes) required to carry out a given restore operation.

You can use RESTORE.. PREVIEW to ensure that all of the required backups are available or to identify situations where you may want to instruct RMAN to use or avoid a specific backup.

RESTORE… PREVIEW can show you that RMAN will request a tape during the restore process which you know is not located onsite. You can then execute the command CHANGE… UNAVAILABLE to set the backup status to UNAVAILABLE. If you then execute the RESTORE… PREVIEW command again, RMAN will not include that media you just marked as UNAVAILABLE and will show only the media it will use to perform the restore operation.

RESTORE… PREVIEW can be applied to any RESTORE operation to create a detailed report of every backup that will be requested during the RESTORE operation:

RESTORE DATABASE PREVIEW;
RESTORE TABLESPACE users PREVIEW;
RESTORE DATAFILE n PREVIEW;
RESTORE ARCHIVELOG FROM LOGSEQ xxxx PREVIEW;
RESTORE ARCHIVELOG FROM TIME ‘SYSDATE-6′ PREVIEW;
RESTORE ARCHIVELOG FROM SCN xxxxxx PREVIEW;
RESTORE… PREVIEW output is in the same exact format as the output of the LIST command.

If the detailed report produced by RESTORE… PREVIEW provides more information than you need, you can add the SUMMARY option to the command which will suppress much of the detail about specific files that will be used and affected by the restore process.

RESTORE DATABASE PREVIEW SUMMARY;
RESTORE TABLESPACE users PREVIEW SUMMARY;
RESTORE DATAFILE x PREVIEW SUMMARY;
RESTORE ARCHIVELOG FROM LOGSEQ xxx PREVIEW SUMMARY;
RESTORE ARCHIVELOG FROM TIME ‘SYSDATE-6′ PREVIEW SUMMARY;
RESTORE ARCHIVELOG FROM SCN xxxxxx PREVIEW SUMMARY;
RESTORE… PREVIEW SUMMARY reports are in the same format as output from the LIST SUMMARY command.

To backup the controlfile using RMAN:
run {
allocate channel d1 type disk format ‘c:\backup\%U’; (windows format)
allocate channel d1 type disk format ‘/opt/app/oracle/admin/backup/snapcf_ev.f’; (unix format)_
backup current controlfile;
}

To check the backup of controlfile using RMAN:
list backup of controlfile;

To recover using backup controlfile: (startup nomount)
run {
allocate channel d1 type disk;
restore controlfile;
alter database mount;
restore database;
recover database;
sql ‘alter database open resetlogs’;
}

To backup all datafiles and controlfile using RMAN:
run {
allocate channel d1 type disk;
backup full tag=’full_bkup” database include current controlfile format=’/opt/app/oracle/admin/backup/df_t%t_s%s_p%p’;
release channel d1;
}

To check all backups of datafiles using RMAN:
list backupset;

To restore because of missing / corrupt file(s) (first mount the database and then execute RMAN):
run {
allocate channel d1 type disk;
restore database;
recover database;
}

Restore until time: The ‘SET UNTIL TIME’ must match with the variable NLS_DATE_FORMAT, prior to logging onto RMAN set the NLS_DATE_FORMAT with the desired format.

ex: Unix – export NLS_DATE_FORMAT=’YYYY-MM-DD:HH24:MI:SS’;
Windows – set NLS_DATE_FORMAT in the registry or Control Panel->System->Environment Variables:
run {
set until time ‘October 1 2008 12:00:00′;
allocate channel d1 type disk;
shutdown abort;
startup nomount;
restore controlfile;
alter database mount;
restore database;
recover database;
sql ‘alter database open resetlogs’;
}

Purge Obsolete Backups:
rman> report obsolete redundancy 3 device type disk;

Use the report id returned to fill in the xxx below;
rman> report obsolete orphan;

rman> allocate channel for maintenance type disk;
allocate channel for delete type disk;
change backuppiece ‘/opt/app/oracle/admin/backup/xxxx’ delete;
release channel;

To Backup All Archive Logs:
run {
allocate channel d1 type disk format ‘/opt/app/oracle/admin/backup/al_t%t_s%s_p%p’;
backup archivelog all delete input;_
}

To Remove All Archive Log Files After Backup Up
backup archivelog all delete input;

Skip an Archive Log File that can’t be read or manually deleted
backup archivelog skip inaccessible;

To Remove One Archive Log That you Manually Deleted and Now Get an RMAN-6089 (prior to 8.0):
allocate channel for delete type disk; or ‘SBT_TAPE’;
change archivelog ‘/opt/app/oracle/admin/backup/filename’ delete;
and/or
resync catalog;

To Remove One Archive Log That you Manually Deleted and Now Get an RMAN-6089 (prior to 8.1):
allocate channel for maintenance type …
change archivelog uncatalog

Categories: DBA · Oracle · RMAN

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment