Summary of Oracle Rman commands

Source: Internet
Author: User

--Login Rman
Rman Target/
Rman Target Sys/passwork
Rman Target sys/passwork nocatalog (control file mode)
Rman Target sys/passwork Catalog (Restore directory mode)


--View parameters
Show All


--Modify Save Days
Change the number of days that backup information is retained in the control file with Sqlplus
Show Parameter Control_file_record_keep_time

Alter system set CONTROL_FILE_RECORD_KEEP_TIME=30 Scope=spfile
Shutdown immediate
Startup


--rman Database Cold Backup
Shutdown immediate;
startup Mount;
Backup Database format= '/u01/backup/rman/%d_%t_%s.bak ';
ALTER DATABASE open;
SQL ' alter system archive log current ';


--rman Database Hot Backup
Backup Database format= '/u01/backup/rman/%d_%t_%s.bak ';
SQL ' alter system archive log current ';


--Backup table space
Backup tablespace emp;


--Backup data files
Backup datafile '/u01/mytest.dbf ';
Backup datafile 5 format= '/u01/backup/rman/%n_%s.dbf ';


--Backup Archive log
Backup Archivelog All
Backup Archivelog from time ' sysdate-1 '
Backup Archivelog from sequence 400
Backup Archivelog All Delete input
Backup Archivelog from sequence to delete input

format= '/u01/backup/rman/ar%t_%s.arc '--Specify path%T date


--Back up archived files for the past day
Backup format= '/u01/backup/rman/ar%d_%s.arc '
Archivelog
From Time= ' sysdate-1 ' until time= ' sysdate ';


--Backup data files and archive logs
Backup format= '/u01/backup/rman/t%d_%s.bak ' tablespace emp plus archivelog;


--Backup control files
Backup current Controlfile format= '/u01/backup/rman/%d_%s.ctl ';


--Backup SPFile
Backup SPFile format= '/u01/backup/rman/spf%d_%s.par ';


--Compress backup sets
Backup as compressed backupset tablespace EMP;


--Create a copy of the control file image
Copy current controlfile to '/u01/backup/rman/dbtest.ctl ';
Backup as Copy format= '/u01/backup/rman/dbtest01.ctl ' current controlfile;


--Create a copy of the data file image
Backup as Copy format= '/u01/backup/rman/8.dbf ' datafile 8;


--rman Maintenance Commands
List Backup--list all the backup information
List backup of database--list backup of databases
List Backup of tablespace EMP--Lists the specified tablespace backup
List Backup of datafile 5--Lists the specified data file backup
List backup of Controlfile--list control file backups
List backup of SPFile--list SPFile backup
List Archivelog All--list archived logs
List backup of Archivelog All--lists backup of archived logs

List Backup of database summary--list available backups
List Backup of tablespace EMP Summary--About table space backup
List backup by file--list backups by document type
List expired backup of Archivelog all summary--failed backups

Report obsolete--view expired
Delete obsolete--remove expired

List recoverable backup of database--list valid backups
List expired Backup--list of failed backups

List expired backup of Archivelog all         --List of failed archive log backups
List Expired backup of archivelog 
     until sequence 5                           --List the failed archive log backup for the specified serial number
list expired backup of archivelog 
     until Time "to_date (' 2012-6-30 ', ' yyyy-mm-dd ') "    
                                                 --Lists the failed archive log backup backup for the specified time

List copy--list image file copies
List copy of database
List copy of tablespace EMP
List copy of DataFile 6
List copy of Archivelog all
List copy of Controfile

Report schema
Report need backup-lists the
Report need backup Day 2 database--list of more than 2 days without backup

Under Mount State
List incarnation;
Reset database to incarnation 980;


--Delete invalid files
Delete a failed backup
Crosscheck Backup (Copy,archivelog all);
Delete Expired backup (Copy,archivelog all);


Delete the invalidation log
Crosscheck Archivelog All;
Delete Expired Archivelog all;

Crosscheck Backup of tablespace sysaux--Check table space backup
Crosscheck Backup of datafile 2--Check data file 2 backup
Crosscheck Backup of Controlfile--check control file backup
Crosscheck Backup of SPFile--check SPFile
Crosscheck Backup of copy-check copy
Crosscheck backup completed after ' sysdate-2 '--2 days before the current time

Crosscheck Copy of database
Crosscheck copy of Tablespace EMP
Crosscheck copy of Controlfile
Crosscheck copy of SPFile

List Backup summary--get the primary key
Validate Backupset 16--Verifying the validity of backup set 16
Change--Modify backup status
Change Backupset unavailable
Change Backupset available
Change Archivelog '/u01/backup/rman/***.log ' unavailable

Change Backupset Delete--Remove backup set 16 (sync Delete)
Delete Expired backupset (Archivelog all); --Delete invalid

Delete Expired--Deleting a failed backup
Delete obsolete--delete backups older than the backup policy date (expired)


--Recovery check
Restore database validate;
Validate Backupset 218;

Restore Database preview;
Restore tablespace users preview;
Restore datafile 5 Preview;


--Command block
run{
2> shutdown immediate;
3> startup Mount;
4> Allocate channel D1 type disk;
5> Backup as Backupset database
6> format= '/u01/backup/rman/%d_%t.bak ';
7> ALTER DATABASE open;
8> SQL ' alter system archive log current ';
9>}

SELECT * from V$log;
SELECT * from V$archived_log;
SELECT * from V$backup_redolog;


--Recovery Consultant
List Failure--Diagnostic error
Advise failure--suggestion
Repair Failure-repair (data files and control files)


Renaming data files under--rman
run{
2> SQL ' alter tablespace yesorno offline ';
3> set newname for datafile '/u01/app/oracle/oradata/yesorno.dbf '
4> to '/u01/app/oracle/oradata/yesorno01.dbf ';
5> restore Tablespace Yesorno;
6> switch datafile all;
7> recover tablespace Yesorno;
8> SQL ' alter tablespace yesorno online ';
}


--rman to data file movement
run{
2> SQL ' alter tablespace yesorno offline ';
3> set newname for datafile '/u01/app/oracle/oradata/yesorno01.dbf '
4> to '/u01/app/oracle/oradata/dbtest/yesorno01.dbf ';
5> restore Tablespace Yesorno;
6> switch datafile all;
7> recover tablespace Yesorno;
8> SQL ' alter tablespace yesorno online ';
}

Summary 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.