Oracle Data Guard創建物理Standby數據庫
創建物理備庫
機器名 a1 a2
IP: 192.168.1.10 192.168.1.20
Net_Name a1 a2
SID a1 a2
DB_UNIQUE_NAME a1 a2
注:主節點上創建數據庫a1,備節點上只安裝oracle軟件不創建任何數據庫;
1.配置listener.ora
主節點listener.ora:
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=a1)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=a1)
)
)
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))
)
備節點listener.ora:
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=a1)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=a1)
)
)
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.20)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))
)
2.配置tnsnames.ora(主備節點的tnsname.ora內容一樣:)
a1=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = a1)
)
)
a2=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = a2)
)
)
3.在主庫啟用歸檔並且啟用強制歸檔
步驟1:alter database force logging;
archive log list;
步驟2:在mount狀態下
alter database archivelog;
步驟3:alter database open;
archive log list;
4.在主庫上創建密碼文件
orapwd file='/u01/app/oracle/product/11.2.0/db_1/dbs/orapwa1.ora' password=xyc entries=10
5.創建standby redo log
alter database add standby logfile
group 4 ('/u01/app/oracle/oradata/a1/standby_redo04a.log','/u01/app/oracle/oradata/a1/standby_redo04b.log') size 50m,
group 5 ('/u01/app/oracle/oradata/a1/standby_redo05a.log','/u01/app/oracle/oradata/a1/standby_redo05b.log') size 50m,
group 6 ('/u01/app/oracle/oradata/a1/standby_redo06a.log','/u01/app/oracle/oradata/a1/standby_redo06b.log') size 50m,
group 7 ('/u01/app/oracle/oradata/a1/standby_redo07a.log','/u01/app/oracle/oradata/a1/standby_redo07b.log') size 50m;
注意:Oracle 建議你在創建 standby 時就考慮 standby redolog 配置的問題。standby redologs 與 online redologs
非常類似,應該說兩者只是服務對象不同,其它參數屬性甚至操作的命令格式幾乎都一樣,你在設計 standby
redologs 的時候完全可以借鑒創建 online redologs 的思路,比如多個文件組啦,每組多個文件冗余之類的。
除些之外呢,oracle 提供了一些標准的建議如下: