Oracle RMAN show, list, crosscheck, and delete commands

Source: Internet
Author: User
1. show command:
Display RMAN configuration: RMAN> show all;

2. Report command:
2.1. RMAN> report schema the physical structure of the target database;
2.2. RMAN> report need backup days = 3; report data files not backed up in the last three days;
2.3. RMAN> report need backup days 3 tablespace users; data files not backed up in the users tablespace for three days;
2.4. RMAN> report need backup incremental 3. report the number of incremental backups required for data file recovery more than three times;
2.5. RMAN> report need Backup Redundancy 2 database; report all data files with less than two backup files;
RMAN> report need Backup Redundancy = 2;
2.6. RMAN> report need Backup Recovery window of 6 days; data files whose report recovery takes more than 6 days to archive logs;
2.7. RMAN> report unrecoverable; report all unrecoverable data files of the database;
2.8. RMAN> report obsolete redunndancy 2. Report obsolete backups with more than two backups;
2.9. RMAN> report obsolete; Report redundant backup;

3. LIST command: List backup information
3.1 list data file backup Sets
RMAN> List backup list Detailed backup;
RMAN> List expired backup to list expired backups;
RMAN> List backup of database; list the backup sets of all data files;
RMAN> List backup of tablespace user01; list all data file backup sets for a specific tablespace;
3.2. RMAN> List backup of controlfile lists backup sets of control files;
3.3. RMAN> List backup of archivelog all lists detailed information about the archived log backup set;
RMAN> List archivelog all; List brief information about the archived log backup set
3.4. RMAN> List backup of spfile: List spfile backup sets;
3.5. RMAN> List copy of datafile 5 lists data file image copies;
3.6. RMAN> List copy of controlfile lists copies of control file images;
3.7. RMAN> List copy of archivelog all lists copies of archived log images;
3.8. RMAN> List incarnation of Database: List objects/list database copies;
3.9. RMAN> List backup summary; overview of available backups;
B Indicates backup
F indicates full
A Indicates archive log
0 1 indicates Incremental Backup
S indicates the backup status (a available X expired)

3.10. RMAN> List backup by file lists backups by Backup Type;
List data file backup, archive log backup, control file backup, and server parameter file backup

4. Crosscheck command: Check the backup information
4.1. RMAN> crosscheck backup checks all backup sets;
4.2. RMAN> crosscheck backup of database checks the backup sets of all data files;
4.3. RMAN> crosscheck backup of tablespace users checks the backup set of a specific tablespace;
4.4. RMAN> crosscheck backup of datafile 4. Check the backup set of a specific data file;
4.5. RMAN> crosscheck backup of controlfile check the backup set of the control file;
4.6. RMAN> crosscheck backup of spfile: Check the spfile backup set;
4.7. RMAN> crosscheck backup of archivelog sequence 3. Check the backup set for archiving logs;
4.8. RMAN> crosscheck copy checks all image copies;
4.9. RMAN> crosscheck copy of database checks the image copies of all data files;
4.10. RMAN> crosscheck copy of tablespace users checks the image copies of a specific tablespace;
4.11. RMAN> crosscheck copy of datafile 6 check the image copy of a specific data file;
4.12. RMAN> crosscheck copy of archivelog sequence 4. Check the image copy of the archived log;
4.13. RMAN> crosscheck copy of controlfile: Check the image copy of the control file;
4.14. RMAN> crosscheck backup tag = 'sat _ backup ';
4.15. RMAN> crosscheck backup completed after 'sysdate-2'
4.16. RMAN> crosscheck backup completed between 'sysdate-5' and 'sysdate-2'
4.17. RMAN> crosscheck backup device type SBT;
4.18. RMAN> crosscheck archivelog all;
4.19. RMAN> crosscheck archivelog like '% arc00012.001'
4.20. RMAN> crosscheck archivelog from sequence 12;
4.21. RMAN> crosscheck archivelog until sequence 522;

5. Delete: delete a backup.
5.1. RMAN> Delete Obsolete; delete old backup;
5.2. RMAN> Delete expired backup; Delete expired backup
5.3. RMAN> Delete expired copy; delete an expired copy;
5.4. RMAN> Delete backupset 19; delete a specific backup set;
5.5. RMAN> Delete backuppiece 'd:/backup/demo_19.bak 'delete a specific backup part;
5.6. RMAN> Delete backup deletes all backup sets;
5.7. RMAN> Delete datafilecopy 'd:/backup/demo_19.bak 'd to delete a specific image copy;
5.8. RMAN> Delete copy: delete all image copies;
5.9. RMAN> Backup archivelog all Delete input;
RMAN> Backup backupset 22 format = 'd:/backup/% u. Bak ''Delete Input
Delete the input object after the backup;
5.10. RMAN> Delete backupset ID; Delete backup setBytes -------------------------------------------------------------------------------------------------------------Rman list Command
  
1. List the corresponding event RMAN> List incarnation;
  
2. List backups
  
2.1 Overview of available backup RMAN> List backup summary;
B Indicates backup

 

F indicates full
A Indicates archive log 0 1 indicates Incremental Backup
S indicates the backup status (a available X expired)
  
2.2 list backup RMAN> List backup by file by Backup Type;
List data file backup, archive log backup, control file backup, and server parameter file backup
  
2.3 list Detailed backup RMAN> List backup;
  
2.4 list expired backup RMAN> List expired backup;
  
2.5 list tablespaces and data file backups
List backup of tablespace and list backup of datafile output are similar to list backup
For example, list backup of tablespace user_tbs;
List backup of datafile 3;
  
2.6 list archived log backup RMAN> List archivelog all; Brief Information
RMAN> List backup of archivelog all; details
  
2.7 list control files and server parameter files
RMAN> List backup of controfile;
RMAN> List backup of spfile;
  
========================================================== ==================
========================================================== ==================
   RMAN report command
  
1. Report data files that have not been backed up recently
RMAN> report need backup days = 3;
   
2. Report Backup Redundancy or recovery window
RMAN> report need Backup Redundancy = 2;
RMAN> report need Backup Recovery window of 2 days;
   
3. Report unrecoverable operations on data files
RMAN> report unrecoverable;
  
4. Report database mode
RMAN> report Schema;
   
5. Report discarded backups
If the storage policy is used, the backup is marked as the discard state RMAN> report obsolete; Delete the discard state backup RMAN> Delete Obsolete;
  
========================================================== ==================
========================================================== ==================
   RMAN crosscheck command
  
1. the backup set has two states: A (available, which RMAN considers to exist on the backup media) x (expired). The backup is stored in the control file or the recovery directory, but it does not physically exist on the backup media)
   
2 crosscheck is used to check the RMAN directory and physical file. If the physical file does not exist on the media, it is marked as expired. If a physical file exists, it will maintain available. If the original backup set marked as expired exists on the backup media again (for example, after the damaged disk drive is restored), crosscheck marks the status again from expired back to available.
  
3 The crosscheck output is divided into two parts. The first part lists all backup set slices that are determined to exist on the backup media, the second part lists the backup set slices that do not exist on the backup media, and marks them as expired. After a backup storage policy is set, a backup expires, and the status of the backup marked as discarded after crosscheck is still availabel. Delete the discarded backup delete obsolete.
  
4 EXAMPLE:
Crosscheck backup
Crosscheck backup of datafile 1;
Crosscheck backup of tablespace users;
Crosscheck backup of controfile;
Crosscheck backup of controlfile;
Crosscheck backup tag = 'sat _ backup ';
Crosscheck backup completed after 'sysdate-2'
Crosscheck backup completed between 'sysdate-5' and 'sysdate-2'
Crosscheck backup device type SBT;
Crosscheck archivelog all;
Crosscheck archivelog like '% arc00012.001'
Crosscheck archivelog from sequence 12;
Crosscheck archivelog until sequence 522;
  
========================================================== ==================
========================================================== ==================
   RMAN validate command
  
1 validate command to verify whether the backup set can be restored
  
2 list backup summary; obtain the backup set's primary key ID, such as 40, and then validate backupset 40;
========================================================== ==================
========================================================== ==================
   RMAN backup and storage policy and the change and delete commands
  
0. The change command with the delete parameter deletes the backup set, from the backup media, and from the control file and recovery directory.
Change backupset 117,118 Delete;
Change backuppiece 1304 Delete;
Change archivelog until logseq = 544 Delete;
  
1. Two types of policies: Recovery window backup and Storage Policy (recovery Windows Backup retension Policy) based on time
Backup Redundancy backup storage policy (Backup Redundancy backup retension Policy) Number of backups
  
Two policies are mutually exclusive.
   
2. Even if the backup storage policy is used, the backup will not be deleted when it expires, but is marked as discarded in the RMAN directory, and the status is still available;
To view the backup report obsolete marked as discarded, only Delete Obsolete is used for physical deletion.
  
3. Configure retension policy to recovery window of 7 days;
Configure retension policy to redundancy 3;
Show all;
   
4. you may need to manually save some backups when viewing expired and discarded backups. You can use the change command with the keep parameter. After using this command, the modified backups will be considered as long-term backups, and will not be affected by the storage policy. That is to say, delete obsolete will not be deleted.
  
5. Use the BACKUP command with the keep parameter to prevent backup from being affected by the storage policy.
Backup database keep forever;
Backup database keep 5 days;
  
6. Change command function
  
You can change the backup to permanent storage and save the logs related to the backup to ensure that the backup is always restored to the current time point.
Change backupset 31 keep forever logs;
You can set a new date for backup discarding, save the backup for 7 days, and delete the backup after 7 days.
Change backupset 32 keep until time 'sysdata + 7' logs;
  
7. Change can set the backup set to unavailable.
Change backupset 33 unavailable;
A backup set marked as unavailable does not participate in crosscheck;
========================================================== ==================
========================================================== ==================
   Restore directory record Deletion
  
1. $ ORACLE_HOME/rdbms/admin/prgrmanc. The SQL script regularly deletes records in the deleted directory.
  
2. to delete the old response record incarnation, you must delete these mappings from the dbinc table and use the rc_database_incarnation view to determine the response. Record the dbinc_key of each corresponding object to be deleted
Then start SQL * Plus and execute Delete from dbinc where dbinc_key = 2;
========================================================== ==================
========================================================== ==================
   Manually synchronize and restore Directories
  
Resync Catalog;
  
When Oracle synchronizes the recovery directory, it first creates a snapshot control file, then compares the file with the recovery directory. After the recovery directory is complete, Oracle updates the recovery directory to synchronize the recovery directory and the control file.
========================================================== ==================
========================================================== ==================
   Store scripts in RMAN
  
1. connect to the target database and restore the Directory
RMAN target/catalog rman/RMAN @ rman9i
   
2. Create a script
RMAN> Create script my_bk_script
2> {backup database plus archivelog ;}
Create script my_bk_script
    
3. Print the script
RMAN> Print script my_bk_script;
Printing stored scept: my_bk_script
{Backup database plus archivelog ;}
   
4. Run this script to back up the target database.
RMAN> run {execute scept my_bk_script ;}
   
5. Delete the script
RMAN> Delete script my_bk_script;
========================================================== ==================
========================================================== ==================
   Full recovery in archivelog Mode
  
Step 1: Set oracle_sid = recover
RMAN target rman_backup/Password
Configure controlfile autobackup on;
      
Step 2: Backup Database Plus archivelog Delete input;
  
Step 3: shutdown immediate;
  
Step 4: rename all data files and control files without renaming online redo logs.
  
Step 5: startup nomount;
Set dbid = ****
Restore controlfile from autobackup;
Alter database Mount;
     
Step 6: Restore database;
Recover database;
Alter database open resetlogs;
  
Tablespace recovery
  
SQL "alter tablespace users offline ";
SQL "alter tablespace tools offline ";
Restore tablespace users, tools;
Recover tablespace users, tools;
SQL "alter tablespace users online ";
SQL "alter tablespace tools online ";
  
Data File recovery
  
SQL "alter database datafile 3 offline ";
SQL "alter database datafile 'd: oracleoradatausers01.dbf 'offline ";
Restore datafile 3
Restore datafile 'd: oracleoradatausers01.dbf ';
Recover datafile 3
Recover datafile 'd: oracleoradatausers01.dbf ';
SQL "alter database datafile 3 online ";
SQL "alter database datafile 'd: oracleoradatausers01.dbf 'Online ";
  
========================================================== ==================
========================================================== ==================
Switch the current incarnation back to reset database to incarnation inc_key before resetlogs
  
========================================================== ==================
========================================================== ==================
  
   RMAN advanced recovery
  
1. Recovery Based on Time points
Run
{
Set until time "to_date ('2017/02 15:00:00 ', 'Mm/DD/yy hh24: MI: ss ')"'
Restore database;
Recover database;
Alter database open resetlogs;
}
  
2. SCN-based recovery
Startup Mount;
Restore database until SCN 10000;
Recover database until SCN 10000;
Alter database open resetlogs;
  
3. Log sequence-based recovery
Startup Mount;
Restore database until sequence 100 thread 1;
Recover database until sequence 100 thread 1;
Alter database open resetlogs;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.