【DG】MAA-RAC to RAC ADG配置
一、 環境規劃
primary db name: ORCL
instance_name: ORCL1,ORCL2
standby db_unique_name: SBDB
instance_name: SBDB1,SBDB2
主庫RAC VIP: 172.16.70.172/173
SCAN-IP: 172.16.70.175
備庫RAC IP: 172.16.70.152/153
SCAN-IP: 172.16.70.154
二、 前提條件
ü 主庫RAC 處於歸檔模式
ü 主庫RAC 使用 ASM 例項
ü 備庫RAC 已經安裝完 GI ( Grid Infrastructure )、 ASM 例項, Oracle 資料庫軟體
ü 使用OMF ( Oracle Managed Files )命名格式
三、 思路清晰
step1: 主庫配置
step2: 主庫收集檔案、執行備份
step3: 主備庫配置 Oracle Net(listener.ora,tnsnames.ora)
step4: 建立備庫 instance 和 database
step5: 備庫開啟實時應用
step6: 確認 Data Guard 配置
四、 實施過程
1. 主庫配置
1) 主庫開啟force_logging
SQL> alter database force logging;
2) 主庫新增standby logfile
SQL> select group#,thread#,bytes/1024/1024 m,members,status from v$log;
SQL> alter database add standby logfile thread 1 group 5 size 50m ;
SQL> alter database add standby logfile thread 1 group 6 size 50m ;
SQL> alter database add standby logfile thread 1 group 7 size 50m ;
SQL> alter database add standby logfile thread 2 group 8 size 50m ;
SQL> alter database add standby logfile thread 2 group 9 size 50m ;
SQL> alter database add standby logfile thread 2 group 10 size 50m ;
(standby 日誌組應比每個節點多一組,大小保持一致)
3) 主庫修改pfile 引數
SQL> alter system set db_unique_name=ORCL scope= spfile sid='*' ;
SQL> alter system set log_archive_config='DG_CONFIG= ( ORCL ,SBDB) ' scope=both sid='*' ;
SQL> alter system set log_archive_dest_2='SERVICE= SBDB _STANDBY LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME= SBDB ' scope=both sid='*';
SQL> alter system set DB_FILE_NAME_CONVERT='+DATA/SBDB','+DATA/ORCL' scope=spfile sid='*';
SQL> alter system set LOG_FILE_NAME_CONVERT='+DATA/SBDB','+DATA/ORCL' scope=spfile sid='*';
SQL> alter system set standby_file_management=AUTO scope=both sid='*' ;
SQL> alter system set fal_ client =' ORCL_PRIMARY ' scope=both sid='*';
SQL> alter system set fal_server=' SBDB _STANDBY ' scope=both sid='*';
4) 重啟db ,使引數生效
(grid 使用者)
$ srvctl stop database -d ORCL
$ srvctl start database -d ORCL
2. 主庫收集檔案、執行備份
1) 主庫建立臨時資料夾
$ mkdir -p /home/oracle/temp
2) 備庫建立相同資料夾
$ mkdir -p /home/oracle/temp
3) 主庫建立pfile
SQL> create pfile='/home/oracle/temp/initORCL.ora' from spfile;
4) 主庫執行RMAN 備份,並將備份集放在 temp 目錄下
RMAN> backup format '/home/oracle/temp/db_arch_%U' database plus archivelog;
RMAN> backup format '/home/oracle/temp/control_%U' current controlfile for standby;
5) Oracle 使用者複製 tnsnames.ora 放在 temp 目錄下
$ cp $ORACLE_HOME/network/admin/ tnsnames .ora /home/oracle/temp/
6) grid 使用者複製 listener.ora 放在 temp 目錄下
$ cp $ORACLE_HOME/network/admin/listener.ora /home/oracle/temp/
7) 將temp 資料夾所有東西傳輸到備庫 temp 資料夾
$ scp /home/oracle/temp/* 172.16.70.150:/home/oracle/temp/
3. 配置listener.ora 和 tnsnames.ora
1) 備庫grid 使用者複製 listener.ora 到兩節點 $ORACLE_HOME/network/admin/ 下
2) 備庫兩節點修改listener.ora ,新增以下內容
(備庫 1 節點 )
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = SBDB )
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = SBDB1 )
)
)
(備庫 2 節點 )
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = SBDB )
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = SBDB2 )
)
)
開啟備庫監聽
( grid 使用者 )
$ srvctl stop listener
$ srvctl start listener
3) 主備庫兩節點修改tnsnames.ora
(Oracle 使用者)
主備庫(1&2 節點)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.70.175 )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
ORCL_PRIMARY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.70.173)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.70.174)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
SBDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.70.154 )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SBDB)
)
)
SBDB_STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.70.152 )(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.70.153 )(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SBDB)
)
)
4. 建立備庫instance 和 database
1) 備庫建立密碼檔案
(備庫1 節點)
$ cd /u01/app/oracle/product/11.2.0/db_1/dbs
$ orapwd file=orapwSBDB 1 password=oracle
(備庫2 節點)
$ cd /u01/app/oracle/product/11.2.0/db_1/dbs
$ orapwd file=orapwSBDB 2 password=oracle
2) 複製並且重新命名備庫pfile
(備庫1 節點)
$ cp /home/oracle/temp/initORCL.ora /u01/app/oracle/product/11.2.0/db_1/dbs/initSBDB.ora
3) 修改initSBDB.ora
執行以下命令:
$ vi initSBDB.ora
:%s# ORCL #AAAA#g
:%s# SBDB # ORCL #g
:%s#AAAA#SBDB#g
:%s#ORCL_PRIMARY#AAAA#g
:%s#SBDB_STANDBY#ORCL_PRIMARY#g
:%S#AAAA#SBDB_STANDBY#g
注意
db_name
修改回
ORCL
,主備庫的
db_name
應保持一致。
最後結果如下:
*.db_unique_name=SBDB
*.audit_file_dest='/u01/app/oracle/admin/SBDB/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.4.0'
*.control_files='+DATA/orcl/controlfile/current.260.1045841213'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_file_name_convert='+DATA/ORCL','+DATA/SBDB'
*.db_name=' ORCL '
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=SBDBXDB)'
*.fal_client='SBDB_STANDBY'
*.fal_server='ORCL_PRIMARY'
SBDB1.instance_number=1
SBDB2.instance_number=2
*.log_archive_config='DG_CONFIG=(SBDB,ORCL)'
*.log_archive_dest_1='LOCATION=+ARCH'
*.log_archive_dest_2='SERVICE=ORCL_PRIAMRY LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORCL'
*.log_archive_format='%t_%s_%r.dbf'
*.log_file_name_convert='+DATA/ORCL','+DATA/SBDB'
*.memory_target=3279945728
*.open_cursors=300
*.processes=150
*.remote_listener='cluster-scan-ip:1521'
*.remote_login_passwordfile='exclusive'
*.standby_file_management='AUTO'
SBDB2.thread=2
SBDB1.thread=1
SBDB1.undo_tablespace='UNDOTBS1'
SBDB2.undo_tablespace='UNDOTBS2'
4) 給備庫新增磁碟組目錄
(grid 使用者)
(備庫1 節點)
$ sqlplus / as sysasm
SQL> alter diskgroup DATA add directory'+DATA/SBDB';
5) 備庫建立spfile
(Oracle 使用者)
(備庫1 節點)
SQL> create spfile='+DATA/SBDB/spfileSBDB.ora' from pfile='?/dbs/initSBDB.ora';
6) 備庫兩節點建立pfile
(備庫1 節點)
$ cd $ORACLE_HOME/dbs/
$ echo "SPFILE='+DATA/SBDB/spfileSBDB.ora'" > initSBDB1.ora
(備庫2 節點)
$ cd $ORACLE_HOME/dbs/
$ echo "SPFILE='+DATA/SBDB/spfileSBDB.ora'" > initSBDB 2 .ora
7) 備庫兩節點建立目錄
$ mkdir -p /u01/app/oracle/admin/SBDB/adump
8) 備庫開啟到nomount 狀態
(備庫1 節點)
$ export ORACLE_SID=SBDB1
$ sqlplus / as sysdba
SQL> startup nomount;
9) 備庫進行RMAN 複製
(備庫1 節點)
$ export ORACLE_SID=SBDB1
$ rman target sys/oracle@ORCL auxiliary /
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Jul 16 15:28:59 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1573621948)
connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database for standby;
注:對於11g 和以後的版本,我們可以使用以下命令:
RMAN> duplicate target database for standby from avtive database;
5. 備庫開啟實時應用
1) 備庫查詢database 狀態
SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;
2) 備庫開啟實時應用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
3) 備庫取消實時應用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;
4) 開啟備庫
SQL> alter database open read only;
5) 備庫再次開啟實時應用
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
6) 開啟備庫2 節點
SQL> startup;
7) 將SBDB 新增到 GI 中( Oracle 使用者)
$ srvctl add database -d SBDB -o /u01/app/oracle/product/11.2.0/db_1
$ srvctl add instance -d SBDB -i SBDB1 -n rac1
$ srvctl add instance -d SBDB -i SBDB2 -n rac2
6. 確定Dataguard 配置
1) 備庫查詢
SQL> select sequence#, first_time, next_time
from v$archived_log order by sequence#;
2) 主庫切換日誌
SQL> alter system archive log current;
3) 備庫再次查詢
SQL> select sequence#, first_time, next_time
from v$archived_log order by sequence#;
--------- end ----------
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31529886/viewspace-2705427/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle ADG與DG的區別Oracle
- DG:11.2.0.4 RAC線上duplicate恢復DG
- Oracle RAC+DG搭建Oracle
- Oracle搭建rac到單庫的adgOracle
- 【DG】Oracle 19c使用dbca來搭建物理DG--主rac備racOracle
- RAC+DG(asm單例項)ASM單例
- ORACLE19C RAC+DGOracle
- Oracle RAC DG手動切換Oracle
- 11G RAC+DG搭建
- 一步一步搭建11gR2 rac+dg之配置單例項的DG(八)單例
- ORACLE RAC+DG調整redo大小Oracle
- CentOS 7.3 ECS上搭建RAC 18c+單例項DG+EMCC+DG的FSFO快速故障轉移配置CentOS單例
- ORACLE RAC TO RAC DG搭建過程中可能遇到的問題Oracle
- oracle rac+adg調整redo日誌組導致adg備庫ogg抽取程式abendOracle
- Oracle RAC+DG 表空間擴容Oracle
- RAC+單例項DG的切換單例
- DG搭建配置方案
- Oracle RAC+DG 調整redo/standby log fileOracle
- 【DG】dg中如何配置多個後臺observerServer
- Oracle DG管理Broker配置Oracle
- oracle rac dg庫報錯ORA-01031: insufficient privilegesOracle
- 單例項Primary快速搭建Standby RAC參考手冊(19.16 ADG)單例
- oracle RAC+DG 擴容ASM和表空間(Linux)OracleASMLinux
- Oracle RAC+DG巡檢常見問題彙總(一)Oracle
- RAC之多路徑配置
- Oracle DG Broker配置的管理週期Oracle
- Windows 11.2.0.4 RAC安裝配置以及RAC新增節點Windows
- 【DBA Part03】國產Linux上Oracle RAC安裝-升級-ADG-遷移LinuxOracle
- Oracle RAC+ADG新增資料檔案失敗處理(db_create_file_dest)Oracle
- oracle RAC手動配置互信Oracle
- RAC之作業系統配置作業系統
- RAC主機配置ssh互信
- 華為多路徑配置RAC
- 防火牆在RAC上的配置防火牆
- DG配置過程中的引數解釋
- Oracle DG 管理Broker配置成員的狀態Oracle
- oracle 11g dg broker開啟和配置Oracle
- [20190107]12c以上版本配置dg注意.txt