An explanation of Oracle Rman commands

Source: Internet
Author: User

First,ListGeneral Command Summary Memo

The list command lists the control files, the backup information in the Rman recovery directory, and is one of our most intuitive ways to understand all of the visible database backup files.

List incarnation;
List Backup summary;
List backup of database summary;
List backup of tablespace summary;
List Backup of datafile n,n summary;
List Archivelog all summary;

List backup by file;
List backup;
List expired backup;
List copy;

List backup of SPFile;
List backup of Controlfile;
List backup datafile n,n,n;
List backup tablespace tablespace_name;
List backup of Archivelog all;
List backup of Archivelog from SCN ...;
List backup of Archivelog until SCN ...;
List backup of archivelog from sequence.;
List backup of Archivelog until time ' sysdate-10 ';
List Backup of Archivelog {All, from, high, like, logseq, Low, SCN, sequence, time, until};


1. List The databases that are currently backed up by Rman:

rman> list incarnation;
Rollup Query:--If you have more backup files, use these two list commands to get a general idea of the backup files.


1.1. List backup summary; --Overview of available backups

B indicates backup
A means archivelog, F means full backup, 0,1,2 represents incremental level backup
A means available avaliable, X represents expired

This command can derive a number of similar commands, such as
List Backup of database summary
List Backup of Archivelog all summary
List Backup of tablespace users summary;
List Backup of datafile n,n,n summary

These commands allow us to have a holistic, intuitive understanding of the existing backup files.


1.2.list backup by file;--listed by file type
are: Data file list, archive log list, control file list, SPFile list

1.3.list backup;
This command lists the details of the existing backup set.

1.4.list expired backup;
List out-of-date backup files

1.5.list copy;
List copy files
list copy of database;
List copy of Controlfile;
List copy of tablespace users;
List copy of DataFile N,n,n;
List copy of Archivelog all;
List copy of Archivelog from SCN 10000;
List copy of Archivelog until sequence 12;


2. List -related file information
List backup of {archivelog, controlfile, Database, datafile, SPFile, tablespace};
list backup of database; --full,incremental,tablespace,datafile

2.1 Server parameter file:
List backup of SPFile;


2.2 Control Files:
List backup of Controlfile;


2.3 Data files:
List backup of Datafle n,n,n,n;


2.4 tablespace:
    list Backup of tablespace tablespace_name;--table space corresponding to backup

2.5 archive log:
    List Backup of Archivelog {All, from, high, like, logseq, Low, SCN, sequence, time, until};
    List Backup of Archivelog all;
    List Backup of Archivelog until time ' sysdate-1 ';
    List Backup of archivelog from sequence 10;
    List Backup of archivelog until sequence 10;
    List Backup of Archivelog from SCN 10000;
    List Backup of Archivelog until SCN 200000;

    list Archivelog from SCN;
    list Archivelog until SCN 2000;
    list Archivelog from sequence 10;
    list archivelog until sequence 12;



Second, report Common Commands Summary Memo


The report is used to determine the current recoverable state of the database and the information that the database has been backed up.
The most commonly used is the report obsolete; Report schema;

Report {device, need, obsolete, schema, unrecoverable}

Report schema;
Report obsolete;
Report unrecoverable;
Report need backup;
Report need backup days=3; --report files that have not been backed up in the last 3 days
Report need backup redundancy=3; --Report data files with less than 3 redundancy.
Report need backup recovery windows of 2 days;
2.1.report schema;
Reporting Database Schema


22.report obsolete;
Reports the discarded backup set (a retention policy is configured).


2.3.report unrecoverable;
Reports an unrecoverable data file in the current database (that is, a backup without this data file, or a backup of the data file has expired)


2.4.report need backup;
Report data files that need to be backed up (depending on the conditions)
Report need backup days=3;
--data files that have not been backed up in the last three days (these data files will require the last 3 days of archived logs to recover if there is a problem)
Report need backup incremental=3;
-How many incremental backup files are required to recover the data files. (If there is a problem, these data files will require 3 incremental backups to recover)
Report need backup redundancy=3;
--Report a data file with a redundancy of less than 3
-for example, the data file contains 2 data files system01.dbf and users01.dbf.
--This data file is included in the backup of 3 or more 3 times, while USERS01.DBF is less than 3 times.
--Well, the data file that's being reported is users01.dbf.
-that is, report data files with less than n redundancy in the database
Report need backup recovery windows of 2 days;
--Report a data file that restores 2 days to archive logs



Third,BackupGeneral Command Summary Memo
1. Setting up the backup flag
Backup Database tag= ' FULL_BAK1 ';
Note: Each tag must be unique, and the same token can be used for multiple backups to restore only the most recent backup.

2. Set the backup set size (all results of a single backup are one backup set, be aware of the backup set size)
Backup Database maxsetsize=100m tag= ' datafile1 ';
Note: Maxsetsize limits the size of the backup set. Therefore must be larger than the database total data file size, or will error.
Rman-06183:datafile or datafile copy larger than maxsetsize:file# 1/DATA/ORADATA/SYSTEM01.DBF

3. Set the backup slice size (tape or file system limit)
Run {
Allocate channel C1 type disk maxpicecsize 100m format '/data/backup/full_0_%u_%t ';
Backup Database tag= ' Full_0 ';
Release channel C1;
}
You can set the size of each backup slice in the ALLOCATE clause to achieve tape or system restrictions.
You can also set the backup slice size in configure.
Configure Channel device type disk maxpiecesize m;
Configure channel device type disk clear;

4. Save Policy for backup sets
Backup database Keep forever; --Keep backup files permanently
Backup database Keep until time= ' sysdate+30 '; --Save backups for 30 days


5. Overriding the Configure exclude command
Backup Databas noexclude Keep forever tag= ' test backup ';

6. Check for database errors
Backup validate database;
Use Rman to scan the database for physical/logical errors and not perform actual backups.

7. Skip offline, non-accessible or read-only files
Backup DATABASE Skip ReadOnly;
Backup database skip offline;
Backup database skip inaccessible;
Backup DATABASE ship readonly skip offline ship inaccessible;

8. Force Backup
Backup Database Force;

9. Backing up data files based on last backup time
1> only back up new data files that are added
Backup database not backed up;
2> a data file that is not backed up "for a limited time period"
Backup database not backed up since Time= ' sysdate-2 ';

10. Check for logic errors during backup operation
Backup check logical database;
Backup validate check logical database;

11. Generating a backup copy
Backup Database copies=2;

12. Backup Control Files
Backup database device type disk includ current controlfile;



Four,ConfigureGeneral Command Summary Memo


4.1 Displays the current configuration information

1.1 Rman> Show All;

The RMAN configuration parameters are:

CONFIGURE RETENTION POLICY to redundancy 1; # Default

CONFIGURE BACKUP optimization OFF; # Default

CONFIGURE DEFAULT DEVICE TYPE to DISK; # Default

CONFIGURE controlfile autobackup OFF; # Default

CONFIGURE controlfile autobackup FORMAT for DEVICE TYPE DISK to '%F '; # Default

CONFIGURE DEVICE type DISK PARALLELISM 1 BACKUP type to BACKUPSET; # Default

CONFIGURE datafile BACKUP COPIES for DEVICE TYPE DISK to 1; # Default

CONFIGURE ARCHIVELOG BACKUP COPIES for DEVICE TYPE DISK to 1; # Default

CONFIGURE maxsetsize to UNLIMITED; # Default

CONFIGURE encryption for DATABASE OFF; # Default

CONFIGURE encryption algorithm ' AES128 '; # Default

CONFIGURE ARCHIVELOG deletion POLICY to NONE; # Default

CONFIGURE SNAPSHOT controlfile NAME to ' d:/oracle/product/10.2.0/db_1/database/s

Ncfdba. ORA '; # Default


1.2 Query Rman setting non-default values:
Sql> select Name,value from V$rman_configuration;


4.2. Common Configure options

4.2.1 Save policies (retention policy)
Configure retention policy to recovery windows of 7 days;
Configure retention policy to redundancy 5;
Configure retention policy clear;

CONFIGURE RETENTION POLICY to NONE;
The first recover window is to keep all the backups sufficient to restore the database system to any time in the last seven days. Any database backups that exceed the last seven days will be marked as obsolete.
The second redundancy is to maintain the latest 5 database backups that can be recovered, and any backups that exceed the latest 5 copies will be marked as redundancy. Its default value is 1 copies.

34th: NONE can invalidate the backup retention policy, and Clear restores the default retention policy

The safest approach is to adopt a second retention strategy.



4.2.2   backup Optimization  backup optimization
   configure backup optimization on;
   Configure backup optimization off;
   Configure backup optimization clear; The
default is off, and if opened, Rman will perform an optimized algorithm for files such as the backed up data files and archives.

4.2.3  default devices  default device type
   Configure Default device type to disk;
   Configure default device type to STB;
   Configure default device type clear;
is the device type that specifies all I/O operations is the hard disk or tape, the default is the hard disk
Tape setting is configure default device type to SBT;


4.3.4 control file Controlfile
Configure Controlfile autobackup on;
Configure Controlfile autobackup format for device type disk to '/cfs01/backup/conf/conf_%f ';
Configure Controlfile Autobackup clear;
Configrue controlfile autobackup format for device type disk clear;
Configrue snapshot controlfile name to '/CFS01/BACKUP/SNAPCF/SCONTROFILE.SNP ';

--Is the storage path and file name of the snapshot file for the configuration control file, which is generated during the backup and is used to control the read consistency of the file.
Configrue snapshot controlfile name clear;


Forces the database to automatically back up the control file after a backup file or a command that alters the structure of the database, and the default value is off. This avoids the control files and catalog loss, the control files can still be recovered.


4.3.5 Number of parallel ( Channels) device type DISK|STB pallelism n;
Configure device type DISK|STB parallelism 2;
Configure device type DISK|STB clear; --Used to clear the channel configuration above
Configure channel device type disk format ' e/:rmanback_%u ';
Configure channel device type disk maxpiecesize 100m
Configure channel device type disk rate 1200K
Configure Channel 1 Device type disk format ' e/:rmanback_%u ';
Configure Channel 2 device type disk format ' e/:rmanback_%u ';
Configure Channel 1 device type disk maxpiecesize 100m

Configures the degree of parallelism for the database device type.


4.3.6 to generate a backup copy of Datafile|archivelog backup copies
Configure DataFile backup copies for device type DISK|STB to 3;
Configure Archivelog backup copies for device type DISK|STB to 3;

--is the type of storage device that sets the archive log for the database
Configure Datafile|archivelog backup copies for device type DISK|STB clear
BACKUP DEVICE TYPE DISK DATABASE
FORMAT '/disk1/backup/%u ', '/disk2/backup/%u ', '/disk3/backup/%u ';


Is the copy number of each backup of the configuration database, and each backup of Oracle can have multiple copies of the exact same copy.


4.3.7 exclusion options Exclude
Configure exclude for tablespace ' users ';
Configrue exclude clear;

This command is used to not back up the specified tablespace to the backup set, which is useful for read-only table spaces.


4.3.8 Backup set size Maxsetsize
Configure Maxsetsize to 1g|1000m|1000000k|unlimited;
Configure Maxsetsize Clear;

4.3.9 Other Options Auxiliary
CONFIGURE Auxname for datafile 1 to '/oracle/auxfiles/aux_1.f ';
CONFIGURE Auxname for datafile 2 to '/oracle/auxfiles/aux_2.f ';
CONFIGURE Auxname for datafile 3 to '/oracle/auxfiles/aux_3.f ';
CONFIGURE Auxname for datafile 4 to '/oracle/auxfiles/aux_4.f ';
-
CONFIGURE auxname for datafile 1 CLEAR;
CONFIGURE auxname for datafile 2 CLEAR;
CONFIGURE Auxname for datafile 3 CLEAR;
CONFIGURE Auxname for datafile 4 CLEAR;

Rman of the format in the format %
Number of copies of%c backup slices
%d database name
%d The day ordinal (DD) in the month
%M in the month of the year (MM)
%F a unique name based on dbid, which is in the form of C-IIIIIIIIII-YYYYMMDD-QQ, where IIIIIIIIII is the DBID,YYYYMMDD for the database
Date, QQ is a sequence of 1-256
%n database name, fill to the right up to a maximum of eight characters
%u a eight-character name represents the backup set and the creation time
%p The backup piece number in the backup set, starting from 1 to the number of files created
%u a unique file name that represents%u_%p_%c
%s The number of the backup set
%t Backup set Timestamp
%T date Format (YYYYMMDD)

An explanation of Oracle Rman commands

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.