常用RMAN 備份命令
---SHOWSHOW RETENTION POLICY;
SHOW DEVICE TYPE;
SHOW DEFAULT DEVICE TYPE;
SHOW CHANNEL;
SHOW MAXSETSIZE;SHOW ALL;
---LIST RMAN> LIST ARCHIVELOG ALL; RMAN> LIST BACKUP OF ARCHIVELOG ALL; RMAN> LIST BACKUP; RMAN> LIST BACKUP OF DATABASE; RMAN> LIST BACKUP OF DATAFILE 1; RMAN> LIST BACKUP SUMMARY; RMAN> LIST INCARNATION; RMAN> LIST BACKUP BY FILE; RMAN> LIST COPY OF DATABASE ARCHIVELOG ALL; RMAN> LIST COPY OF DATAFILE 1, 2, 3; RMAN> LIST BACKUP OF DATAFILE 11 SUMMARY; RMAN> LIST BACKUP OF ARCHIVELOG FROM SEQUENCE 1437; RMAN> LIST CONTROLFILECOPY "/tmp/cntrlfile.copy"; RMAN> LIST BACKUPSET OF DATAFILE 1; RMAN> LIST FAILURE; RMAN> LIST FAILURE 641231 detail;
---backup
Back up the database, and then the control file: (which contains a record of the backup) RMAN> BACKUP DATABASE;
RMAN> BACKUP CURRENT CONTROLFILE; Backup datafiles: RMAN> BACKUP AS BACKUPSET DATAFILE 'ORACLE_HOME/oradata/trgt/users01.dbf', 'ORACLE_HOME/oradata/trgt/tools01.dbf'; Backup all datafiles in the database: (bit-for-bit copies, created on disk) RMAN> BACKUP AS COPY DATABASE; Backup archive logs: RMAN> BACKUP ARCHIVELOG COMPLETION TIME BETWEEN 'SYSDATE-28' AND 'SYSDATE-7'; Backup tablespace: RMAN> BACKUP TABLESPACE system, users, tools; Backup controlfile: RMAN> BACKUP CURRENT CONTROLFILE TO '/backup/cntrlfile.copy'; Backup parameter file: RMAN> BACKUP SPFILE; Backup everything: RMAN> BACKUP BACKUPSET ALL; Create a consistent backup and keep the backup for 1 year: (exempt from the retention policy) RMAN> SHUTDOWN;
RMAN> STARTUP MOUNT;
RMAN> BACKUP DATABASE UNTIL 'SYSDATE+365' NOLOGS;
Backup Validation confirms that a backup could be run, by confirming that all database files exist and are free of physical and logical corruption, this does not generate any output.
Example:
RMAN> BACKUP VALIDATE DATABASE ARCHIVELOG ALL;
---CONFIGURE
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/tmp/%U';Backup using a flash recovery area rather than disk
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT CLEAR;Configure RMAN to back up the control file after each backup
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;By default, RMAN automatically names control file backups and stores them in the flash recovery area.
To configure RMAN to write control file backups to the /cfilebackups directory:
( %F will generate a unique filename)RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/cfilebackups/cf%F';Ensure that RMAN retains all backups needed to recover the database to any point in time in the last 7 days:
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;Retain three backups of each datafile:
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;Delete backups no longer required by the retention policy:
RMAN> DELETE OBSOLETETo override the configured retention policy for individual backups - use BACKUP.. KEEP (or CHANGE.. KEEP)
Configure backups to run in parallel by assigning two sbt channels:
RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 2;Reset any CONFIGURE setting to its default by running the command with the CLEAR option
RMAN> CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR; RMAN> CONFIGURE RETENTION POLICY CLEAR;---CROSSCHECKRMAN> CROSSCHECK BACKUP; RMAN> CROSSCHECK COPY; RMAN> CROSSCHECK backup of database; RMAN> CROSSCHECK backup of controlfile; RMAN> CROSSCHECK archivelog all;---DELETERMAN> CONFIGURE CHANNEL DEVICE TYPE sbt; RMAN> CROSSCHECK BACKUP OF TABLESPACE user_data COMPLETED BEFORE 'SYSDATE-14';RMAN> DELETE NOPROMPT EXPIRED BACKUP OF TABLESPACE user_data COMPLETED BEFORE 'SYSDATE-14'; RMAN> DELETE BACKUP OF DATABASE LIKE '/tmp%'; RMAN> DELETE ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt; RMAN> DELETE BACKUPSET 101, 102, 103; RMAN> DELETE CONTROLFILECOPY '/tmp/cntrlfile.copy'; RMAN> DELETE BACKUP OF SPFILE TABLESPACE users DEVICE TYPE sbt;---RESTORE AND RECOVERRestore and recover the whole Database:
RMAN> STARTUP FORCE MOUNT; RMAN> RESTORE DATABASE; RMAN> RECOVER DATABASE; RMAN> ALTER DATABASE OPEN;Restore and recover a Tablespace:
RMAN> SQL 'ALTER TABLESPACE users OFFLINE'; RMAN> RESTORE TABLESPACE users; RMAN> RECOVER TABLESPACE users; RMAN> SQL 'ALTER TABLESPACE users ONLINE';Restore and recover a Datafile:
RMAN> SQL 'ALTER DATABASE DATAFILE 64 OFFLINE'; RMAN> RESTORE DATAFILE 64; RMAN> RECOVER DATAFILE 64; RMAN> SQL 'ALTER DATABASE DATAFILE 64 ONLINE';Restore the Control file, (to all locations specified in the parameter file) then restore the database, using that control file:
STARTUP NOMOUNT;
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
RESTORE CONTROLFILE;
ALTER DATABASE MOUNT;
RESTORE DATABASE;
}Restore Validation confirms that a restore could be run, by confirming that all database files exist and are free of physical and logical corruption, this does not generate any output.
Example:RMAN> RESTORE DATABASE VALIDATE;參考文件:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15747463/viewspace-744992/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN 常用操作命令二(備份保留策略)
- RMAN說,我能備份(7)--RMAN常用命令
- RMAN說,我能備份(8)--RMAN常用命令續
- oracle rman備份命令Oracle
- RMAN常用備份指令碼指令碼
- rman備份恢復命令之switch
- oracle備份常用命令Oracle
- RMAN說,我能備份(16)--RMAN中的SET命令
- Backup And Recovery User's Guide-備份RMAN備份-使用RMAN備份備份集GUIIDE
- 使用Catalog命令註冊RMAN備份集
- RMAN說,我能備份(9)--RMAN增量備份與備份保留策略
- 【RMAN】RMAN備份至ASMASM
- RMAN說,我能備份(14)--實戰RMAN備份
- rman 備份策略
- RMAN備份原理
- Backup And Recovery User's Guide-備份RMAN備份-用RMAN備份映象拷貝備份GUIIDE
- mongodb 備份恢復常用命令MongoDB
- rman備份的策略和croosschek delete基本命令delete
- RMAN說,我能備份(3)--RMAN全庫備份和表空間備份
- 【RMAN】RMAN的備份保留策略
- rman備份和增量備份指令碼指令碼
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- RMAN說,我能備份(5)--RMAN備份歸檔檔案
- Backup And Recovery User's Guide-RMAN備份概念-RMAN備份的多個拷貝-備份的備份GUIIDE
- RMAN的備份原理
- rman 備份指令碼指令碼
- rman備份型別型別
- RMAN 備份詳解
- RMAN備份詳解
- rman備份學習
- oracle之rman備份Oracle
- rman備份筆記筆記
- RMAN的備份加密加密
- rman 0.1.2 備份 script
- Oracle RMAN 增量備份Oracle
- rman備份指令碼指令碼
- rman 備份 全庫