RMAN遠端複製搭建物理DG過程小結
本文僅記錄搭建的過程,具體詳細的引數意義和配置原理請參考之前的總結
http://blog.itpub.net/29320885/viewspace-1093746/
搭建環境前配置主備庫的tns,確保兩資料庫能正常彼此通訊
primary
確定資料庫開啟強制歸檔
startup mount;
alter database archivelog;
alter database force logging;
alter database open;
修改配置,並匯出pfile,將pfile複製到目標備庫
alter system set db_unique_name=pri scope=spfile;
alter system set log_archive_config = 'DG_CONFIG=(pri,sty)' scope=spfile;
alter system set log_archive_dest_1 = 'LOCATION=/opt/app/oracle/product/11.2.0/dbhome_1/dbs/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=pri' scope=spfile;
alter system set log_archive_dest_2 = 'SERVICE=sty LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sty' scope=spfile;
alter system set log_archive_dest_state_1 = ENABLE;
alter system set log_archive_dest_state_2 = ENABLE;
alter system set fal_server=sty scope=spfile;
alter system set fal_client=pri scope=spfile;
alter system set standby_file_management=AUTO scope=spfile;
create pfile='/home/oracle/pripfile.ora' from spfile;
standby
安裝資料庫軟體,無需安裝資料庫
複製元庫的sys密碼檔案,確保兩庫的密碼一致
scp 192.168.20.46:$ORACLE_HOME/dbs/orapwxtttestdb $ORACLE_HOME/dbs/
複製目標庫匯出的pfile,並新增 *.log_file_name_convert引數選項(10g之後必須新增,即使路徑沒有改變)
scp 192.168.20.46:/home/oracle/pripfile.ora /home/oracle/
*.log_file_name_convert='/opt/app/oracle/oradata/xtttestdb/','/opt/app/oracle/oradata/xtttestdb/'
建立要恢復備庫的必要目錄
mkdir -p /opt/app/oracle/admin/xtttestdb/adump
mkdir -p /opt/app/oracle/oradata/xtttestdb
mkdir -p /opt/app/oracle/product/11.2.0/dbhome_1/dbs/arch
設定SID登入資料庫
export $ORACLE_SID=xtttestdb
sqlplus / as sysdba
利用copy並修改後的pfile建立spfile,並啟動到nomount
SQL> create spfile from pfile='/home/oracle/pripfile.ora';
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size 2213696 bytes
Variable Size 1174407360 bytes
Database Buffers 385875968 bytes
Redo Buffers 7512064 bytes
修改備庫的引數配置
alter system set db_unique_name=sty scope=spfile;
alter system set log_archive_config='DG_CONFIG=(pri,dg)' scope=spfile;
alter system set log_archive_dest_1 ='LOCATION=/opt/app/oracle/product/11.2.0/dbhome_1/dbs/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=sty' scope=spfile;
alter system set log_archive_dest_2 ='SERVICE=pri LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=pri' scope=spfile;
alter system set fal_server=pri scope=spfile;
alter system set fal_client=sty scope=spfile;
重啟資料庫到nomount,是配置生效(這些配置也可以在pfile中修改完成後再啟動資料庫庫)
SQL> shutdown immediate;
SQL> startup mount;
primary利用rman複製資料庫
rman target sys/ auxiliary sys/
RMAN> duplicate target database for standby from active database nofilenamecheck;
複製完成後在主備庫天劍standby redo(至少要三組)
alter database add standby logfile
group 4 ('/opt/app/oracle/oradata/xtttestdb/styredo04.log') size 50m,
group 5 ('/opt/app/oracle/oradata/xtttestdb/styredo05.log') size 50m,
group 6 ('/opt/app/oracle/oradata/xtttestdb/styredo06.log') size 50m,
group 7 ('/opt/app/oracle/oradata/xtttestdb/styredo07.log') size 50m;
啟動standby的redo應用的兩種方式
①、預設的物理DG啟動應用後,在主庫arch日誌被完整寫入後才會開始應用該arch log
SQL> alter database recover managed standby database disconnect from session;
②、可以新增current logfile引數,使得應用當前正在讀寫,還沒有完成歸檔的日誌
SQL> alter database recover managed standby database using current logfile disconnect from session;
關閉REDO應用
SQL> alter database recover managed standby database cancel;
檢視standby log狀態
select group#,thread#,sequence#,archived,status from v$standby_log;
檢視應用日誌情況
select name,creator,sequence#,applied,completion_time from v$archived_log;
驗證:
primary端建立測試表,並新增資料
SQL> select count(*) from test;
COUNT(*)
----------
7
SQL> insert into test select * from test;
7 rows created.
SQL> commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
14
standby端驗證資料是否同步
SQL> select count(*) from test;
COUNT(*)
----------
14
搭建過程問題小結:
1、在備庫啟動到nomount後用tns測試連線時發現數無法連線
ORA-12528: TNS:listener: all appropriate instances are blocking new
connections
原因是11g之後動態監聽不支援在nomount狀態下遠端的tns訪問,自己的伺服器中配置的監聽一直是動態的
新增listener.ora 檔案,為standby設定靜態監聽
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = xtttestdb)
(ORACLE_HOME = /opt/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = xtttestdb)
)
)
之後再測試連線正常
2、RMAN遠端複製資料庫完成後有redo的報錯
ORACLE error from auxiliary database: ORA-19527: physical standby redo log must be renamed
ORA-00312: online log 1 thread 1: '/opt/app/oracle/oradata/xtttestdb/redo01.log'
根據錯誤提示,加上網上搜尋一下,原來10g之後的DG即使日誌的原備庫路徑一樣,為了區分開來,還是要設定log_file_name_convert引數,建立備庫的pfile檔案,並新增該引數進去,利用pfile啟動資料庫,問題解決
create pfile='/home/oracle/stypfile.ora' from spfile;
新增
*.log_file_name_convert='/opt/app/oracle/oradata/xtttestdb/','/opt/app/oracle/oradata/xtttestdb/'
creaet spfile from pfile='/home/oracle/stypfile.ora'
startup
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29320885/viewspace-1719985/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 華為GaussDB T資料庫主備物理複製搭建過程資料庫
- 用RMAN複製 搭建 物理 Data Gurad 環境
- DG rman duplicate 複製庫錯誤
- ora11_node_dg(1)DG搭建過程
- 物理備庫的搭建過程
- RMAN不停機搭建DG
- linux 之遠端複製Linux
- DUPLICATE遠端複製資料庫資料庫
- 物理DG、邏輯DG和快照DG的搭建(視訊講解)
- 【DG】Oracle 19c使用dbca來搭建物理DGOracle
- rman duplicate搭建第二個 dg
- Redis複製過程詳解Redis
- 遠端登入和複製檔案
- 搭建DG過程由於沒有口令檔案而導致rman連不上主庫
- CentOS 5.8上搭建10g物理DGCentOS
- 利用Mongodb的複製集搭建高可用分片,Replica Sets + Sharding的搭建過程MongoDB
- oracle 19c dg搭建duplicate過程中報錯Oracle
- 一次DG搭建過程中碰到的問題
- MySQL主主複製(雙主複製)配置過程介紹MySql
- Oracle 11g單主搭建物理DGOracle
- 【DATAGUARD】DG系列之RACtoONE物理備庫的搭建
- 【DG】備庫RMAN還原方式搭建DG(不使用duplicate命令)
- 磁碟物理結構及IO時的過程
- MySQL Xtrabackup真實生產環境搭建主從複製全過程MySql
- RPC(遠端過程呼叫)詳解RPC
- redis建立主從複製的過程Redis
- 全表複製過程建立指令碼指令碼
- 【PG流複製】Postgresql流複製部署過程及效能測試SQL
- ORACLE RAC TO RAC DG搭建過程中可能遇到的問題Oracle
- 如何使用scp進行遠端複製檔案?
- 在WINDOWS下使用xcopy遠端複製檔案Windows
- Liunx遠端複製(限速和斷點續傳)斷點
- SSH免密登入與SCP遠端複製
- 從0開始搭建微信小程式(前後端)的全過程微信小程式後端
- MySQL的物理儲存結構和session過程MySqlSession
- MySQL搭建帶過濾的複製環境MySql
- 遠端伺服器不能複製貼上解決方法伺服器
- Duplicate 複製資料庫實驗過程資料庫