實戰11g active data guard on rac
環境描述:
OS:CentOS release 5.8(64bit)
DB:Oracle 11.2.0.3(64bit)
Storage:ASM
本次試驗涉及三個節點racnode1和racnode2(作為主庫),dgnode1(備庫),雙節點rac已部署完畢,接下來的步驟都是演示如何在現有環境下新增一個單例項的standby database。
操作步驟:(步驟中沒有明確說明的地方都是在備庫上進行操作)
1.rac雙節點已配置成功
2.配置standby dg
2.1配置核心引數
kernel.shmall = 4294967296
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1054472192
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304
2.2配置limit限制
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
2.3建立目錄
mkdir -p /u01/oracle
chown -R oracle:oinstall /u01/oracle
chmod -R 775 /u01/oracle
mkdir -p /u01/grid
mkdir -p /u01/11.2.0/grid
chown -R grid:oinstall /u01/grid
chmod -R 775 /u01/grid
chown -R grid:oinstall /u01/11.2.0/grid
chmod -R 775 /u01/11.2.0/grid
chown -R grid:oinstall oraInventory/
chmod -R 775 oraInventory/
2.4檢查軟體包
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel
2.5規劃asm磁碟
ocr+voting disk(1G)
data(6G)
flash(3G)
2.6安裝配置asmlib並建立asm disk
操作省略,和rac上配置一致
2.7安裝grid軟體
這裡需要注意的是在安裝選項時選擇standalone server
2.8安裝oracle軟體
在安裝資料庫型別時選擇single instance database
2.9為建立standby database準備主庫環境
2.9.1Enable Forced Logging
ALTER DATABASE FORCE LOGGING;
2.9.2Configure Redo Transport Authentication
確保rac所有節點的密碼檔案中的密碼一致並傳輸到standby端(檔名根據具體的sid做修改)
2.9.3Configure the Primary Database to Receive Redo Data(這步操作可選,主要是為了以後角色切換時起作用)
我這裡暫時沒配置
2.9.4Set Primary Database Initialization Parameters
Primary Role Initialization Parameters
DB_NAME=opdb
DB_UNIQUE_NAME=opdb
LOG_ARCHIVE_CONFIG='DG_CONFIG=(opdb,dgdb)'
LOG_ARCHIVE_DEST_2=
'SERVICE=dgdb ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=dgdb'
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
Standby Role Initialization Parameters
FAL_SERVER=dgdb
DB_FILE_NAME_CONVERT='+DATA/dgdb','+DATA/opdb'
LOG_FILE_NAME_CONVERT='+DATA/dgdb','+DATA/opdb'
STANDBY_FILE_MANAGEMENT=AUTO
2.9.5Enable Archiving
srvctl stop database -d opdb
srvctl start database -d opdb -o mount
alter database archivelog
alter database open
3.Step-by-Step Instructions for Creating a Physical Standby Database
3.1建立primary database的全庫備份集
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
backup database format '/u01/oracle/stage/full_%U' plus archivelog format '/u01/oracle/stage/arch_%U';
release channel c1;
release channel c2;
release channel c3;
}
3.2Create a Control File for the Standby Database
ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/u01/oracle/stage/dgdb.ctl';
3.3Create a Parameter File for the Standby Database
3.3.1Create a parameter file (PFILE) from the server parameter file (SPFILE)
CREATE PFILE='/u01/oracle/stage/initdgdb.ora' FROM SPFILE;
3.3.2Modify the parameter values in the parameter file
DB_UNIQUE_NAME=dgdb
control_files='+DATA/dgdb/controlfile/dbdg.ctl'
DB_FILE_NAME_CONVERT='+DATA/opdb','+DATA/dgdb'
LOG_FILE_NAME_CONVERT='+DATA/opdb','+DATA/dgdb'
LOG_ARCHIVE_DEST_2=
'SERVICE=opdb ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=opdb'
FAL_SERVER=opdb
3.4Copy Files from the Primary System to the Standby System(pfile,backupset,controlfile)
scp * 10.1.101.168:/u01/oracle/stage
3.5Set Up the Environment to Support the Standby Database
3.5.1Copy the remote login password file to Standby Database system
3.5.2Configure listeners for the primary and standby databases(automatic on 11gr2)
3.5.3Create Oracle Net service names
3.5.4Create a server parameter file for the standby database
create spfile from pfile='/u01/oracle/stage/initdgdb.ora';
3.6Start the Physical Standby Database
3.6.1Start the physical standby database
startup mount
3.6.2Create an Online Redo Log on the Standby Database
alter database add standby logfile thread 1
group 5 size 50M,
group 6 size 50M,
group 7 size 50M;
alter database add standby logfile thread 2
group 5 size 50M,
group 6 size 50M,
group 7 size 50M;
3.6.3Restore standby database from backupset
restore database;
3.6.4Start Redo Apply.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
3.7Verify the Physical Standby Database Is Performing Properly
3.7.1Identify the existing archived redo log files
SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
228 21-MAR-13 21-MAR-13
229 21-MAR-13 21-MAR-13
230 21-MAR-13 21-MAR-13
3.7.2Force a log switch to archive the current online redo log file(主庫操作)
ALTER SYSTEM SWITCH LOGFILE;
3.7.3Verify the new redo data was archived on the standby database
SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
228 21-MAR-13 21-MAR-13
229 21-MAR-13 21-MAR-13
230 21-MAR-13 21-MAR-13
231 21-MAR-13 21-MAR-13
3.7.4Verify that received redo has been applied
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# APPLIED
---------- ---------
228 YES
229 YES
230 YES
231 IN-MEMORY
3.8測試11g active data特性
3.8.1停止日誌應用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
3.8.2開啟物理備庫
ALTER DATABASE OPEN;
3.8.3開啟日誌實時應用(此時資料庫為open狀態)
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
3.8.4查詢資料庫當前狀態
select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
3.8.5建立測試表並插入測試資料(主庫)
create table tl(id int);
begin
for i in 1..1000 loop
insert into tl values(i);
end loop;
commit;
end;
/
|
select count(*) from tl;
COUNT(*)
----------
1000
3.8.6在備庫驗證資料
select count(*) from tl;
COUNT(*)
----------
1000
實驗過程中在備庫啟動到mount狀態時遇到了如下錯誤:
ERROR: asm_version error. err: driver/agent not installed rc:2
ORA-15183: ASMLIB initialization error [driver/agent not installed]
根據錯誤提示查詢系統的核心版本和asmlib的版本是一致的,google後發現一篇類似帖子,解決方案就是修改oracle二進位制程式的屬組為asmadmin並保留其原有許可權後問題解決,帖子的url為http://space.itpub.net/38267/viewspace-742110,在這裡感謝這位哥們,呵呵!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20801486/viewspace-756728/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g Data Guard Enabling Active Data GuardOracle
- 【DataGuard】11g 新特性:Active Data Guard
- Oracle 11g Data Guard 使用duplicate from active databaseOracleDatabase
- 搭建11g data guard(duplicate from active database方式)Database
- Active Data Guard初探(一)
- Oracle 11g Data Guard (physical standby - active dataguard) [final]Oracle
- 搭建Active Data Guard環境
- Oracle 11g RAC Data Guard 物理standby 建立Oracle
- Oracle 11g Data Guard 使用 duplicate from active database 建立 standby databaseOracleDatabase
- Oracle 11g Data Guard 使用duplicate from active database 建立 standby databaseOracleDatabase
- Data Guard Broker系列之二:Data Guard Broker配置實戰
- 【DataGuard】Oracle 11g物理Active Data Guard實時查詢(Real-time query)特性Oracle
- Oracle Active Data Guard調整案例[2]Oracle
- Script to Collect Data Guard Physical and Active Standby Diagnostic InformationORM
- Oracle 11g Data GuardOracle
- ORA-01555 on Active Data Guard Standby DatabaseDatabase
- oracle active data guard real-time apply特性OracleAPP
- 11g data guard 新特性
- Oracle RAC + Data Guard 環境搭建Oracle
- Oracle 12.2 How to Generate AWRs in Active Data Guard Standby DatabasesOracleDatabase
- Oracle 12c 新特性 Active Data Guard Far SyncOracle
- 【DataGuard】同一臺主機部署Oracle 11g物理Active Data Guard詳細過程Oracle
- oracle 11g data guard維護Oracle
- 總結11g 物理data guard
- Oracle 12c新特性 - Active Data Guard功能增強Oracle
- ORACLE 11G Data Guard 角色轉換Oracle
- Oracle 11gR2 Database和Active Data Guard遷移案例OracleDatabase
- 搭建Oracle Data Guard 11g(物理備用)Oracle
- Oracle goldengate 12c 新特性之完美支援Active Data GuardOracleGo
- Windows下ORACLE 11G DATA GUARD搭建(用於實時備份)WindowsOracle
- DATA GUARD部署模式——DATA GUARD概念和管理模式
- 12c DG新特性 - Active Data Guard Far Sync (Doc ID 2179719.1)
- G008-ORACLE-DG ORACLE 19C Active Data Guard DML RedirectionOracle
- 11gR2 Active Data Guard 閃回 - flashback database / snapshot standby - 3Database
- 11gR2 Active Data Guard 閃回 - flashback database / snapshot standby - 2Database
- Linux下ORACLE 11G DATA GUARD搭建(用於實時備份)LinuxOracle
- 監控Data Guard實時同步
- 介紹ORACLE DATA GUARD——DATA GUARD概念和管理Oracle