部署Oracle 11gR2 Data Guard安裝記錄(2)
相關文章:
《部署Oracle 11gR2 Data Guard安裝記錄(1)》http://space.itpub.net/?uid-23135684-action-viewspace-itemid-757896
如果主資料庫或備用資料庫使用的是ASM,那麼在設定LOG_FILE_NAME_CONVERT和DB_FILE_NAME_CONVERT兩個初始化引數時一定注意,詳情參考文章:《Duplicate Active Database Failing with: RMAN-03009, ORA-17628》http://space.itpub.net/23135684/viewspace-757998
也就是說,如果使用的是ASM,那麼指定路徑時不能光指定磁碟組的名稱,必須指定全路徑,例如:+DBFILE1/ractest/onlinelog/。
這裡對主資料庫是RAC,備用資料庫是單機的standby log做以下說明:
1).首先從主資料庫執行duplicate active database命令複製備用資料庫之後,在備用庫上包含了主資料庫所有的線上Redo日誌和Standby Redo日誌(包括映象的Redo日誌)。
2).對於主資料庫是RAC,備用資料庫是單機的情況,在備用資料庫上一直有兩個Standby Redo Log處於活動狀態,接收來自不同主資料庫例項的線上Redo Log同步。
SQL> select group#,thread#,sequence#,status from v$standby_log;
GROUP# THREAD# SEQUENCE# STATUS
---------- ---------- ---------- ----------
5 1 154 ACTIVE
6 1 0 UNASSIGNED
7 1 0 UNASSIGNED
8 2 120 ACTIVE
9 2 0 UNASSIGNED
10 2 0 UNASSIGNED
6 rows selected.
下面再討論一下主庫是RAC,備用庫是單機的switchover過程:
1).首先在主庫完成以下操作:
SQL> select dest_id,thread#,max(sequence#) from v$archived_log group by dest_id,thread#;
DEST_ID THREAD# MAX(SEQUENCE#)
---------- ---------- --------------
2 1 153
1 2 119
1 1 153
2 2 119
SQL> alter system switch logfile;
System altered.
SQL> select dest_id,thread#,max(sequence#) from v$archived_log group by dest_id,thread#;
DEST_ID THREAD# MAX(SEQUENCE#)
---------- ---------- --------------
2 1 154
1 2 120
1 1 154
2 2 120
確保Data Guard環境正常工作。
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
--------------------
TO STANDBY
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY ;
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY
*
ERROR at line 1:
ORA-01105: mount is incompatible with mounts by other instances
必須先停止其他例項,只保留一個例項。
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY ;
Database altered.
SQL> shutdown immediate
ORA-01092: ORACLE instance terminated. Disconnection forced
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@rhel1 admin]$ sql
SQL*Plus: Release 11.2.0.2.0 Production on Tue Apr 9 01:43:09 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2230600 bytes
Variable Size 486540984 bytes
Database Buffers 289406976 bytes
Redo Buffers 6819840 bytes
Database mounted.
SQL> alter database open read only;
Database altered.
2).接下來在備用庫上執行以下操作:
SQL> alter database recover managed standby database cancel;
Database altered.
操作主庫之前已經cancel;
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY
*
ERROR at line 1:
ORA-16139: media recovery required
需要做一下恢復操作。
SQL> alter database recover managed standby database;
alter database recover managed standby database
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
前臺恢復操作,一定時間後按下Ctrl+C終止。
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Database altered.
SQL> ALTER DATABASE OPEN;
Database altered.
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PRIMARY
備庫已經變成了主庫,切換成功。
備庫已經變成了主庫,切換成功。
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
原有的主庫已經變成了備用庫。
4).啟動原來主庫的其他例項。原有的主庫已經變成了備用庫。
SQL> startup
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2230600 bytes
Variable Size 473958072 bytes
Database Buffers 301989888 bytes
Redo Buffers 6819840 bytes
Database mounted.
Database opened.
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY
5).在現有主庫做一下日誌切換測試。
SQL> alter system switch logfile;
System altered.
SQL> select dest_id,thread#,max(sequence#) from v$archived_log group by dest_id,thread#;
DEST_ID THREAD# MAX(SEQUENCE#)
---------- ---------- --------------
2 1 160
1 2 121
1 1 160
2 2 122
SQL> alter system switch logfile;
System altered.
SQL> r
1* alter system switch logfile
System altered.
SQL> select dest_id,thread#,max(sequence#) from v$archived_log group by dest_id,thread#;
DEST_ID THREAD# MAX(SEQUENCE#)
---------- ---------- --------------
2 1 162
1 2 121
1 1 162
2 2 122
SQL> select dest_id,thread#,max(sequence#) from v$archived_log group by dest_id,thread#;
DEST_ID THREAD# MAX(SEQUENCE#)
---------- ---------- --------------
2 1 162
1 2 121
1 1 162
2 2 122
從上面的日誌切換測試來看,首先日誌傳輸服務工作正常,且只有thread 1在工作,因為現有的主庫是單例項嘛。在現有的備庫上執行以下查詢:
SQL> select group#,thread#,status from v$standby_log;
GROUP# THREAD# STATUS
---------- ---------- ----------
5 1 ACTIVE
6 1 UNASSIGNED
7 1 UNASSIGNED
8 2 UNASSIGNED
9 2 UNASSIGNED
10 2 UNASSIGNED
6 rows selected.
從上面的查詢可以看出,只有一個Standby Redo Log在工作,也是因為主庫變成了單例項資料庫。
從上面的查詢可以看出,只有一個Standby Redo Log在工作,也是因為主庫變成了單例項資料庫。
--end--
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23135684/viewspace-757999/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 部署Oracle 11gR2 Data Guard安裝記錄(1)Oracle
- 2 Oracle Data Guard 安裝Oracle
- 安裝oracle 11GR2 手記Oracle
- Oracle 11gR2 Database和Active Data Guard遷移案例OracleDatabase
- DATA GUARD部署模式——DATA GUARD概念和管理模式
- oracle 11gr2 rac 安裝Oracle
- [Data Guard]Oracle10g Data Guard學習筆記(一)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(二)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(三)Oracle筆記
- AIX5L 上Oracle 10gR2 Data Guard 搭建測試記錄AIOracle 10g
- 【oracle】靜默安裝 oracle 11gr2Oracle
- Windows環境下的Oracle Data Guard安裝和配置WindowsOracle
- oracle data guard!!Oracle
- 11gR2 Active Data Guard 閃回 - flashback database / snapshot standby - 2Database
- 手把手教你安裝Data Guard
- 2 開始實用 Oracle Data GuardOracle
- Oracle Active Data Guard調整案例[2]Oracle
- 【RAC安裝】 AIX下安裝Oracle 11gR2 RACAIOracle
- Solaris 10.5 安裝Oracle 11gR2Oracle
- 介紹ORACLE DATA GUARD——DATA GUARD概念和管理Oracle
- Oracle Data Guard配置Oracle
- Oracle 11R2 snapshot Data GuardOracle
- 11gR2 Active Data Guard 閃回 - flashback database / snapshot standby - 3Database
- 10G DATA GUARD 安裝配置過程
- Oracle 19C Data Guard基礎運維-01安裝物理standbyOracle運維
- Oracle Data Guard Broker元件Oracle元件
- Oracle Data Guard簡介Oracle
- Oracle Data Guard 介紹Oracle
- ORACLE Data Guard--IOracle
- oracle 11gR2 RAC安裝與oracle 10gR2 rac 安裝時的不同點Oracle 10g
- 安裝11gr2 RAC
- 【ASM】Oracle ASM + 11gR2 + RHEL6.5 安裝ASMOracle
- oracle 11gr2 rac 虛擬安裝問題Oracle
- oracle 11gR2 rac 安裝問題總結Oracle
- oracle 11gR2 rac for aix 5310 安裝OracleAI
- Oracle 11gR2 for Linux 初次安裝體驗OracleLinux
- Oracle 11g Data Guard Enabling Active Data GuardOracle
- 【DataGuard】使用Grid Control快速部署Oracle物理Data GuardOracle