Oracle DBA Queries - Recovery Manager (RMAN)
Oracle DBA Queries - Recovery Manager (RMAN)
php
sqlplus user/pass@rmandb
select * from rc_database;
select db_key, db_id from db;
Clipboard
1 of 4 12/23/2008 10:48 PM
Oracle DBA Queries - Recovery Manager (RMAN) http://www.shutdownabort.com/dbaqueries/Backup_RMAN.php
Clipboard
reset database;
Clipboard
resync catalog;
Clipboard
Delete a backup
allocate channel...
delete backuppiece <number>;
release channel;
Clipboard
Backup a database
Clipboard
run {
allocate channel t1 type disk;
backup current controlfile format '/u01/ora_backup/rman/%d_%u_%s';
backup database format '/u01/ora_backup/rman/%d_%u_%s';
backup archivelog all delete input format '/u01/ora_backup/rman/arch_%d_%u_
release channel t1;
}
Clipboard
run {
allocate channel t1 type disk;
backup archivelog all delete input format '/u01/ora_backup/rman/arch_%d_%u_
release channel t1;
}
Clipboard
Cold backup (archivelog or noarchivelog mode)
run {
allocate channel t1 type disk;
shutdown immediate;
startup mount;
backup database include current controlfile format '/u01/ora_backup/rman/%d
alter database open;
}
Clipboard
run {
2 of 4 12/23/2008 10:48 PM
Oracle DBA Queries - Recovery Manager (RMAN) http://www.shutdownabort.com/dbaqueries/Backup_RMAN.php
Clipboard
Restore/recover a database
Clipboard
Restore and roll forward to a point in time
startup nomount;
run {
set until time ="to_date('30/08/2006 12:00','dd/mm/yyyy hh24:mi')";
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
restore controlfile;
restore archivelog all;
alter database mount;
restore database;
recover database;
}
sql 'alter database open resetlogs';
Clipboard
If the archive logs are already in place:
startup mount;
run {
set until time ="to_date('08/02/2007 14:00','dd/mm/yyyy hh24:mi')";
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
restore database;
recover database;
}
sql 'alter database open resetlogs';
Clipboard
startup mount;
run {
allocate channel t1 type disk;
recover database;
3 of 4 12/23/2008 10:48 PM
Oracle DBA Queries - Recovery Manager (RMAN) http://www.shutdownabort.com/dbaqueries/Backup_RMAN.php
Clipboard
Clipboard
Misc commands
list backupset;
list backup of database;
list backup of archivelog all;
report obsolete;
report obsolete redundancy = 2;
delete obsolete; - remove unneeded backups
restore database validate; - check the backup
report unrecoverable;
report schema; - show current db files
crosscheck backup; - make sure the backups in the catalog still physically
delete expired backup; - delete epired backups found by crosscheck
rman target sys/*****@scr10 catalog rman/rman@dbarep
LIST BACKUPSET OF DATABASE;
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
DELETE OBSOLETE REDUNDANCY = 4 device type disk;
delete obsolete REDUNDANCY = 2 device type disk;
Clipboard
Delete archive log older than...
DELETE NOPROMPT ARCHIVELOG UNTIL TIME "SYSDATE-5"
Clipboard
Crosscheck the available archivelogs (fixes RMAN-06059)
change archivelog all crosscheck;
Clipboard
Copyright© 2007-2008 Andrew Barry
4 of 4 12/23/2008 10:48 PM