使用Veritas Volume Replicator(VVR)對Oracle數據庫進行容災

    隨着全球信息化時代的到來,信息數據越來越成爲企業關注的焦點,即在各種自然災害或者人爲破壞的情況下,如何保證生產數據的安全和關鍵業務的不中斷運行。 傳統的保護方法離線備份、備份介質異地保存在一定程度上可以解決上述問題,但爲了能夠對業務系統提供更高的實時性和可靠性,保證關鍵業務7x24不中斷, 應對激烈的市場競爭和提高客戶滿意度,企業必須在IT系統圍繞“連續”(BC)主題進行構建,實施業務連續/容災備份計劃,包括業務連續性、高可用性管 理、容災、數據複製和恢復方案、安全等,下面就對數據複製技術做一個簡單的介紹。 

   根據數據複製運行的位置,可以將數據複製方式分爲以下四種: 

   基 於存儲(Storage-Based):代表廠商有EMC SRDF、IBM PPRC/GDPS 、HP BusinessCopy、HDS TrueCopy等,特點對主機透明,對應用系統的影響較小,技術成熟,有較多的成功案例,但是投資較大,對網絡連接的要求也較高。
基於服務器(Host-based):代表廠商主要是Symantec公司的Veritas Volume Replicator (VVR),是存儲卷的複製技術。需要佔用主機一定的系統資源。
 
   基 於存儲交換機(SAN-Based):運行於掛接在存儲網絡上的專用設備中,代表廠商有CISCO的SANTap,FalconStor IPStor,Topio SANsafe,DataCore SANsymphony, Asynchronous Internet Mirroring (AIM)等。 

   基於數據庫/軟件應用 :代表廠商有Oracle DataGuard,Quest SharePlex,IBM-DB2的遠程Q複製,SYBASE的複製服務器(Replication Server) 等,這些技術都是對數據邏輯操作的複製,屬於邏輯數據複製,而其它3種複製的是數據卷中的數據變化,屬於物理數據複製。典型的邏輯數據複製是通過數據庫日 志實現的,優點是硬件投資小,對生產系統的影響比較小,對主、備用系統的硬件平臺沒有選擇性;可以在廣域網範圍內使用。但它對數據庫系統有嚴格的要求,並 且主、備用系統必須使用相同的數據庫版本。

上面介紹的主要的各廠商方案和產品可以參見下圖:
   

本文主要介紹基於主機和邏輯卷的數據複製VVR。

VERITAS的VVR(Veritas Volume Replicator)是用於有效的災難恢復的數據複製軟件,可以連續對應用數據進行一個或者多個的拷貝保護。具有的優點主要有:高性能,距離不限,支持 異構的存儲和操作系統,對數據的連續保護,支持同步和異步複製。
VVR系統架構如下圖: 
   


VVR具有的系統特性如下:
(1) 最高支持32個遠程節點,可以通過基於IP的LAN或者WAN網絡;
(2) 通過對邏輯卷的同步和異步複製模式,保證數據的完整性和一致性;
(3) 確保備用節點和主節點的數據具有相同的寫入順序;
(4) 支持對網絡帶寬的管理和定義,支持多鏈路的連接;
(5) 支持對備用節點的脫機操作,以便在備用節點進行查詢(例如DSS決策支持系統)或者數據備份;
(6) 易管理:同時支持命令行和圖形界面(VEA);
(7) 主備節點之間支持多種異構存儲;
(8) 支持不同操作系統平臺之間的複製;(注:在本文中,因爲設計到Oracle數據庫的複製,所以主備操作系統必須同一類型,比如必須都是Solaris平臺,版本完全相同的Oracle版本)
(9) 支持主流關係數據庫系統,包括Oracle,DB2,Sybase和Informix,數據文件的存放格式包括邏輯卷(裸設備)或者文件系統;
(10) 支持共享的集羣環境中的邏輯卷複製,比如Oracle RAC (Real Application Clusters) (注:本文中採用的是單節點Oracle複製);
(11) 支持Veritas volume set;
(12) 支持PDC (Portable Data Container)環境的數據複製;

VVR數據複製系統主要由下面五個組件組成:
■ Replicated Volume Group (RVG) 複製卷組
RVG是位於VxVM 磁盤組(DG)內的一組邏輯卷,RVG隸屬於磁盤組的一部分,通過定義這些邏輯卷,
應用對邏輯卷的寫操作都可以保持以主節點上同樣的順序,來寫到備用節點上。
對於多數數據庫系統來說,都是由一些特定的進程完成對磁盤的寫操作,比如Oracle系統中的LOWR
和DBWR進程,而這些寫操作總是依照着一定順序,從而來保證實例恢復中數據的一致和完整。比如
數據庫變化通常在寫入日誌文件後纔會寫入數據文件,所以當日志文件和數據文件屬於要複製的不同
邏輯卷的時候,它們必須被定義到同一組RVG中。
每組RVG最多可以包括2048個數據卷。
下面介紹SRL和RLINK,它們也包括在RVG中。
■ Storage Replicator Log (SRL)
SRL用於記錄RVG中數據寫操作的日誌,並循環被使用。每個RVG包括一個SRL。數據在寫入RVG中的卷之前,首先要寫到主節點的SRL中。
從VxVM的角度來看,SRL是一個單獨的卷,因爲所有的寫操作首先要寫到SRL中,這個卷需要有較好的寫性能,所以多數情況下需要對這個捲進行條帶化,並且在不同的盤上mirror以保護數據,同時數據卷和SRL卷最好分佈在不同的物理磁盤上以得到更好的性能。
不允許人工直接對SRL進行訪問。
■ Replication Link—RLINK
用於連接主RVG和備用RVG之間的一個“鏈接”,一個主的RVG最多可以有32個RLINK。可以定義RLINK
的多個屬性來調整數據複製的參數,比如指定複製的網絡。
■ Data Change Map (DCM)
■ Replicated Data Set (RDS)
一個RDS包括了所有的主節點和備用節點的複製卷組(RVG)。RDS不是一個具體存在的對象,而是一個VVR複製技術中的一個概念。

在異步模式下VVR的數據複製和數據流向 
  


在同步模式下VVR的數據複製和數據流向




另外,VVR是Veritas Volume Manager (VxVM)的一個單獨的option,需要單獨的license。

Veritas Volume Replicator 的安裝
主備節點硬件和軟件配置和版本如下:
主節點 機器名:lxsfrac01
Sun Microsystems Sun Fire X4100 Server
操作系統 solaris10u4 x86_64
VVR版本: Veritas Volume Replicator 5.0 GA
Oracle 版本: Oracle 10gR2 Enterprise Edition
磁盤陣列:SAN/ HDS AMS 1000
Public網卡:e1000g0 私有(複製)網卡:e1000g1
備用節點機器名:lxsfrac02
軟硬件環境與主節點相同

兩個節點分別安裝VVR和vxfs,安裝方法相同,以lxsfrac02爲例:

放入安裝介質,一般Solaris都由vold進程自動mount CD,
如果需要手工mount:mount –F hsfs –o ro /dev/dsk/c0t6d0s2 /cdrom

root@lxsfrac02 # cd ./volume_replicator/
root@lxsfrac02 # ls
copyright docs installvvr pkgs release_notes scripts tools uninstallvvr
root@lxsfrac02 # ls -l
total 24
-rw-r--r-- 1 root root 476 Dec 15 2006 copyright
drwxrwxr-x 2 root root 512 Jun 21 10:13 docs
-rwxr-xr-x 1 root root 2283 Apr 14 2007 installvvr
drwxrwxr-x 3 root root 1024 Jun 21 10:13 pkgs
drwxrwxr-x 2 root root 512 Jun 21 10:13 release_notes
drwxrwxr-x 3 root root 512 Jun 21 10:13 scripts
drwxrwxr-x 3 root root 512 Jun 21 10:13 tools
-rwxr-xr-x 1 root root 2283 Apr 14 2007 uninstallvvr
root@lxsfrac02 # ./installvvr lxsfrac02

Veritas Volume Replicator 5.0 Installation Program

Copyright (c) 2007 Symantec Corporation. All rights reserved. Symantec, the Symantec Logo are trademarks or registered trademarks of Symantec Corporation or its affiliates in the U.S. and other countries. Other names may be trademarks of their respective owners.

The Licensed Software and Documentation are deemed to be "commercial computer software" and "commercial computer software documentation" as defined in FAR Sections 12.212 and DFARS Section 227.7202.

Logs for installvvr are being created in /var/tmp/installvvr-mrk46Y.

Initial system check:

Checking VVR installation on lxsfrac02 ............................................ not installed
Checking architecture on lxsfrac02 ................................................ i386

Veritas Volume Replicator 5.0 Installation Program

Checking system licensing

Installing licensing packages
VVR is not licensed on lxsfrac02

Enter a VVR license key for lxsfrac02: ******************
****************** successfully registered on lxsfrac02
Permanent VVR license registered on lxsfrac02
Do you want to enter another license key for lxsfrac02? [y,n,q] (n)

Veritas Volume Replicator 5.0 Installation Program

Checking installed packages on lxsfrac02

Veritas Volume Replicator 5.0 Installation Program
VVR can be installed without optional packages to conserve disk space.
Additional packages are typically installed to simplify future upgrades.

1) Required Veritas Volume Replicator packages - 855 MB required
2) All Veritas Volume Replicator packages - 861 MB required
3) Storage Foundation Enterprise packages - 911 MB required

Select the packages to be installed on all systems? [1-3,q,?] (3) 2

Veritas Volume Replicator 5.0 Installation Program

The following VVR packages will be installed:
VRTSperl Veritas Perl 5.8.8 Redistribution
VRTSvlic Veritas Licensing
VRTSicsco Symantec Common Infrastructure
VRTSpbx Symantec Private Branch Exchange
VRTSsmf Symantec Service Management Framework
VRTSat Symantec Product Authentication Service
VRTSobc33 Veritas Enterprise Administrator Core Service
VRTSob Veritas Enterprise Administrator Service
VRTSobgui Veritas Enterprise Administrator
VRTSccg Veritas Enterprise Administrator Central Control Grid
VRTSmh Veritas Storage Foundation Managed Host by Symantec
VRTSaa Veritas Enterprise Administrator Action Agent
VRTSspt Veritas Software Support Tools
SYMClma Symantec License Inventory Agent
VRTSvxvm Veritas Volume Manager Binaries
VRTSdsa Veritas Datacenter Storage Agent
VRTSfspro Veritas File System Management Services Provider
VRTSvmman Veritas Volume Manager Manual Pages
VRTSvmdoc Veritas Volume Manager Documentation

Press [Return] to continue:
...continued:
VRTSdcli Veritas Distributed Command Line Interface
VRTSalloc Veritas Volume Manager Intelligent Storage Provisioning
VRTSvmpro Veritas Volume Manager Management Services Provider
VRTSddlpr Veritas Device Discovery Layer Services Provider
VRTSvrpro Veritas Volume Replicator Client Extension and Provider for
Veritas Enterprise Administrator
VRTSvcsvr Veritas Cluster Server Agents for VVR
VRTSjre Veritas Java Runtime Environment Redistribution
VRTSjre15 Veritas Java Runtime Environment Redistribution
VRTSweb Veritas Java Web Server
VRTSvrw Veritas Volume Replicator Web Console
VRTSvrdoc Veritas Volume Replicator Documentation

Press [Return] to continue:
Checking for any AP driver issues on lxsfrac02 ................................... None
A copy of a previous VxVM configuration is present on the system lxsfrac02.
Do you want to restore and reuse the previous VxVM configuration of system lxsfrac02 [y,n,q,?] (y) n

Veritas Volume Replicator 5.0 Installation Program
Installing VVR: 100% ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

Installation completed successfully on all systems
It is optional to configure VVR now. If you choose to configure VVR later, you can either do so manually, or run the installvvr -configure command. The product installation scripts can be found in /opt/VRTS/install directory

Are you ready to configure VVR? [y,n,q] (y)

The enclosure-based naming scheme is a feature of Veritas Volume Manager. It allows one to reference disks using a symbolic name that is more meaningful than the operating system's normal device access name. This symbolic name is typically derived from the array name.

Do you want to set up the enclosure-based naming scheme? [y,n,q,?] (n) y

Veritas Volume Replicator 5.0 Installation Program
Veritas Volume Manager default disk group name configuration:
Many Veritas Volume Manager commands affect the contents or configuration of a disk group. Such commands require that the user specify a disk group. This is accomplished by using the -g option of a command or setting the VXVM_DEFAULTDG environment variable. An alternative to these two methods for some commands is to configure the name of the default disk group of a system.

Note: The default disk group feature is not available with the DCLI vxadm(1M) and vxquery(1M) commands. When using these commands, a required disk group must be explicitly identified using the -g option.

Do you want to set up a default disk group for each system? [y,n,q,?] (y) n

Veritas Volume Replicator 5.0 Installation Program
Following are the default ports that will be used by VVR on lxsfrac02 :

Port for VVR heartbeat communication: 4145
Port for vradmind daemon: 8199
Port for vxrsyncd daemon: 8989
Ports for data replication: Anonymous-Ports

The ports indicated for VVR heartbeats and vradmind are IANA assigned.

The port settings should be identical for systems that will be part of the same Replicated Data Set. They should also be identical for all the systems in a cluster.

Do you want to change any of the VVR ports on lxsfrac02? [y,n,q] (n)

Veritas Volume Replicator 5.0 Installation Program

VVR Statistics Collection Tool

The VVR administrative daemon vradmind can collect and maintain various
statistics which are helpful in solving VVR performance issues. This
collection can be tuned using a few tunables like the frequency for
gathering the statistics and the number of days for which the collected
statistics should be preserved, after which the earlier statistics are
automatically deleted.


The frequency of VVR statistics collection on lxsfrac02 is set to per 10 seconds.

Do you want to change the frequency of VVR statistics collection on lxsfrac02 ? [y,n,q] (n)

The maximum number of days for which VVR statistics can be retained is set to 3 on lxsfrac02

Do you want to change the maximum number of days for retaining VVR statistics on lxsfrac02 ? [y,n,q] (n)


Veritas Volume Replicator 5.0 Installation Program

Configuration of VVR tunables (For the advanced user)

Do you want to view or modify VVR tunables on lxsfrac02 ? [y,n,q,?] (n)


Veritas Volume Replicator 5.0 Installation Program
Verify the install systems Fully Qualified Hostnames.

Querying fully qualified domain name of host "lxsfrac02" ............................. fail

Press [Return] to continue:
Unable to find FQHN for lxsfrac02!

Enter the fully qualified hostname of "lxsfrac02" or 'QUIT' to quit install.
Enter the fully qualified host name: lxsfrac02

Veritas Volume Replicator 5.0 Installation Program

Choose how this install will be managed.

This product can configured one of the two following ways:

* Storage Foundation Management Server managed host (Recommended)

* Standalone host


Pre-requisites for Storage Foundation Management Server managed host:
* A Storage Foundation Management Server (SFMS) is configured
* SFMS should be currently running and fully operational.
* Authentication Broker that is used by SFMS should be running.

The following information would be requested during configuration:
* The host name of the SFMS
* Previously set SFMS agent account password

There are no pre-requisites for deploying as a standalone host.

Enabling Storage Foundation Management Server management simplifies and improves management of the complex data center
resources, reducing planned and unplanned down time.

Enable Storage Foundation Management Server Management? [y,n,q] (y) n

Veritas Volume Replicator 5.0 Installation Program
Verify the install systems Fully Qualified Hostnames.
Configuring VEA in STANDALONE mode on "lxsfrac02" ..................................... ok

Configuring gridnode on "lxsfrac02" ................................................... ok
Registering gridnode on "lxsfrac02" ................................................... ok
Configuring actionagent on "lxsfrac02" ................................................ ok
Registering actionagent on "lxsfrac02" ................................................ ok
Registering StorageAgent on "lxsfrac02" ............................................... ok
Do you want to start Veritas Volume Replicator processes now? [y,n,q] (y)


Veritas Volume Replicator 5.0 Installation Program
Starting VVR: 100% ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
Startup completed successfully on all systems
You declined to set up the name of the default disk group for lxsfrac02.
Installation log files, summary file, and response file are saved at:
/opt/VRTS/install/logs/installvvr-mrk46Y

To enable Dynamic Multi-Pathing (DMP), MPxIO must be disabled. Refer to the Storage Foundation Release Notes for further details on disabling MPxIO.

檢查vradmin deamon:

root@lxsfrac02 # ps -ef|grep vrad|grep -v grep
root 9808 1 0 16:24:47 ? 0:00 /usr/sbin/vradmind

安裝Veritas File System:安裝過程略

root@lxsfrac02 # cd file_system/
root@lxsfrac02 # ls -l
total 22
-rw-r--r-- 1 root root 476 Dec 15 2006 copyright
drwxrwxr-x 2 root root 512 Jun 21 10:12 docs
-rwxr-xr-x 1 root root 2283 Apr 14 2007 installfs
drwxrwxr-x 3 root root 1024 Jun 21 10:12 pkgs
drwxrwxr-x 2 root root 512 Jun 21 10:12 release_notes
drwxrwxr-x 3 root root 512 Jun 21 10:12 scripts
-rwxr-xr-x 1 root root 2283 Apr 14 2007 uninstallfs
root@lxsfrac02 # ./installfs lxsfrac02

Veritas Volume Replicator VVR的配置
1. 兩個節點上都需要做:
修改兩個節點的/etc/hosts
10.198.90.122 lxsfrac01
10.198.90.139 lxsfrac02
192.168.0.122 lxsfrac01-priv
192.168.0.139 lxsfrac02-priv

分別創建私有網絡(專有),建議數據複製使用專用網絡。

root@lxsfrac01 # ifconfig e1000g1 plumb 192.168.0.122 netmask 255.255.255.0 up
root@lxsfrac02 # ifconfig e1000g1 plumb 192.168.0.139 netmask 255.255.255.0 up
root@lxsfrac01 # ping 192.168.0.139
192.168.0.139 is alive

創建相同名稱的磁盤組(含有最少兩個磁盤),相同名稱數據卷oravol,創建複製日誌卷(SRL),
分別在本地安裝Oracle 10gR2.(安裝Oracle過程略。)
root@lxsfrac01 # vxdg init oradg AMS_WMS0_2 AMS_WMS0_3
root@lxsfrac01 # vxassist -g oradg make oravol 10g
root@lxsfrac01 # vxedit -g oradg set user=oracle group=dba mode=644 oravol
root@lxsfrac01 # vxassist -g oradg make srl 800m

2.在備用節點上修改配置文件/etc/vx/vras/.rdg,讓其包含主節點上的disk group ID
(這裏是1193985774.38.lxsfrac01)。當創建備用RVG時,這個文件用來對主節點的授權。
可以通過vxprint –l來得到disk group ID
root@lxsfrac02 # vi /etc/vx/vras/.rdg
………
1193985774.38.lxsfrac01

"/etc/vx/vras/.rdg" 43 lines, 1544 characters

3.在主節點上:
創建vxfs文件系統
mount -F vxfs -o largefiles /dev/vx/dsk/oradg/oravol /oracle
chown oracle:dba /oracle
切換到oracle用戶使用dbca建庫,並且所有數據文件選擇/oracle目錄
創建Primary RVG:
root@lxsfrac01 # vradmin -g oradg createpri ora_rvg oravol srl
其中的oravol是要複製的數據卷列表,當多於一個時,用逗號隔開。

創建Secondary RVG:
root@lxsfrac01 # vradmin -g oradg addsec ora_rvg lxsfrac01-priv lxsfrac02-priv

設置複製方式爲異步:
root@lxsfrac01 # vradmin -g oradg set ora_rvg lxsfrac02-priv synchronous=off

開始複製:
root@lxsfrac01 # vradmin -g oradg -a startrep ora_rvg
Message from Primary:
VxVM VVR vxrlink WARNING V-5-1-3359 Attaching rlink to non-empty rvg. Autosync will be performed.
VxVM VVR vxrlink INFO V-5-1-3614 Secondary data volumes detected with rvg ora_rvg as parent:
VxVM VVR vxrlink INFO V-5-1-6183 oravol: len=20971520 primary_datavol=oravol
VxVM VVR vxrlink INFO V-5-1-3365 Autosync operation has started
root@lxsfrac01 #
root@lxsfrac01 # vradmin -g oradg -f startrep ora_rvg
VxVM VVR vradmin INFO V-5-52-1203 Replication to Secondary host lxsfrac02-priv already started.


檢查相關信息和狀態,顯示數據複製過程,可以通過使用-i參數指定interval
root@lxsfrac01 # vxrvg -g oradg getrlinks ora_rvg
rlk_lxsfrac02-priv_ora_rvg

root@lxsfrac01 # vxrlink -g oradg status rlk_lxsfrac02-priv_ora_rvg

Fri Nov 02 17:01:22 2007
VxVM VVR vxrlink INFO V-5-1-4464 Rlink rlk_lxsfrac02-priv_ora_rvg is in AUTOSYNC. 9888256 Kbytes remaining.
root@lxsfrac01 # vxrlink -g oradg status rlk_lxsfrac02-priv_ora_rvg

Fri Nov 02 17:02:08 2007
VxVM VVR vxrlink INFO V-5-1-4464 Rlink rlk_lxsfrac02-priv_ora_rvg is in AUTOSYNC. 9375488 Kbytes remaining.
root@lxsfrac01 # vxrlink -g oradg status rlk_lxsfrac02-priv_ora_rvg

Fri Nov 02 17:13:26 2007
VxVM VVR vxrlink INFO V-5-1-4464 Rlink rlk_lxsfrac02-priv_ora_rvg is in AUTOSYNC. 1901824 Kbytes remaining.
root@lxsfrac01 # vxrlink -g oradg status rlk_lxsfrac02-priv_ora_rvg

Fri Nov 02 17:19:16 2007
VxVM VVR vxrlink INFO V-5-1-4467 Rlink rlk_lxsfrac02-priv_ora_rvg is up to date

可以手工進行gracefully切換
root@lxsfrac01 # umount /oracle
root@lxsfrac01 # vradmin -g oradg migrate ora_rvg lxsfrac02-priv
VxVM VVR vradmin WARNING V-5-52-93 Make sure applications using Primary data volumes are stopped.
vradmin: Continue with migrate (y/n)? y
root@lxsfrac01 #

下面我們就在上面搭建好的VVR環境中對容災數據進行切換測試:

注:在下面測試中,主節點爲lxsfrac02,備用節點爲lxsfrac01

====================================== 顯示主備節點狀態 =================================

root@lxsfrac02 # vradmin -g oradg -l repstatus ora_rvg
Replicated Data Set: ora_rvg
Primary:
Host name: lxsfrac02-priv
RVG name: ora_rvg
DG name: oradg
RVG state: enabled for I/O
Data volumes: 1
VSets: 0
SRL name: srl
SRL size: 800.00 M
Total secondaries: 1

Secondary:
Host name: lxsfrac01-priv
RVG name: ora_rvg
DG name: oradg
Rlink from Primary: rlk_lxsfrac01-priv_ora_rvg
Rlink to Primary: rlk_lxsfrac02-priv_ora_rvg
Configured mode: asynchronous
Latency protection: off
SRL protection: autodcm
Data status: inconsistent
Replication status: resync in progress (autosync)
Current mode: asynchronous
Logging to: DCM (contains 5181696 Kbytes) (autosync)
Timestamp Information: N/A
Bandwidth Limit: N/A

==================================== 顯示replication link狀態 =================================

root@lxsfrac02 # vxrlink -g oradg status rlk_lxsfrac01-priv_ora_rvg

Mon Nov 05 16:52:51 2007
VxVM VVR vxrlink INFO V-5-1-4467 Rlink rlk_lxsfrac01-priv_ora_rvg is up to date

==================================== 在主節點插入試驗數據 16:55 ================================

oracle@lxsfrac02 $ sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 5 16:55:12 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> create table test (a varchar(20) ) tablespace users ;

Table created.

SQL> insert into test values ('1') ;

1 row created.

SQL> commit ;

Commit complete.

SQL> insert into test values ('2' ) ;

1 row created.

SQL>
SQL>
SQL> commit ;

Commit complete.

====================================== 立即異常關閉oracle 和 操作系統 ============================

root@lxsfrac02 # ps -ef|egrep "ora_|asm_"|grep -v grep |grep -v crs|awk '{print $2}' |xargs kill -9
root@lxsfrac02 #
root@lxsfrac02 # ps -ef|grep ora
root 1930 1 0 16:08:13 ? 0:02 /opt/VRTSobc/pal33/bin/vxpal -a StorageAgent -x
oracle 19420 19419 0 16:55:12 ? 0:00 oracleracg1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 19414 19410 0 16:55:11 pts/3 0:00 -bash
oracle 19419 19414 0 16:55:12 pts/3 0:00 sqlplus /as sysdba
root 19872 3725 0 16:56:49 pts/2 0:00 grep ora
root@lxsfrac02 #
root@lxsfrac02 # poweroff

從系統日誌/var/tmp/messages可以查看到相關信息:

Nov 5 16:57:26 lxsfrac02 poweroff: [ID 662345 auth.crit] poweroffed by root

======================================= 在備用節點進行接管 =======================================

root@lxsfrac01 # vradmin -g oradg migrate ora_rvg lxsfrac01-priv
VxVM VVR vradmin WARNING V-5-52-93 Make sure applications using Primary data volumes are stopped.
vradmin: Continue with migrate (y/n)? y
Message from Host lxsfrac01-priv:
VxVM VVR vradmin ERROR V-5-52-449 Secondary ora_rvg does not have an active Primary.
root@lxsfrac01 #
root@lxsfrac01 # vradmin -g oradg takeover ora_rvg
root@lxsfrac01 # date
Mon Nov 5 17:05:13 CST 2007
root@lxsfrac01 # vxprint -htqg oradg
dg oradg default default 10000 1193985774.38.lxsfrac01

dm AMS_WMS0_2 AMS_WMS0_2 auto 65536 4116224 -
dm AMS_WMS0_3 AMS_WMS0_3 auto 65536 146687968 -

rv ora_rvg 1 ENABLED ACTIVE primary 1 srl
rl rlk_lxsfrac02-priv_ora_rvg ora_rvg ENABLED ACTIVE lxsfrac02-priv oradg rlk_lxsfrac01-priv_ora_rvg
v oravol ora_rvg ENABLED ACTIVE 20971520 SELECT - fsgen
pl oravol-01 oravol ENABLED ACTIVE 20971520 CONCAT - RW
sd AMS_WMS0_3-01 oravol-01 AMS_WMS0_3 0 20971520 0 AMS_WMS0_3 ENA
pl oravol-02 oravol ENABLED ACTIVE LOGONLY CONCAT - RW
sd AMS_WMS0_2-01 oravol-02 AMS_WMS0_2 0 352 LOG AMS_WMS0_2 ENA
pl oravol-03 oravol ENABLED ACTIVE LOGONLY CONCAT - RW
sd AMS_WMS0_3-03 oravol-03 AMS_WMS0_3 22609920 352 LOG AMS_WMS0_3 ENA
v srl ora_rvg ENABLED ACTIVE 1638400 SELECT - SRL
pl srl-01 srl ENABLED ACTIVE 1638400 CONCAT - RW
sd AMS_WMS0_3-02 srl-01 AMS_WMS0_3 20971520 1638400 0 AMS_WMS0_3 ENA
root@lxsfrac01 #

================================ 啓動備用節點Oracle數據庫,並檢查數據完整 ========================

root@lxsfrac01 # mount -F vxfs /dev/vx/dsk/oradg/oravol /oracle
root@lxsfrac01 #
root@lxsfrac01 # su - oracle
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
oracle@lxsfrac01 $ sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 5 17:05:37 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 2147483648 bytes
Fixed Size 2120448 bytes
Variable Size 496870656 bytes
Database Buffers 1644167168 bytes
Redo Buffers 4325376 bytes
Database mounted.
Database opened.
SQL> select * from test ;

A
--------------------
1
2

================================ 顯示數據正常 ===========================
SQL> !date
Mon Nov 5 17:06:58 CST 2007

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options


附:創建配置VVR過程中部分錯誤診斷

1.錯誤V-5-1-3370,備份異常中斷,複製不能繼續
root@lxsfrac01 # vxrlink -g oradg recover rlk_lxsfrac02-priv_ora_rvg
VxVM VVR vxrlink ERROR V-5-1-3370 Can not recover rlk_lxsfrac02-priv_ora_rvg until ora_rvg is recovered
root@lxsfrac01 # vxrecover -g oradg -s
root@lxsfrac01 # vxprint
………………顯示正常

2.錯誤V-5-52-449,需要檢查主、備節點磁盤組狀態爲import,並且volume/rlink/srl狀態爲enabled和active
root@lxsfrac01 # vradmin -g oradg -a startrep ora_rvg
Message from Host lxsfrac01-priv:
VxVM VVR vradmin ERROR V-5-52-449 Secondary ora_rvg does not have an active Primary.

在第二個節點vxdg import oradg
然後recover
直到兩個節點vxprint -htqg oradg都正常:ENABLED/ACTIVE

3. 錯誤V-5-1-434,我遇到了兩次,一次是在createpri,一次在addsec,原因是主備的DCM默認都需要mirror,所以所在的磁盤組 都最少包括兩塊磁盤(或LUN),通過vxdg -g oradg adddisk another_disk解決。

root@lxsfrac01 # vradmin -g oradg createpri ora_rvg /
> system,sysaux,temp,users,example,ctlfile1,ctlfile2,ctlfile3,redo101,redo102,redo103,undo11,spfile /
> srl
Message from Primary:
VxVM vxassist ERROR V-5-1-434 Cannot allocate space for 32 block log

root@lxsfrac01 # vradmin -g oradg addsec ora_rvg lxsfrac01-priv lxsfrac02-priv
Message from Host lxsfrac02-priv:
VxVM vxassist ERROR V-5-1-434 Cannot allocate space for 352 block log

4.檢查vvr後臺進程
root@lxsfrac02 # ps -ef|grep vrad|grep -v grep
root 9808 1 0 16:24:47 ? 0:00 /usr/sbin/vradmind
如果進程狀態不對,使用下面語句來手工啓動:
/etc/init.d/vras-vradmind.sh start

可以看到vradmin是隨系統自啓動的:
root@lxsfrac02 # find /etc/rc* -name '*vr*' -print
/etc/rc0.d/K01vras-vradmind
/etc/rc1.d/K01vras-vradmind
/etc/rc2.d/S96vradmind
/etc/rcS.d/K01vras-vradmind

 

轉自:http://tech.it168.com/db/2007-12-05/200712050035256.shtml

 

發佈了7 篇原創文章 · 獲贊 4 · 訪問量 44萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章