RMAN中常用的命令(一)

kuqlan發表於2011-07-16

1、連線到目標資料庫(不用恢復目錄資料庫)

Rman nocatalog target sys/change_on_isntall@testdb

Rman catalog rman_user/rman_user@ora9rc target sys/change_on_install@testdb

2SHOW命令:

顯示rman配置: RMAN> show all;

[@more@]

3REPORT命令:

1RMAN> report schema 報告目標資料庫的物理結構;

2RMAN>report need backup days=3; 報告最近3天沒有被備份的資料檔案;

3RMAN> report need backup days 3 tablespace users; USERS表空間上3天未備份的資料檔案;

4RMAN> report need backup incremental 3;

報告恢復資料檔案需要的增量備份個數超過3次的資料檔案;

5RMAN> report need backup redundancy 2 database; 報告備份檔案低於2份的所有資料檔案;

RMAN>report need backup redundancy=2;

6RMAN> report need backup recovery window of 6 days;

報告檔案報表的恢復需要超過6天的歸檔日誌的資料檔案;

7RMAN> report unrecoverable; 報告資料庫所有不可恢復的資料檔案;

8RMAN> report obsolete redunndancy 2; 報告備份次數超過2次的陳舊備份;

9RMAN>report obsolete; 報告丟棄的備份;

4LIST命令:列出備份資訊

1、列出資料檔案備份集

RMAN>list backup 列出詳細備份;

RMAN>list expired backup 列出過期備份;

RMAN> list backup of database; 列出所有資料檔案的備份集;

RMAN> list backup of tablespace user01; 列出特定表空間的所有資料檔案備份集;

2RMAN> list backup of controlfile 列出控制檔案備份集;

3RMAN> list backup of archivelog all 列出歸檔日誌備份集詳細資訊;

RMAN>list archivelog all;列出歸檔日誌備份集簡要資訊

4RMAN> list backup of spfile 列出SPFILE備份集;

5RMAN> list copy of datafile 5 列出資料檔案映像副本;

6RMAN> list copy of controlfile 列出控制檔案映像副本;

7RMAN> list copy of archivelog all 列出歸檔日誌映像副本;

8RMAN> list incarnation of database 列出對應物/列出資料庫副本;

9RMAN>list backup summary; 概述可用的備份;

B表示backup

F表示FULL

A表示archive log

0 1表示incremental backup

S說明備份狀態(AAVAILABLEX EXPIRED )

10RMAN>list backup by file 按備份型別列出備份;

按照資料檔案備份,歸檔日誌備份,控制檔案備份,伺服器引數檔案備份 列出

5CROSSCHECK命令:校驗備份資訊

1RMAN> crosscheck backup 核對所有備份集;

2RMAN> crosscheck backup of database 核對所有資料檔案的備份集;

3RMAN> crosscheck backup of tablespace users 核對特定表空間的備份集;

4RMAN> crosscheck backup of datafile 4 核對特定資料檔案的備份集;

5RMAN> crosscheck backup of controlfile 核對控制檔案的備份集;

6RMAN> crosscheck backup of spfile 核對SPFILE的備份集;

7RMAN> crosscheck backup of archivelog sequence 3 核對歸檔日誌的備份集;

8RMAN> crosscheck copy 核對所有映像副本;

9RMAN> crosscheck copy of database 核對所有資料檔案的映像副本;

10RMAN> crosscheck copy of tablespace users 核對特定表空間的映像副本;

11RMAN> crosscheck copy of datafile 6 核對特定資料檔案的映像副本;

12RMAN> crosscheck copy of archivelog sequence 4 核對歸檔日誌的映像副本;

13RMAN> crosscheck copy of controlfile 核對控制檔案的映像副本;

14RMAN> crosscheck backup tag='SAT_BACKUP';

15RMAN> crosscheck backup completed after 'sysdate - 2'

16RMAN> crosscheck backup completed between 'sysdate - 5' and 'sysdate -2 '

17RMAN> crosscheck backup device type sBT;

18RMAN> crosscheck archivelog all;

19RMAN> crosscheck archivelog like '%ARC00012.001'

20RMAN> crosscheck archivelog from sequence 12;

21RMAN> crosscheck archivelog until sequence 522;

6DELETE:刪除備份

1RMAN> delete obsolete; 刪除陳舊備份;

2RMAN> delete expired backup; 刪除EXPIRED備份

3RMAN> delete expired copy; 刪除EXPIRED副本;

4RMAN> delete backupset 19; 刪除特定備份集;

5RMAN> delete backuppiece ''d:backupDEMO_19.bak'' 刪除特定備份片;

6RMAN> delete backup 刪除所有備份集;

7RMAN> delete datafilecopy ''d:backupDEMO_19.bak'' 刪除特定映像副本;

8RMAN> delete copy 刪除所有映像副本;

9RMAN> delete archivelog all delete input;

RMAN> delete backupset 22 format = ''d:backup%u.bak'' delete input

在備份後刪除輸入物件;

10RMAN> delete backupset id;

7CHANGE命令: 改變備份集的狀態

1RMAN> change backupset 22 unavailable 改變備份集狀態;

2RMAN> change datafilecopy ''d:backupdemo_37.bak'' unavailable 改變映像副本狀態;

3RMAN> change backupset 156 keep forever logs 使備份集156永久保留;

4RMAN> change backupset 198 keep until ''sysdate+60'' logs 使備份集198保留60;

5RMAN> change backupset 156 nokeep 免除備份集156的保留期限;

6change backupset 117,118 delete;

7change backuppiece 1304 delete;

8change archivelog until logseq =544 delete;

8CONFIGURE命令

1顯示當前的配置資訊

1.01 RMAN> show all;

1.02查詢RMAN設定中非預設值:

SQL> select name,value from v$rman_configuration;

2.常用的configure選項

2.01儲存策略(retention policy)

configure retention policy to recovery window of 3 days;

configure retention policy to redundancy 3;

configure retention policy clear;

2.02備份最佳化backup optimization

configure backup optimization on;

configure backup optimization off;

configure backup optimization clear;

2.03預設裝置default device type

configure default device type to disk;

configure default device type to stb;

configure default device type clear;

2.04控制檔案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';

configrue snapshot controlfile name clear;

2.05並行數(通道數) device type disk|stb parallelism n;

configure device type disk|stb parallelism 2;

configure device type disk|stb clear;

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 1 device type disk maxpiecesize 100m

2.06生成備份副本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;

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';

2.07排除選項exclude

configure exclude for tablespace 'users';

configrue exclude clear;

2.08備份集大小maxsetsize

configure maxsetsize to 1G|1000M|1000000K|unlimited;

configure maxsetsize clear;

2.09其它選項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;


源文件 <http://blog.chinaunix.net/u/25176/showart_1329962.html>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1052536/,如需轉載,請註明出處,否則將追究法律責任。

相關文章