程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> ORACLE-DataGuard系列:邏輯standby搭建

ORACLE-DataGuard系列:邏輯standby搭建

編輯:Oracle數據庫基礎
 准備:
確認對象和語句能被standby支持
確保primary庫中各表的行可被唯一標識
環境:
操作系統:RED HAT Linux ENTERPRISE 5
Oracle: 11.2.0.1.0
PRIMARY:
IP: 192.168.1.11
SID: test
DB_UNIQUE_NAME:test
安裝路徑:/oracle/Oracle/product/11.2.0/dbhome_1
本地歸檔路徑:/Oracle/oradata/test/archive
PHYSICS STANDBY:
IP: 192.168.1.12
SID: dgtest
DB_UNIQUE_NAME:dgtest
安裝路徑:/oracle/Oracle/product/11.2.0/dbhome_1
本地歸檔路徑:/Oracle/oradata/dgtest/dgtest/archive
LOGICAL STANDBY:
IP: 192.168.1.15
SID: logicdg
DB_UNIQUE_NAME: logicdg
安裝路徑:/oracle/Oracle/product/11.2.0/dbhome_1
本地歸檔路徑:/Oracle/oradata/logicdg/local-archive
本例測試采用物理standby轉邏輯standby的方式在一個已經存在的dataguard環境中新增一台邏輯standby.
原dataguard環境可參考:
http://xin23.blog.51cto.com/1827266/504066
創建新物理standby的過程亦可參照此文。此處不再贅述。
則目前環境為:
primary:192.168.1.11
physics: 192.168.1.12
logical: 192.168.1.15 (目前為物理standby.待轉換)
1.修改primary初始化參數文件(僅列出修改部分)
*.log_archive_dest_state_2=defer
*.log_archive_dest_state_3=defer
*.log_archive_config='dg_config=(test,dgtest,logicdg)'
*.log_archive_dest_2='service=test12 arch valid_for=(online_logfiles,primary_role) db_unique_name=dgtest'
*.log_archive_dest_3='service=test15 arch valid_for=(online_logfiles,primary_role) db_unique_name=logicdg'
*.fal_server=test11
*.fal_clIEnt=test12
*.standby_file_management=auto
*.db_file_name_convert='/oracle/oradata/test','/oracle/oradata/dgtest/dgtest','/Oracle/oradata/test','/

Oracle/oradata/logicdg'
*.log_file_name_convert='/oracle/oradata/test','/oracle/oradata/dgtest/dgtest','/Oracle/oradata/test','/

Oracle/oradata/logicdg'

2.查看兩台物理standby同步狀態
physics> select sequence#,applIEd from v$archived_log;
SEQUENCE# APPLIED
---------- ---------
66 YES
67 YES
68 YES
69 YES
70 YES
71 YES
72 YES
7 rows selected.
-----------------------------------------------------------------------------
logical> select sequence#,applIEd from v$archived_log;
SEQUENCE# APPLIED
---------- ---------
67 YES
68 YES
69 YES
70 YES
71 YES
72 YES
6 rows selected.
3.取消待轉換物理standby的redo應用
logical> alter database recover managed standby database cancel;
Database altered.
4.primary生成數據字典
primary> execute dbms_logstdby.build;
PL/SQL procedure successfully completed.
5.將物理standby轉換為邏輯standby
logical> alter database recover to logical standby logicdg;
Database altered.
logical> shutdown immediate
ORA-01507: database not mounted
Oracle instance shut down.
logical> startup mount
Oracle instance started.
Total System Global Area 2488635392 bytes
Fixed Size 2215904 bytes
Variable Size 1392508960 bytes
Database Buffers 1090519040 bytes
Redo Buffers 3391488 bytes
Database mounted.
6.調整standby初始化參數
logical> alter system set log_archive_dest_1='location=/Oracle/oradata/logicdg/local-archive valid_for=(online_logfiles,all_roles)
2 db_unique_name=logicdg';
System altered.
logical> alter system set log_archive_dest_5='location=/Oracle/oradata/logicdg/archive valid_for=(standby_logfiles,standby_role)
2 db_unique_name=logicdg';
System altered.
7.resetlogs方式打開數據庫
logical> alter database open resetlogs;
Database altered.
8.應用redo
創建standby redologs
logical> alter database add standby logfile group 11 '/Oracle/oradata/logicdg/standbyredo11.log' size 100m;
Database altered.
logical> alter database add standby logfile group 12 '/Oracle/oradata/logicdg/standbyredo12.log' size 100m;
Database altered.
logical> alter database add standby logfile group 13 '/Oracle/oradata/logicdg/standbyredo13.log' size 100m;
Database altered.
啟動redo實時應用
logical> alter database start logical standby apply immediate;
Database altered.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved