利用RMAN 建立Oracle9i RAC Data Guard (updated)
利用RMAN 建立Oracle9i RAC Data Guard
整理: 王琦
2006-09-22
相關術語解釋:
目標伺服器: target , 需要被備份的原數據庫伺服器.這裡指primary database 伺服器 .
目錄伺服器: catalog , 儲存備份資訊的目錄伺服器, 這裡指data guard 伺服器 .
1. RMAN伺服器的配置:
以下在Dataguard Server (目錄伺服器)上配置.
1.0 建立RMAN資料庫(比如SID=RMAN) .
1.1 建立RMAN使用者表空間(表空間大小設定為500m左右即可) .
create tablespace rman_data
datafile '/u01/data/rman_data1.dbf' size 500M
extent management local uniform size 5M ;
1.2 建立RMAN使用者:
create user rman identified by rman
default tablespace rman_data
temporary tablespace temp ;
1.3 給RMAN使用者授於相關係統許可權:
grant resource, connect, recovery_catalog_owner to rman;
1.4 在Dataguard Server(目錄伺服器)上設定tnsnames.ora 用於連target伺服器(Primary DB) .
tnsnames.ora 檔案中加入以下內容:
DELL_RAC1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.161.8.71)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
(INSTANCE_NAME = orcl1)
)
)
1.5 連接目標伺服器與CATALOG伺服器. (在Dataguard Server上的RMAN資料庫上操作)
rman target sys/oracle@dell_rac1 catalog rman/rman(user/password必須為目標伺服器上的擁有sysdba許可權的使用者.如:sys)
1.6 在目標伺服器上建立CATALOG 目錄.
CREATE CATALOG
1.7 在CATALOG伺服器上註冊目標伺服器.
REGISTER DATABASE;
到這裡,RMAN備份環境已經準備好了,幷已連接至目標與目錄伺服器.
2. 建立Data Guard
2.1 COPY目標伺服器上(Primary DB Server)的初始化參數檔案及密碼檔案到Data Guard相對應目錄.
2.2 使用RMAN的Image copy複製目標伺服器上的.DBF檔案至Data Guard相應目錄.(見後面的詳細介紹) .
2.2.1 使用REPORT SCHEMA可列出將要複製的所有目標數據庫上的數據檔案.
2.2.2 使用下面的SQL生成所有數據檔案的copy指令碼.
SELECT 'datafile '||''''||name||''''||' to '||''''||'/data'||name||''''||',' FROM v$datafile; 或者
SELECT 'datafile '||''''||name||''''||' to '||''''||name||''''||',' FROM v$datafile;
RMAN IMAGE COPY指令碼:
RUN {
ALLOCATE CHANNEL XXXXX DEVICE TYPE DISK;
COPY
...........,
…..----- 這裡放入上面SQL生成的指令碼 .
……… ;
RELEASE CHANNEL XXXX;}
指令碼例子 (如果在Data Guard Server上檔案路徑有變化, 即與Primary DB上路徑不一樣, 我們會在生成控制檔案後, 在Data Guard DB上Mount狀態下使用 alter database rename file 更改數據檔案路徑, 指令碼中前面的檔案路徑表示Primary DB上的路徑, 後面的路徑表示Data Guard Server上的檔案路徑 ) .
以下指令碼例子中的 /backup目錄是dataguard上的/data目錄影射到Primary DB上的Mount點Label (詳細的nfs mount見後面的nfs mount介紹) .
RUN {
ALLOCATE CHANNEL XXXX DEVICE TYPE DISK;
COPY
datafile '/ocfs_arch2/orcldbf/log_data10.dbf' to '/backup/ocfs_arch2/orcldbf/log_data10.dbf',
datafile '/ocfs_arch2/orcldbf/log_index9.dbf' to '/backup/ocfs_arch2/orcldbf/log_index9.dbf',
datafile '/ocfs_arch2/orcldbf/sn_data16.dbf' to '/backup/ocfs_arch2/orcldbf/sn_data16.dbf',
datafile '/ocfs_arch2/orcldbf/sn_data17.dbf' to '/backup/ocfs_arch2/orcldbf/sn_data17.dbf',
datafile '/ocfs_arch2/orcldbf/sn_data18.dbf' to '/backup/ocfs_arch2/orcldbf/sn_data18.dbf',
datafile '/ocfs_arch2/orcldbf/sn_data19.dbf' to '/backup/ocfs_arch2/orcldbf/sn_data19.dbf',
datafile '/ocfs_arch2/orcldbf/sn_data20.dbf' to '/backup/ocfs_arch2/orcldbf/sn_data20.dbf',
datafile '/ocfs_arch2/orcldbf/sn_data21.dbf' to '/backup/ocfs_arch2/orcldbf/sn_data21.dbf',
datafile '/ocfs_arch2/orcldbf/sn_idx13.dbf' to '/backup/ocfs_arch2/orcldbf/sn_idx13.dbf',
datafile '/ocfs_arch2/orcldbf/sn_idx14.dbf' to '/backup/ocfs_arch2/orcldbf/sn_idx14.dbf',
datafile '/ocfs_arch2/orcldbf/sn_idx15.dbf' to '/backup/ocfs_arch2/orcldbf/sn_idx15.dbf',
datafile '/ocfs_arch2/orcldbf/sn_idx17.dbf' to '/backup/ocfs_arch2/orcldbf/sn_idx17.dbf',
datafile '/ocfs_arch2/orcldbf/sn_idx18.dbf' to '/backup/ocfs_arch2/orcldbf/sn_idx18.dbf',
datafile '/ocfs_data/orcl/cwmlite01.dbf' to '/backup/ocfs_data/orcl/cwmlite01.dbf',
datafile '/ocfs_data/orcl/drsys01.dbf' to '/backup/ocfs_data/orcl/drsys01.dbf',
datafile '/ocfs_data/orcl/example01.dbf' to '/backup/ocfs_data/orcl/example01.dbf',
datafile '/ocfs_data/orcl/ict_data1.dbf' to '/backup/ocfs_data/orcl/ict_data1.dbf',
datafile '/ocfs_data/orcl/ict_data2.dbf' to '/backup/ocfs_data/orcl/ict_data2.dbf',
datafile '/ocfs_data/orcl/ict_data3.dbf' to '/backup/ocfs_data/orcl/ict_data3.dbf',
datafile '/ocfs_data/orcl/ict_data4.dbf' to '/backup/ocfs_data/orcl/ict_data4.dbf',
datafile '/ocfs_data/orcl/indx01.dbf' to '/backup/ocfs_data/orcl/indx01.dbf',
datafile '/ocfs_data/orcl/log_data1.dbf' to '/backup/ocfs_data/orcl/log_data1.dbf',
datafile '/ocfs_data/orcl/log_data2.dbf' to '/backup/ocfs_data/orcl/log_data2.dbf',
datafile '/ocfs_data/orcl/log_data3.dbf' to '/backup/ocfs_data/orcl/log_data3.dbf',
datafile '/ocfs_data/orcl/log_data4.dbf' to '/backup/ocfs_data/orcl/log_data4.dbf',
datafile '/ocfs_data/orcl/log_data5.dbf' to '/backup/ocfs_data/orcl/log_data5.dbf',
datafile '/ocfs_data/orcl/log_data6.dbf' to '/backup/ocfs_data/orcl/log_data6.dbf',
datafile '/ocfs_data/orcl/log_data7.dbf' to '/backup/ocfs_data/orcl/log_data7.dbf',
datafile '/ocfs_data/orcl/log_data8.dbf' to '/backup/ocfs_data/orcl/log_data8.dbf',
datafile '/ocfs_data/orcl/log_data9.dbf' to '/backup/ocfs_data/orcl/log_data9.dbf',
datafile '/ocfs_data/orcl/sn_data1.dbf' to '/backup/ocfs_data/orcl/sn_data1.dbf',
datafile '/ocfs_data/orcl/sn_data10.dbf' to '/backup/ocfs_data/orcl/sn_data10.dbf',
datafile '/ocfs_data/orcl/sn_data11.dbf' to '/backup/ocfs_data/orcl/sn_data11.dbf',
datafile '/ocfs_data/orcl/sn_data12.dbf' to '/backup/ocfs_data/orcl/sn_data12.dbf',
datafile '/ocfs_data/orcl/sn_data13.dbf' to '/backup/ocfs_data/orcl/sn_data13.dbf',
datafile '/ocfs_data/orcl/sn_data14.dbf' to '/backup/ocfs_data/orcl/sn_data14.dbf',
datafile '/ocfs_data/orcl/sn_data15.dbf' to '/backup/ocfs_data/orcl/sn_data15.dbf',
datafile '/ocfs_data/orcl/sn_data2.dbf' to '/backup/ocfs_data/orcl/sn_data2.dbf',
datafile '/ocfs_data/orcl/sn_data3.dbf' to '/backup/ocfs_data/orcl/sn_data3.dbf',
datafile '/ocfs_data/orcl/sn_data4.dbf' to '/backup/ocfs_data/orcl/sn_data4.dbf',
datafile '/ocfs_data/orcl/sn_data5.dbf' to '/backup/ocfs_data/orcl/sn_data5.dbf',
datafile '/ocfs_data/orcl/sn_data6.dbf' to '/backup/ocfs_data/orcl/sn_data6.dbf',
datafile '/ocfs_data/orcl/sn_data7.dbf' to '/backup/ocfs_data/orcl/sn_data7.dbf',
datafile '/ocfs_data/orcl/sn_data8.dbf' to '/backup/ocfs_data/orcl/sn_data8.dbf',
datafile '/ocfs_data/orcl/sn_data9.dbf' to '/backup/ocfs_data/orcl/sn_data9.dbf',
datafile '/ocfs_data/orcl/system01.dbf' to '/backup/ocfs_data/orcl/system01.dbf',
datafile '/ocfs_data/orcl/tools01.dbf' to '/backup/ocfs_data/orcl/tools01.dbf',
datafile '/ocfs_data/orcl/track_data1.dbf' to '/backup/ocfs_data/orcl/track_data1.dbf',
datafile '/ocfs_data/orcl/track_data2.dbf' to '/backup/ocfs_data/orcl/track_data2.dbf',
datafile '/ocfs_data/orcl/track_data3.dbf' to '/backup/ocfs_data/orcl/track_data3.dbf',
datafile '/ocfs_data/orcl/track_data4.dbf' to '/backup/ocfs_data/orcl/track_data4.dbf',
datafile '/ocfs_data/orcl/track_data5.dbf' to '/backup/ocfs_data/orcl/track_data5.dbf',
datafile '/ocfs_data/orcl/track_data6.dbf' to '/backup/ocfs_data/orcl/track_data6.dbf',
datafile '/ocfs_data/orcl/track_data7.dbf' to '/backup/ocfs_data/orcl/track_data7.dbf',
datafile '/ocfs_data/orcl/track_data8.dbf' to '/backup/ocfs_data/orcl/track_data8.dbf',
datafile '/ocfs_data/orcl/undotbs01.dbf' to '/backup/ocfs_data/orcl/undotbs01.dbf',
datafile '/ocfs_data/orcl/undotbs01_1.dbf' to '/backup/ocfs_data/orcl/undotbs01_1.dbf',
datafile '/ocfs_data/orcl/undotbs02.dbf' to '/backup/ocfs_data/orcl/undotbs02.dbf',
datafile '/ocfs_data/orcl/undotbs02_1.dbf' to '/backup/ocfs_data/orcl/undotbs02_1.dbf',
datafile '/ocfs_data/orcl/undotbs02_2.dbf' to '/backup/ocfs_data/orcl/undotbs02_2.dbf',
datafile '/ocfs_data/orcl/users01.dbf' to '/backup/ocfs_data/orcl/users01.dbf',
datafile '/ocfs_data/orcl/xdb01.dbf' to '/backup/ocfs_data/orcl/xdb01.dbf',
datafile '/ocfs_data2/orcl/ict_data07.dbf' to '/backup/ocfs_data2/orcl/ict_data07.dbf',
datafile '/ocfs_data2/orcl/ict_data08.dbf' to '/backup/ocfs_data2/orcl/ict_data08.dbf',
datafile '/ocfs_data2/orcl/ict_data09.dbf' to '/backup/ocfs_data2/orcl/ict_data09.dbf',
datafile '/ocfs_data2/orcl/ict_data10.dbf' to '/backup/ocfs_data2/orcl/ict_data10.dbf',
datafile '/ocfs_data2/orcl/ict_data11.dbf' to '/backup/ocfs_data2/orcl/ict_data11.dbf',
datafile '/ocfs_data2/orcl/ict_data12.dbf' to '/backup/ocfs_data2/orcl/ict_data12.dbf' ;
RELEASE CHANNEL XXXX;}
在 Copy datafile `/ocfs_data/orcl/xx.dbf' to `/backup/ocfs_data/orcl/xx.dbf'中.
第一個`/ocfs_data/orcl/xx.dbf'是目標伺服器的數據檔案地址. `/backup/ocfs_data/orcl/xx.dbf 是掛載到目標伺服器上的dataguard的相應目錄.
假設指令碼檔案儲存為 rman.txt 檔案 .
說明:
需要先將將要成為dataguard伺服器的檔案存放目錄使用NFS映像至目標伺服器(Primary DB Server ) 相關目錄.
具體步驟如下:
Linux下NFS的配置
2.3. NFS server端(在此處為Data Guard伺服器)及客戶端(Primary DB Server)設定:
2.3.1 在/etc/exports 釋出掛載的目錄.
如: /data *(rw,no_root_squash)
/data為data guard server上分享的目錄,*表示允許任何主機分享,rw,no_root_squash為參數
代表意義如下:
rw: 可讀寫的許可權
ro: 只讀的許可權
no_root_squash: 登入 NFS 主機使用分享目錄的使用者,如果是 root 的話,那麼對於這個分享的目錄來說,他就具有 root 的許可權!
root_squash: 在登入 NFS 主機使用分享之目錄的使用者如果是 root 時,那麼這個使用者的許可權將被壓縮成為匿名使用者.
2.3.2 在Data Gurad DB Server上啟動兩個相關服務
#/etc/rc.d/init.d/portmap start (or:#service portmap start)
#/etc/rc.d/init.d/nfs start (or:#service nfs start)
2.3.3. NFS客戶端的設定(TARGET伺服器, 即Primary database Server )
不用其它設定,直接掛載就可以了
#mount -t nfs dataguard_server_ip:/directory /mountpoint
/mountpoint 為Primary Database Server上的掛載點 .
如:
mount -t nfs 10.161.8.83:/data /backup
在Copy datafile
`/ocfs_data/orcl/xx.dbf' to `/backup/ocfs_data/orcl/xx.dbf'中.
第一個`/ocfs_data/orcl/xx.dbf'是目標伺服器的數據檔案地址. `/backup/ocfs_data/orcl/xx.dbf 是掛載到目標伺服器上的dataguard的相應目錄.
2.4在目錄伺服器(Data Guard Server) RMAN環境下執行以上的指令碼
先rman連接目標伺服器與目錄伺服器 .
rman target sys/oracle@intel_rac1 catalog rman/rman(user/password必須為目標伺服器上的擁有sysdba許可權的使用者.如:sys)
RMAN > @rman.txt
copy數據檔案完成後,在目標伺服器建立STANDBY CONTROLFILE
ALTER DTABASE CREATE STANDBY CONTROLFILE AS '..........'
2.5 COPY目標伺服器歸檔日誌至DATAGUARD.
2.6 RECOVER STANDBY DATATABASE.
2.7 測試DATAGUARD能否切換至只讀模式
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-84452/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- 2 開始實用 Oracle Data GuardOracle
- Oracle Data Guard Broker元件Oracle元件
- Oracle Data Guard簡介Oracle
- 單機搭建Data Guard
- RMAN Duplicate RAC to Single Instance
- Oracle9i RMAN 的優缺點及RMAN 備份及恢復步驟Oracle
- bd_ticket_guard_client_dataclient
- Oracle Data Guard和Broker概述Oracle
- 【DG】Data Guard搭建(physical standby)
- 1 關於 Oracle Data GuardOracle
- 2 Oracle Data Guard 安裝Oracle
- 1 Oracle Data Guard Broker 概念Oracle
- Bd-Ticket-Guard-Client-Data逆向client
- 8 Oracle Data Guard Broker 屬性Oracle
- 9 Oracle Data Guard 故障診斷Oracle
- oracle手工建庫後rman無法啟用(RMAN-04015)Oracle
- oracle 11g data guard維護Oracle
- 4.1.6 Oracle Restart 與 Oracle Data Guard 整合OracleREST
- 【DATAGUARD】Oracle19c Data Guard BrokerOracle
- 19 Oracle Data Guard 相關檢視Oracle
- Oracle 11G RAC複製備庫RMAN-03002 RMAN-05501 RMAN-03015 RMAN-03009 RMAN-10038Oracle
- Oracle 12c 使用RMAN搭建物理備庫(RAC to RAC)Oracle
- Data Guard備庫日誌的實時應用與非實時應用
- 6 Oracle Data Guard Protection Modes 保護模式Oracle模式
- 【DG】Data Guard主備庫Failove切換AI
- 【DG】Data Guard主備庫Switchover切換
- 15 Oracle Data Guard Scenarios 保護場景OracleiOS
- A Oracle Data Guard Broker 升級和降級Oracle
- 【ASK_ORACLE】Oracle Data Guard(一)DG架構Oracle架構
- Oracle 12.2 How to Generate AWRs in Active Data Guard Standby DatabasesOracleDatabase
- Oracle Data Guard Feature 12cR2系列(二)Oracle
- Oracle Data Guard Feature 12cR2系列(一)Oracle
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another NoRESTDatabase
- 使用Broker管理Data Guard——停用、改保護模式等模式
- [20221111]19c配置Data Guard Broker問題.txt
- 18 與Oracle Data Guard 相關的SQL語句OracleSQL
- 需要了解的Data Guard理論知識(一)
- 需要了解的Data Guard理論知識(二)