Thursday, January 1, 2015
RMAN - Commands
#######
LIST
#######
RMAN> List Backup Summary;
List of Backups (see backup was taken twice)
===================================
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
2441 B F A DISK 08-SEP-14 1 1 NO FULL_BACKUP <-- full db
2442 B F A DISK 08-SEP-14 1 1 NO FULL_BACKUP <-- full db
2443 B F A DISK 09-SEP-14 1 1 NO FULL_BACKUP1 <-- full db
2444 B A A DISK 09-SEP-14 1 1 NO FULL_BACKUP1 <-- Archlog Backup
== Report Backups no longer needed for recovery ===
RMAN> crosscheck backup;
RMAN> REPORT OBSOLETE;
Listing Tablespace and Datafile Backups
-----------------------------------------
RMAN> List Backup of Tablespace Test;
RMAN> List Backup of Datafile 4;
RMAN> list datafilecopy all;
RMAN> list backup of datafile 1;
RMAN> list backup of datafile 1 summary completed between '30-JUN-2012' and '02-JUL-2012';
RMAN> crosscheck copy
List Archivelog Backups
------------------------------
RMAN> List Archivelog all;
RMAN> List Archivelog all backedup 2 times to device type sbt;
List Controlfile and Spfile Backups
---------------------------------------
RMAN> List Backup of Controlfile;
RMAN> List Backup of Spfile;
List Incarnations :
------------------------
A new incarnation of the database is created when you perform the open resetlogs operation. To view the list of database incarnations,
RMAN> List incarnation;
List Summary of Backups
-----------------------
The summary of backups include backupset key, the status, device type, completion time etc,
RMAN> List Backup Summary;
List of Backups (see backup was taken twice)
===================================
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
2441 B F A DISK 08-SEP-14 1 1 NO FULL_BACKUP
2442 B F A DISK 08-SEP-14 1 1 NO FULL_BACKUP
2443 B F A DISK 09-SEP-14 1 1 NO FULL_BACKUP1
2444 B F A DISK 09-SEP-14 1 1 NO FULL_BACKUP1
RMAN> List expired Backup of archivelog all summary;
RMAN> List Backup of tablespace Test summary;
List Backups of various files
-----------------------------------
provides summary of the backups available for each datafile, controlfile, archivelog file and spfile.
RMAN> List Backup By File;
Detailed Report
-------------------
If you want the detailed report on the backups, then issue the following command.
RMAN> List Backup; shows both available and expired backups.
To list the backups used for restore and recovery,
RMAN> list recoverable backup;
To view only the expired backups,
--------------------------------
RMAN> List expired Backup;
RMAN> List expired Backup summary;
RMAN> List expired Backup of Archivelog all;
RMAN> List expired Backup of datafile nn;
If you have performed Image copy backups then you must use the list copy command as shown below,
------------------------------------------------------------------------------------------------
RMAN> List Copy;
RMAN> List Copy of database;
RMAN> List Copy of tablespace <dbname>;
RMAN> List Copy of archivelog all;
RMAN> List Copy of archivelog from sequence <nnnn>;
RMAN> List Copy of archivelog from sequence <nnn> until sequence <nnn>;
RMAN> List Copy of Controlfile;
RMAN> List Copy of Spfile;
RMAN> list datafilecopy all;
#######
DELETE
#######
RMAN>delete backupset of archivelog all completed before 'sysdate-1';
RMAN>delete force archivelog all backed up 1 times to device type disk;
RMAN>list expired backup of archivelog all;
RMAN>list expired backup;
RMAN>delete expired archivelog all;
RMAN> delete expired datafilecopy all;
RMAN> delete copy
-----------------------
Cleanup Expired
------------------------
export ORACLE_SID=
rman target /
RMAN>crosscheck Backup;
RMAN>list expired Backup;
RMAN>delete expired backup;
RMAN>crosscheck archivelog all;
RMAN>list expired archivelog all;
RMAN>delete expired archivelog all;
-------------------------------
ARCHIVELOG Cleanup
--------------------------------
export ORACLE_SID=
rman target /
RMAN>crosscheck archivelog all;
RMAN>list expired archivelog all;
RMAN>delete expired archivelog all;
RMAN>delete backupset of archivelog all completed before 'sysdate-1';
RMAN>delete force archivelog all backed up 1 times to device type disk;
Backup all the arch logs as compressed .
RMAN>backup as compressed backupset archivelog all not backed up 1 times to device type disk.
Remove arch logs after backup
RMAN> delete force archivelog all backed up 1 times to device type disk;
============== WORKED =================
crosscheck archivelog all;
delete expired archivelog all;
delete noprompt expired archivelog all;
=============================================
===>>>> Cleanup Archivelog area <<<====
=============================================
-- Safe to delete because Once archlog backup is done it is stored in the backupset area
delete [force] archivelog all completed before 'sysdate-2' backed up 1 times to device type disk;
delete [force] archivelog all backed up 1 times to device type disk;
-- If you want to force Delete Archive Logs witout Taking ArchLog Backups
delete noprompt archivelog [all] until time 'sysdate - 3';
=================================================================================================
===>>>> Cleanup Recovery area by cleaning old backup sets (archivelog and incrementsls) <<<==
=================================================================================================
-- chk if the tape bkp was completed then You can delete from the Backup set old arch log copy
delete backupset of archivelog all completed before 'sysdate-2' device type disk;
delete backupset of database completed before 'sysdate-1' device type disk;
#########
BACKUP
#########
run {
allocate channel oem_backup_disk1 type disk rate=50000K;
recover copy of database with tag 'ORA_OEM_LEVEL_0';
backup incremental level 1 cumulative copies=1 for recover of copy with tag 'ORA_OEM_LEVEL_0' database;
backup as BACKUPSET tag 'archivelogs' archivelog all not backed up delete all input;
release channel oem_backup_disk1;
}
allocate channel for maintenance type disk;
delete noprompt obsolete device type disk;
crosscheck archivelog all;
release channel;
backup incremental level 0 for recover of copy with tag 'ORA_OEM_LEVEL_0' database;
RUN {
allocate channel oem_backup_disk1 type disk rate=50000K;
# Create an image copy of all datafiles in the database
BACKUP AS COPY DATABASE;
}
Thanks
Adarsh Kumar
AK Technosoft Corp.
www.aktechnosoft.com