Странице

Ознаке

петак, 21. новембар 2014.

Validating Database Files and Backups

VALIDATE command to manually check for physical and logical corruptions in database files
VALIDATE DATABASE; -- validate all datafiles and control files (and the server parameter file if one is in use)
VALIDATE BACKUPSET 22;
VALIDATE DATAFILE 1 BLOCK 10;
Validating Database Files with BACKUP VALIDATE
BACKUP VALIDATE DATABASE ARCHIVELOG ALL; -- validate that all database files and archived logs can be backed up
BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL; -- check for logical corruptions in addition to physical corruptions
Validating Backups Before Restoring Them
RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG ALL VALIDATE;

четвртак, 6. новембар 2014.

RMAN - Delete backups

#Deleting backups using primary keys from LIST output:
DELETE BACKUPPIECE 101;
#Deleting backups by filename on disk:
DELETE CONTROLFILECOPY '/tmp/control02.ctl';
#Deleting archived redo logs from disk:
DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 300;
#Deleting backups based on tags:
DELETE BACKUP TAG='before_upgrade';
#Delete backups based on the objects backed up and the media or disk location where the backup is stored:
DELETE BACKUP OF TABLESPACE users DEVICE TYPE sbt; # delete only from tape
DELETE COPY OF CONTROLFILE LIKE '/tmp/%';  # 
#Delete all backups for this database recorded in the RMAN repository:
DELETE BACKUP; 
#Delete backups and archived redo logs from disk based on whether they are backed up on tape:
DELETE ARCHIVELOG ALL
BACKED UP 3 TIMES TO sbt; 
#If you run RMAN interactively, then RMAN asks for confirmation before deleting any files. You can suppress these confirmations by using the NOPROMPT keyword with any form of the BACKUP command:
DELETE NOPROMPT ARCHIVELOG ALL; 
#If you have not performed a crosscheck recently, then issue a CROSSCHECK command. For example, issue:
CROSSCHECK BACKUP; # checks backup sets and copies on configured channels
#Delete the expired backups. For example, issue:
DELETE EXPIRED BACKUP;
#If you use the DELETE command with the optional FORCE keyword, RMAN deletes the specified backups, but ignores any I/O errors, including those that occur when a backup is missing from disk or tape. It then updates the RMAN repository to reflect the fact that the backup is deleted, regardless of whether RMAN was able to delete the file or whether the file was already missing. For example:
DELETE FORCE NOPROMPT BACKUPSET TAG 'weekly_bkup';
#If you specify the DELETE OBSOLETE command with no arguments, then RMAN deletes all obsolete backups defined by the currently configured retention policy For example:
DELETE OBSOLETE;
#You can also use the REDUNDANCY or RECOVERY WINDOW clauses with DELETE to delete backups obsolete under a specific retention policy instead of the configured default:
DELETE OBSOLETE REDUNDANCY = 3;
DELETE OBSOLETE RECOVERY WINDOW OF 7 DAYS;
Source - Oracle 

уторак, 4. новембар 2014.

RMAN - LIST & REPORT

LIST BACKUP;           # lists backup sets, image copies, and proxy copies
LIST BACKUPSET;    # lists only backup sets and proxy copies
LIST COPY;                # lists only disk copies
LIST EXPIRED BACKUP;
LIST BACKUP BY FILE; # shows backup sets, proxy copies, and image copies
LIST COPY BY FILE;      # shows only disk copies
LIST EXPIRED BACKUP BY FILE;
LIST BACKUP SUMMARY;  # lists backup sets, proxy copies, and disk copies
LIST EXPIRED BACKUP SUMMARY;

# lists backups of all files in database
LIST BACKUP OF DATABASE; 
# lists copy of specified datafile
LIST COPY OF DATAFILE 'ora_home/oradata/trgt/system01.dbf'; 
# lists specified backup set
LIST BACKUPSET 213; 
# lists datafile copy
LIST DATAFILECOPY '/tmp/tools01.dbf';

# specify a backup set by tag
LIST BACKUPSET TAG 'weekly_full_db_backup';
# specify a backup or copy by device type
LIST COPY OF DATAFILE 'ora_home/oradata/trgt/system01.dbf' DEVICE TYPE sbt;
# specify a backup by directory or path
LIST BACKUP LIKE '/tmp/%';
# specify a backup or copy by a range of completion dates
LIST COPY OF DATAFILE 2 COMPLETED BETWEEN '10-DEC-2002' AND '17-DEC-2002';
# specify logs backed up at least twice to tape
LIST ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt;

#List Incarnations of DB
LIST INCARNATION;
LIST INCARNATION OF DATABASE prod3;
LIST INCARNATION OF DATABASE;

# Reports which database files need to be backed up to meet a configured or specified retention policy
REPORT NEED BACKUP
#Reports which database files require backup because they have been affected by some NOLOGGING operation such as a direct-path INSERT
REPORT UNRECOVERABLE
#Full backups, datafile copies, and archived redo logs recorded in the RMAN repository that can be deleted because they are no longer needed.
REPORT OBSOLETE
#The names of all datafiles (permanent and temporary) and tablespaces for the target database at the specified point in time
REPORT SCHEMA
#Displays objects requiring backup to satisfy a recovery window-based retention policy.
REPORT NEED BACKUP RECOVERY WINDOW OF n DAYS
#Displays objects requiring backup to satisfy a redundancy-based retention policy.
REPORT NEED BACKUP REDUNDANCY n
#Displays files that require more than n days' worth of archived redo log files for recovery.
REPORT NEED BACKUP DAYS n
#Displays files that require application of more than n incremental backups for recovery.
REPORT NEED BACKUP INCREMENTAL n
REPORT NEED BACKUP RECOVERY WINDOW OF 2 DAYS DATABASE SKIP TABLESPACE TBS_2;
REPORT NEED BACKUP REDUNDANCY 2 DATAFILE 1;
REPORT NEED BACKUP TABLESPACE TBS_3; # uses configured retention policy
REPORT NEED BACKUP INCREMENTAL 2; # checks entire database
REPORT NEED BACKUP RECOVERY WINDOW OF 2 DAYS DATABASE DEVICE TYPE sbt;
REPORT NEED BACKUP DEVICE TYPE DISK;
REPORT NEED BACKUP TABLESPACE TBS_3 DEVICE TYPE sbt;
REPORT UNRECOVERABLE;