oracle rman catalog
建立使用帶catalog的rman
大致步驟
1、 設定歸檔模式
2、 建立rman使用的表空間,建議300m
3、 建立rman使用的使用者並授權
4、 備份控制檔案,
alter database backup controlfile to trace
create pfile from spfile;
alter system set log_archive_dest_1='location=/archiverman' scope=spfile;
shutdown
startup mount
alter database archivelog;
alter database open;
create tablespace tbs_rman datafile '/opt/oracle/oradata/dba/tbs_rman.dbf' size 230m;
create user rman identified by rman default tablespace tbs_rman temporary tablespace temp;
grant recovery_catalog_owner to rman;
alter user rman quota unlimited on tbs_rman;
select * from session_privs;
select * from seesion_roles;
rman catalog
create catalog tablespace tbs_rman;
connect target
register database;
list backuoset; /*檢視備份集
list incarnation /*檢視化身
report schema; /*檢視庫結構
crosscheck backupset; /*檢視備份的有效性,EXPIRED
delete expired backupset;/*刪除過期的備份集
crosscheck copy; /*檢查copy
delete expired copy; /*刪除過期的copy
validate backupset; /*檢驗備份集是否能用。
delete expired backupset /*刪除過期的備份
crosscheck copy of archivelog all;
show all;
RMAN> configure controlfile autobackup on;
rman 可以做full,增量備份,備份單獨資料檔案等功能。
fullbackup 1
run{
2> allocate channel d1 device type disk; format'/opt/oracle/spfile.bak';
3> backup as compressed backupset
4> format '/opt/oracle/oradata/bak/full_%d%U'
5> tag='fullbak' including current controlfile;
6> channel=d1
7> database plus archivelog delete input;
8> }
fullbackup 2
RMAN> run {
2> allocate channel d1 device type disk;
3> backup as compressed backupset
4> format '/opt/oradata/oradata/rman/full_%d%U'
5> tag='fullbak'
6> channel=d1
7> database plus archivelog delete input;
8> }
incremental level=0
RMAN> run{
2> allocate channel d1 device type disk;
3> backup as compressed backupset
4> format='/opt/oradata/oradata/inc1_%d_%U'
5> tag='inc0'
6> incremental level=0
7> database;
8> }
bakcup datafile
RMAN> run{
2> allocate channel d1 device type disk;
3> backup as compressed backupset
4> format='/opt/oradata/oradata/df_%d_%U'
5> tag='dfile'
6> channel=d1
7> datafile 1;
8> }
backup arch from scn
run{
allocate channel d1 device type disk;
backup
format='/opt/oradtata/oradata/arch_%d_%U'
tag='arch'
channel=d1
archivelog from scn 1219672 ;
}
copy database
run{
allocate channel d1 device type disk;
backup as copy
format='/opt/oradata/oradata/copy_%d_%U'
tag='copybak'
database;
}
恢復規則:
nomount狀態:controlfile,all database file
mount狀態:system tablespace& online redo log file
mount、open狀態:non-system tbs & undo tbs
1、模擬丟失一個非system資料檔案。
刪除資料檔案,在資料庫裡alter database dataifle 4 online; 在rman 裡 report schema 可以看到file id
在rman裡輸入命令去恢復:
run{
allocate channel d1 devcie type disk;
sql "alter database datafile 4 offline"; ### 不執行這個,就會報獨佔錯誤。
restore datafile 4;
recover dataifle 4;
sql "alter database datafile 4 online";
}
2 模擬丟失undo資料檔案(undo不能offline,read-only)
sqlplus :
alter database offline;
alter database online;
rman:
run{
allocate channel d1 device type disk;
restore datafile 2;
recover datafile 2;
}
sql:select * from v$datafile;
recover datafile 2;
3 模擬系統表空間丟失:
首先把資料庫切換到mount狀態:
sql>startup mount force;
rman>run{
allocate channel d1 device type disk;
restore datafile 1;
recover datafile 1;
sql "alter database open";
}
4 控制檔案丟失:
sql:startup nomount force;
rman
run{
allocate channel d1 device type disk;
restore controlfile;
sql "alter database mount";
recover database;
sql "alter database open noresetlogs";
}
一個可以自動執行的指令碼:
[oracle@rac01 ~]$ ls
database fullbak.rcv full.sh
[oracle@rac01 ~]$ more full.sh
export ORACLE_BASE=/u01
export ORACLE_HOME=/u01/app/oracle
export ORACLE_SID=rac01
rman cmdfile = /home/oracle/fullbak.rcv
[oracle@rac01 ~]$ more fullbak.rcv
connect target /
run{
allocate channel d1 device type disk;
backup as compressed backupset
format '/u01/oradata/full_%d%U'
tag='fullbak'
channel=d1
database plus archivelog delete input;
}
[oracle@rac01 ~]$
大資料量的資料庫可能會碰到這樣的問題:由於某些原因造成本來該早上8點之前完成的備份沒有完成,結果造成正常業務造成很大影響。但是又不可能每天晚上看著本該自動執行的備份。
剛剛發現,原來rman有個duration引數可以使rman在指定時間無論完成與否都中止備份。
引用官方文件裡的例子:
For example, run the following command at 2:00 a.m. to specify that the backup
should run until 6:00 a.m.:
BACKUP
DURATION 4:00
TABLESPACE users;
繼續擴充套件 引數paptial和filesperset
BACKUP
DURATION 4:00 PARTIAL
TABLESPACE users
FILESPERSET 1;
上面的例子指定:每個檔案對應備份集,並且4小時備份如果沒有完成rman不會提示錯誤,而是提示哪個檔案還沒有備份,這樣一來可以手動將未備份的檔案重新備份。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/309902/viewspace-1048138/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【Oracle】rman upgrade catalogOracle
- upgrade oracle rman catalogOracle
- Oracle 備份恢復篇之RMAN catalogOracle
- 揭秘ORACLE備份之----RMAN之五(CATALOG)Oracle
- oracle實驗記錄 (恢復-rman catalog)Oracle
- rman catalog 命令所能catalog 的物件物件
- rman 建立catalog庫
- RMAN - catalog start with命令
- Oracle RMAN練習繼續,簡單涉及CatalogOracle
- 揭祕ORACLE備份之----RMAN之五(CATALOG)Oracle
- 【RMAN】catalog資料庫資料庫
- rman中的catalog命令!
- Oracle Rman Catalog的建立方法和備份原理Oracle
- Oracle RMAN備份中catalog和nocatalog區別Oracle
- Oracle OCP IZ0-053 Q695(Rman catalog)Oracle
- Oracle OCP IZ0-053 Q620(Rman Catalog)Oracle
- Oracle OCP IZ0-053 Q251(Rman Import Catalog)OracleImport
- Oracle OCP 1Z0-053 Q6(RMAN Import Catalog)OracleImport
- Oracle OCP IZ0-053 Q241(RMAN Recovery Catalog Keep)Oracle
- Oracle OCP IZ0-053 Q312(RMAN Catalog)Oracle
- RMAN Catalog 學習與測試
- RMAN中catalog和nocatalog區別
- RMAN Catalog 和 Nocatalog 的區別
- RMAN備份 建立catalog資料庫資料庫
- 使用RMAN恢復目錄(catalog)解析
- 建立RMAN catalog實現物理備份
- Oracle OCP IZ0-053 Q311(Rman catalog stored scripts)Oracle
- Oracle OCP 1Z0-053 Q337(Rman Catalog Start with)Oracle
- oracle10g_rman_syntax testing_upgrade catalog_transport tablespaceOracle
- RMAN 11g Import catalog fails RMAN-6429 (Doc ID 457392.1)ImportAI
- rman catalog的配置及詳解例項
- 基於catalog 建立RMAN儲存指令碼指令碼
- 說說10g rman的catalog命令
- 使用Catalog命令註冊RMAN備份集
- RMAN說,我能備份(18)--RMAN中的加密備份和CATALOG加密
- rman建立catalog過程及問題處理
- oracle 之catalog 學習Oracle
- rman連線catalog註冊資料庫問題資料庫