天天看點

Oracle 11gR2 RAC 新特性說明

最近接觸了一下Oracle 11g R2 的RAC,發現變化很大。 是以在自己動手做實驗之前還是先研究下它的新特性比較好。

一.    官網介紹

先看一下Oracle 的官網文檔裡對RAC 新特性的一點說明。

Oracle Database 11g Release 2 (11.2.0.2) New Features in Oracle RAC

<a href="http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/whatsnew.htm#CHDJAGEE">http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/whatsnew.htm#CHDJAGEE</a>

This section describes the Oracle Database 11g release 2 (11.2) features for Oracle RAC administration and deployment.

Oracle RAC One Node

Oracle Real Application Clusters One Node (Oracle RAC One Node) provides enhanced high availability for single-instance databases, protecting them from both planned and unplanned downtime. Oracle RAC One Node provides the following:

(1)Always-on single-instance database services

(2)Better consolidation for database servers

(3)Enhanced server virtualization

(4)Lower cost development and test platform for full Oracle RAC

In addition, Oracle RAC One Node facilitates the consolidation of database storage, standardizes your database environment, and, when necessary, enables you to upgrade to a full, multinode Oracle RAC database without downtime or disruption.

Online database relocation is a tool you can use to relocate an Oracle RAC One Node database from one node to another while maintaining service availability.

This feature includes enhancements to the Server Control Utility (SRVCTL) for both Oracle RAC One Node and online database relocation.

This feature also includes enhancements to the Database Configuration Assistant (DBCA) to enable you to use the tool to add an Oracle RAC One Node database.

Edition-Based Redefinition

You can specify an edition attribute for a database service using SRVCTL. When you specify an edition attribute for a service, all subsequent connections that specify the service use this edition as the initial session edition.

Specifying an edition as a service attribute can help to manage resource usage. For example, services associated with an edition can be placed on a separate instance in an Oracle RAC environment, and the Oracle Database Resource Manager can manage resources used by different editions by associating resource plans with the corresponding services.

Enhancements to SRVCTL for Grid Infrastructure Management

Enhancements to SRVCTL simplify the management of various new Oracle grid infrastructure and Oracle RAC resources.

Oracle Database Quality of Service Management Server

The Oracle Database Quality of Service Management server allows system administrators to manage application service levels hosted in Oracle Database clusters by correlating accurate runtime performance and resource metrics and analyzing with an expert system to produce recommended resource adjustments to meet policy-based performance objectives.

Oracle Database 11g Release 2 (11.2.0.1) New Features in Oracle RAC

This section describes the Oracle Database 11g release 2 (11.2.0.1) features for Oracle RAC administration and deployment.

Grid Plug and Play

Grid Plug and Play reduces per-node configuration data and the need for explicit add and delete nodes steps, where possible. This allows a system administrator to take a template system image and run it on a node to be added with no further configuration. This removes many manual operations, reduces the opportunity for errors, and encourages configurations that can be changed more easily. Removal of the per-node configuration makes the nodes easier to replace because it is not required that they contain individual states that must be managed.

All tools and utilities such as DBCA, the Oracle Net Configuration Assistant (NETCA), and SRVCTL have been updated to support Grid Plug and Play. Oracle Enterprise Manager, the graphical interface for managing Oracle RAC, provides management and monitoring for the Grid Plug and Play environment.

Grid Plug and Play reduces the cost of installing, configuring, and managing database nodes by making their per-node state disposable. Nodes can easily be replaced with regenerated state.

Policy-based cluster and capacity management

Oracle Clusterware allocates and reassigns capacity based on policies you define, enabling faster resource failover and dynamic capacity assignment using policy-based management.

Policy-based cluster and capacity management allows the efficient allocation of different types of applications in the cluster. Various applications can be hosted on a shared infrastructure, being isolated regarding their resource consumption by policies and, therefore, behave as if they were deployed in single-system environments. Policy-managed Oracle RAC databases use policy-based cluster management to provide the required resources for the workloads the database supports.

Role-separated management

Role-separated management for Oracle Clusterware allows certain administrative tasks to be delegated to different people, representing different roles in the company. It is based on the idea of a clusterware administrator, who can grant administrative tasks on a per resource basis. For example, if two databases are placed into the same cluster, the cluster administrator can manage both databases in the cluster. But, the cluster administrator can also decide to grant different administrative privileges to each DBA responsible for each one of those databases.

Role-separated management enables multiple applications and databases to share the same cluster and hardware resources, but ensures that different administration groups do not interfere with each other.

Improved Cluster Resource Modeling

Oracle Clusterware can manage different types of applications and processes. You can create dependencies among the applications and processes and manage them as a single entity.

Oracle Enterprise Manager-based Oracle Clusterware resource management

You can use Oracle Enterprise Manager to manage Oracle Clusterware resources. You can create and configure resources in Oracle Clusterware and also monitor and manage resources after they are deployed in the cluster.

Oracle Cluster Registry performance enhancements

Improvements in the way Oracle Clusterware accesses Oracle Cluster Registry (OCR) speed up relocation of services when a node fails. Oracle Clusterware now supports up to five copies of OCR for improved availability of the cluster and OCR can now be stored in Oracle ASM.

The tools to manage OCR have changed to support the new management options. Consistent storage management automation provides improved performance in Oracle Clusterware and Oracle RAC environments, and easier management of the cluster.

SRVCTL support for single-instance database

Server Control Utility (SRVCTL) commands have been enhanced to manage the configuration in a standalone server using Oracle Restart. The new SRVCTL functionality enables you to register a single-instance database that can be managed by Oracle Clusterware. Once registered, Oracle Clusterware can start, stop, monitor, and restart the database instance.

The new SRVCTL functionality simplifies management of Oracle Database through a consistent interface that can be used from the console or scripted. An improved management interface makes it easy to provide higher availability for single-instance databases that run on a server that is part of a cluster.

Enhanced Cluster Verification Utility

New Cluster Verification Utility (CVU) functionality checks certain storage types and configurations. Also, more consideration is given to user-specific settings.

In addition to command-line commands, these checks are done through the Oracle Universal Installer, DBCA, and Oracle Enterprise Manager. These enhancements facilitate implementation and configuration of cluster environments and provide assistance in diagnosing problems in a cluster environment, improving configuration and installation.

Oracle Enterprise Manager support for Grid Plug and Play

You can use Oracle Enterprise Manager:

To support the Grid Plug and Play environment

To administer dynamic configuration use

To manage Grid Plug and Play profiles and targets, such as hosts, clusters, and Oracle RAC databases and Oracle RAC database instances

Additionally, Oracle Enterprise Manager supports other Oracle RAC administration tasks, including:

Monitoring:

Startup

Shutdown

Backup and recovery

Tablespace management

Node addition

Oracle Enterprise Manager provisioning for Oracle Clusterware and Oracle RAC

The Oracle Enterprise Manager provisioning framework has been updated to reflect the changes to the installation and configuration of Oracle Clusterware and Oracle RAC. You can achieve easier implementation and management of a clustered database environment using the Oracle Enterprise Manager provisioning framework.

Zero downtime for patching Oracle RAC

Patching Oracle Clusterware and Oracle RAC can be completed without taking the entire cluster down. This also allows for out-of-place upgrades to the cluster software and Oracle Database, reducing the planned maintenance downtime required in an Oracle RAC environment.

Integrated support for application failover in an Oracle Data Guard configuration

Applications connected to a primary database transparently failover to a new primary database when Oracle Data Guard changes roles. Clients integrated with Fast Application Notification (FAN) can achieve fast failover between primary and standby databases, in addition to fast failover within the cluster. Services have an attribute with which you can associate the service with a database role, such as PHYSICAL_STANDBY, so that the service is only active when the database is mounted in the associated role.

Oracle ASM Dynamic Volume Manager

The Oracle ASM Dynamic Volume Manager is a kernel-loadable device driver that provides a standard device driver interface to clients, such as the Oracle Automatic Storage Management Cluster File System (Oracle ACFS). Oracle ASM Dynamic Volume Manager is the primary I/O interface for Oracle ACFS to perform I/O and build a file system using Oracle Automatic Storage Management (Oracle ASM) as a volume manager. Oracle ASM Dynamic Volume Manager is loaded upon Oracle ASM startup, is cluster aware, and communicates with Oracle ASM for extent map information, extent rebalancing, and I/O failures.

Oracle ASM Dynamic Volume Manager provides a standard I/O interface allowing general-purpose file systems to leverage the full functionality of Oracle ASM as a volume manager. Files not directly supported by Oracle ASM, such as Oracle binaries, can now reside on ACFS on Oracle ASM volumes. This eliminates the need for third-party file systems or volume managers to host general-purpose files.

Oracle Enterprise Manager support for Oracle Automatic Storage Management Cluster File System

Oracle Enterprise Manager provides a comprehensive management solution that extends Oracle ASM technology to support all customer application data files, both database and non-database, and in both single-host and cluster configurations. It also enhances existing Oracle Enterprise Manager support for Oracle ASM, and adds features to support the Oracle ASM Dynamic Volume Manager (ADVM) and Oracle ASM Cluster File System (ACFS) technology.

Oracle Enterprise Manager provides a graphical user interface that makes it easier to manage the environment, whether it is a standalone server or a cluster deployment of Oracle ASM. The centralized console provides a consistent interface for managing volumes, database files, file systems, and the Oracle Database.

Oracle Automatic Storage Management Cluster File System

The Oracle Automatic Storage Management Cluster File System (Oracle ACFS) provides a robust, modern, general purpose file system for files beyond the Oracle database files. Oracle ACFS also provides support for files such as Oracle binaries, report files, trace files, alert logs, and other application data files. With the addition of Oracle ACFS, Oracle ASM becomes a complete storage management solution for both Oracle database and non-database files.

Additionally, Oracle ACFS

(1)Supports large files with 64-bit file and file system data structure sizes leading to exabyte-capable file and file system capacities

(2)Uses extent-based storage allocation for improved performance

(3)Uses a log-based metadata transaction engine for file system integrity and fast recovery

(4)Can be exported to remote clients through industry standard protocols such as NFS and CIFS

Oracle ACFS complements and leverages Oracle ASM and provides a general purpose journaling file system for storing and managing non-Oracle database files. This eliminates the need for third-party cluster file system solutions, while streamlining, automating, and simplifying all file type management in both single node and Oracle RAC and Grid computing environments.

Oracle ACFS supports dynamic file system expansion and contraction without any downtime and is also highly available, leveraging the Oracle ASM mirroring and striping features in addition to hardware RAID functionality.

Automatic Storage Management file access control

This feature implements access control on Oracle ASM files on UNIX platforms to isolate itself and different database instances from each other and prevent unauthorized access. The feature includes SQL statements to grant, modify, and deny file permissions.

This feature enables multiple database instances to store their Oracle ASM files in the same disk group and enables consolidation of multiple databases, securely, to prevent database instances from accessing or overwriting files belonging to other database instances.

Universal Connection Pool

Universal Connection Pool (UCP) is a Java connection pool that replaces the deprecated JDBC Implicit Connection Cache with Oracle Database 11g (11.1.0.7). UCP is integrated with Oracle RAC to provide the following benefits:

(1)A single UCP can be leveraged by any Oracle component or user.

(2)Eliminates redundant connection pools from several Oracle Components, such as AOL/J, ADF Business Components, and TopLink.

(3)Provides consistent connection pool behavior for an Oracle component or product. For example, the connection pool sizes can be configured to provide consistent connection management behavior for an application.

(4)Provides JMX interfaces for the UCP Manager, which delivers a consistent management interface to manage the connection pool.

(5)UCP adapters can provide standards compliance for a specific connection type being pooled.

(6)Supports connection pooling for Oracle and non-Oracle connections.

(7)Supports pooling for any type of connections, including JDBC or JCA connections.

Expose high availability events through a Java API

You can access fast application notification (FAN) events with a simplified JAVA API if you are not using the Oracle connection pool features.

SRVCTL enhancements to support Grid Plug and Play

This feature includes enhancements to the server control utility (SRVCTL) for the Grid Plug and Play feature.

二. 網上的資料:

2.1  11gR2 RAC 安裝配置中的三個重要調整

2.2.1.  ASMLIB 和 CRS內建在了一起,在安裝GRID的時候CRS和ASM一起來配置,OCR和VOTING DISK 在新裝11G R2 RAC上必須使用ASM或者NFS,已經不支援RAW和塊裝置,如果是從11G R1,或者10G更新到11G R2 OCR,VOTING DISK将被繼續支援。

2.2.2. 使用OUI,DBCA建立資料庫的時候已經不支援裸裝置了,如果要用裸裝置需要用手工來建立資料庫。

2.2.3. 用戶端tnsnames.ora使用SCAN IP 替代原來的直接配置配置VIP,簡化了用戶端的配置。而且在增加,删除節點後不需要對tnsnames.ora檔案進行調整。

2.2  Oracle 11gR2新特性

    Oracle 11gR2将自動存儲管理 (ASM) 和 Oracle Clusterware 內建在 Oracle Grid Infrastructure 中。Oracle ASM 和 Oracle Database 11gR2 提供了較以前版本更為增強的存儲解決方案,該解決方案能夠在 ASM 上存儲 Oracle Clusterware檔案,即 Oracle 叢集系統資料庫 (OCR) 和表決檔案(VF,又稱為表決磁盤)。這一特性使 ASM 能夠提供一個統一的存儲解決方案,無需使用第三方卷管理器或叢集檔案系統即可存儲叢集件和資料庫的所有資料;

Oracle 11gR2 中引入了SCAN(single client access name),即簡單用戶端連接配接名,一個友善用戶端連接配接的接口;在Oracle 11gR2之前,client連結資料庫的時候要用vip,假如cluster有4個節點,那麼用戶端的tnsnames.ora中就對應有四個主機vip的一個連接配接串,如果cluster增加了一個節點,那麼對于每個連接配接資料庫的用戶端都需要修改這個tnsnames.ora。SCAN簡化了用戶端連接配接,用戶端連接配接的時候隻需要知道這個名稱,并連接配接即可, 每個SCAN VIP對應一個scan listener, cluster内部的service在每個scan listener上都有注冊,scan listener接受用戶端的請求,并轉發到不同的Local listener中去,由local 的listener提供服務給用戶端。

此外,安裝GRID的過程也簡化了很多,核心參數的設定可保證安裝的最低設定,驗證安裝後執行fixup.sh即可,此外ssh互信設定可以自動完成,尤其不再使用OCFS及其複雜設定,直接使用ASM存儲,在HP-UX11.31上無需額外的叢集軟體(如Service Guard for RAC Extendsion)即可安裝.

2.2.1 随處可見的叢集

  在以前的版本中,Oracle Clusterware必須要獨立地安裝在它自己的ORACLE HOME中,并且也隻能在RAC環境下使用,這一切在Oracle 11g R2得到徹底颠覆,因為在這個版本中支援安裝Oracle網格基礎架構,而且隻需要一個獨立的ORACLE HOME,它包括了Oracle Clusterware和Oracle自動存儲管理(ASM)。通過更新後的Oracle通用安裝程式安裝了網格基礎架構後,你将會看到一個全新的功能和服務矩陣,如:

  單執行個體RAC(Oracle重新開機): Oracle 11g R2擴充了Oracle Clusterware的功能,為任何單執行個體提供了高可用特性,本質上是将資料庫變成了單執行個體RAC資料庫。Oracle 11g R2中的Oracle重新開機特性幫助Oracle網格基礎架構的高可用服務控制伺服器重新開機時哪一個監聽器,ASM執行個體和資料庫應該啟動,它完全取代了過去DBA們經常用到的DBSTART腳本。同樣,當單個資料庫執行個體崩潰或其它異常終止時,Oracle重新開機功能會自動監測失效的執行個體,并自動重新開機它,就好像是在一個真實的RAC環境中一樣。

  SRVCTL更新:如果你管理過舊版本的RAC環境,你可能已經熟悉了RAC環境中的維護工具SRVCTL,在11g R2中,該工具被擴充了,現在可以管理單執行個體RAC,以及監聽器和ASM執行個體。

  叢集時間同步服務:Oracle 11g R2現在需要在所有RAC節點上配置時間同步,如果你曾經經曆過某個節點被驅逐出RAC叢集配置,你一定知道其難度有多大,特别是兩個伺服器的時間不同步和日志檔案的時間戳不同步時,Oracle之前的版本借助系統提供的網絡時間協定(NTP)同步所有節點時間,但這需要連接配接到網際網路上的标準時間伺服器,作為NTP的替代者,Oracle 11g R2提供了一個新的叢集時間同步服務,確定叢集中的所有節點的時間都保持一緻。

  網格即插即用:在以前的版本中,配置RAC最複雜的部分是确定和設定所有節點都需要用到的公共ip位址,私有ip位址和虛拟ip位址。為了簡化RAC的安裝,Oracle 11g R2提供了一個全新的網格名稱服務(GNS),它和域名伺服器協作,處理每個網格元件的ip位址配置設定,當叢集環境跨越多個資料庫時這個新特性極其有用。

  幹淨地解除安裝RAC元件:如果你曾經嘗試過删除多個節點上的所有RAC痕迹,那一定會鐘情于這項新特性,在Oracle 11g R2中,所有安裝和配置助手,特别是Oracle通用安裝程式(OUI),資料庫配置助手(DBCA)和網絡配置助手(NETCA),都得到了增強,當需要解除安裝RAC元件時,可以保證卸得幹幹淨淨。

2.2.2  ASM加入了叢集

ASM和Oracle 11g R2 Clusterware安裝在同一個Oracle Home下,是以消除了之前推薦的備援Oracle Home安裝方法,并且ASM也從DBCA脫離出來了,有了專門的自動存儲管理配置助手(ASMCA)。

智能化資料布局:在之前的版本中,要配置ASM磁盤可能需要存儲管理者的參與,需要配置磁盤I/O子系統,Oracle 11g R2提供了ASM配置設定單元,可以直接受益于磁盤外緣柱面,獲得更快的速度,可以将資料檔案,重做日志檔案和控制放在磁盤外緣獲得更好的性能。

  EM支援工作台擴充:在這個版本中對Oracle 11g R1引入到企業管理控制台中的自動診斷倉庫(ADR)進行了擴充,包括支援ASM診斷,将所有診斷資訊打包直接發送給Oracle技術支援,以便獲得更快速的ASM性能問題解決方案。

  ASMCMD增強:自動存儲管理指令行實用工具(ASMCMD)也獲得了不少增強,包括:

     1) 啟動和停止ASM執行個體;

     2) 備份,恢複和維護ASM執行個體的伺服器參數檔案(spfile);

     3) 實用iostat監控ASM磁盤組的性能;

     4) 維護新的ASM叢集檔案系統(ACFS)中的磁盤卷,目錄和檔案存儲,我的下一個話題就是它。

2.2.3  ACFS – 一個強健的叢集檔案系統

  Oracle之前也釋出過叢集檔案系統(OCFS),之後又釋出了增強版OCFS2,它讓Oracle RAC執行個體可以通過共享存儲讀寫資料庫檔案,重做日志檔案和控制檔案。

  此外,OCFS也允許RAC資料庫的Oracle叢集注冊檔案(OCR)和表決磁盤存儲在叢集檔案系統中,在Oracle 10g R2中,這個需求被取消了,OCR檔案和表決磁盤可以存儲在裸裝置或裸塊裝置中,如果你曾經在原始裝置上丢失過這些檔案的所有副本,你一定了解要恢複它們是多麼繁瑣,是以,在Oracle 11g R2中,将不再支援将這些檔案存儲在裸裝置上。

  為了提高這些關鍵檔案的存活能力,Oracle 11g R2正式引入了一種新的叢集檔案系統,稱之為ASM叢集檔案系統(ACFS: automatic cluster file system),在RAC環境中,ACFS可以為OCR檔案和表決磁盤提供更好的保護,它允許建立五份OCR檔案副本,之前的叢集檔案系統僅允許儲存兩份OCR檔案,一個主OCR,一個鏡像OCR,但ACFS不适合單獨的RAC環境,除此之外,幾乎所有與作業系統和資料相關的檔案都可以從ACFS的安全性和檔案共享特性受益。

 

  動态卷管理器: Oracle 11g R2提供了一個新的ASM動态卷管理器(ADVM)來配置和維護存儲在ACFS檔案系統中的檔案,使用ADVM可以在ASM磁盤組内建構一個ADVM卷裝置,管理存儲在ADVM卷裝置中的檔案,以及按需調整ADVM卷裝置空間大小,最重要的是,因為ADVM是建構在ASM檔案系統架構之上的,可以保證存儲在這些卷中的檔案受到良好的保護,不會出現意外丢失,因為ASM提供了類似RAID的磁盤陣列的功能。

  檔案通路控制:使用傳統的Windows風格通路控制清單(ACL)或Unix/Linux下的使用者/組/其它通路權限風格為ACFS目錄和檔案授予讀,寫和執行權限,可以通過圖形化的企業管理控制台或指令行程式ASMCMD管理ACFS目錄和檔案安全。

  檔案系統快照(FSS):Oracle 11g R2通過它的檔案系統快照(FSS)功能可以對ACFS檔案系統執行快照,一個快照是所選ACFS檔案系統的一個隻讀副本,對相同的ACFS,它會自動保留63個獨立的ACFS快照,當某個ACFS檔案被不經意地更新,删除或其它危險操作時,這個特性非常有用,利用11g R2企業管理控制台或ACFS acfsutil指令行工具可以找出該檔案合适的版本并執行恢複。

2.2.4 改善的軟體安裝和打更新檔過程

  作為一名DBA壓力最大的活就是給Oracle資料庫打更新檔了,如果更新檔可能會引入對資料庫有害的行為,我不得不花費大量的時間和精力來确定和稽核.

叢集驗證明用程式內建:從Oracle 10g開始引入了叢集驗證明用程式(CVU),現在已經完全內建到Oracle通用安裝程式(OUI)和其它配置助手(如DBCA,DBUA)中了。

  零停機修補的叢集:當為Oracle叢集打更新檔時,Oracle 11g R2在一個不合适的位置更新方式應用更新檔,這意味着會有兩個Oracle Home,其中一個專門用來存放更新檔的,但一次隻能激活一個Oracle Home,在Oracle 11g R2中不用再為更新全部關閉Oracle叢集了,實作真正的零停機打更新檔。

2.2.5  DBMS_SCHEDULER更新

  DBMS_SCHEDULER包得到了徹底的更新,DBA經常使用這個包來排程作業。

  

檔案螢幕:以前的版本無法在批處理過程中檢測大多數觸發事件,如檢測一個檔案抵達某個目錄,在Oracle 11g R2中,使用新的檔案螢幕可以緩解這個問題,一旦預期的檔案抵達目錄,DBMS_SCHEDULER現在就可以檢測到了,并在新的對象類型SCHEDULER_FILEWATCHER_RESULT中注冊它的到來,它通過新的CREATE_FILE_WATCHER存儲過程向DBMS_SCHEDULER發送一個信号觸發作業。

  内置的email通知:無論何時,DBMS_SCHEDULER排程任務啟動、失敗或完成時,任務的狀态可以立即通過email發送出去,雖然在以前的版本中也能實作這個功能,但要麼調用DBMS_MAIL存儲過程,要麼調用DBMS_SMTP存儲過程,現在這個功能合并到DBMS_SCHEDULER中了。

  遠端作業:DBMS_SCHEDULER現在允許DBA在遠端資料庫上建立和排程作業,現在我終于可以在生産庫上通過DBMS_SCHEDULER調用生産庫DBMS_SCHEDULER上的存儲過程執行任務了,這意味着我現在可以在一台資料庫上集中建立和維護排程任務了。

  多作業目标:最後,現在可以在多個資料庫執行個體上同時排程DBMS_SCHEDULER任務了,在RAC環境中,這個特性非常有用,因為我可以利用多個資料庫執行個體将長時間運作任務分成幾部分,分别在不同的資料庫執行個體上執行更小的任務.

2.3           SCAN(Single Client Access Name)

在Oracle 11gR2以前,如果資料庫采用了RAC架構,在用戶端的tnsnames中,需要配置多個節點的連接配接資訊,進而實作諸如負載均衡,failover等等RAC的特性。是以,當資料庫RAC叢集需要添加或删除節點時,需要及時對用戶端機器的tns進行更新,以免出現安全隐患。

在11gR2中,為了簡化該項配置工作,引入了SCAN(Single Client Access Name)的特性,該特性的好處在于,在資料庫與用戶端之間,添加了一層虛拟的服務層,就是所謂的scan ip以及scan ip listener,在用戶端僅需要配置scan ip的tns資訊,通過scan ip listener,連接配接背景叢集資料庫。這樣,不論叢集資料庫是否有添加或者删除節點的操作,均不會對client産生影響。

2.3.1 SCAN(Single Client Access Name)的架構以及配置

在11gR2中,安裝RAC發生的巨大變化,在10g以及11gR1的時代,安裝RAC的步驟是先安裝CRS,再安裝DB,而到了11gR2的時代,crs與asm被內建在一起,合稱為GRID,必須先安裝GRID後,才能繼續安裝DB。

在11gR2中,SCAN IP是作為一個新增IP出現的,原有的CRS中的VIP仍然存在。在11gR2的RAC架構中,SCAN IP并非獨立存在的,而是和原有的 VIP結合在一起的。它們的工作原理如圖:

     從圖可以看出,scan ip其實是oracle在用戶端與資料庫之間,新加的一個連接配接層,當有用戶端通路時,連接配接到 SCAN IP LISTENER, 而SCAN IP LISTENER接收到連接配接請求時,會根據 LBA 算法(所謂LBA算法,就是least loaded instance),将該用戶端的連接配接請求,轉發給對應的instance上的VIP LISTENER,進而完成了整個用戶端與伺服器的連接配接過程。簡化如下:

      Client -&gt; scan listener -&gt; local listener -&gt; local instance

SCAN包含在安裝grid的過程中。SCAN的定義,有兩種途徑:

    1. 在DNS中定義域名。

  2. 通過oracle提供的Grid Naming Server(GNS)實作DHCP自定義。

   如果通過dns來定義,則需要在網絡中定義3個SCAN IP位址,指向同一個域名,這3個ip位址必須處于同一個子網内,同時域名不能太長。另外,SCAN IP是由oracle clusterware管理的,是以在主機的叢集軟體(如IBM HACMP,HP SERVICE GUARD)中不能将此ip配置進去,類似于10g中的vip,在grid安裝前,此IP是無法ping通的。

    範例:

    scan-ip.tianlesoftware.com  IN A 192.168.1.111

                                        IN A 192.168.1.112

                                        IN A 192.168.1.113

  如果使用GNS的方式,則必須有DHCP服務,在cluster的配置過程中,将會自動向DHCP伺服器申請3個IP位址作為SCAN IP使用。

除了SCAN IP,在cluster的配置過程中,SCAN IP LISTENER服務也會被建立,每個SCAN IP對應一個SCAN IP LISTENER,并且,為了提升高可用性,3個SCAN IP以及其對應的SCAN IP LISTENER将被獨立的配置設定到各個節點上。如果cluster中其中某個運作scan ip的節點出現異常,則其餘兩個正常的scan ip節點将自動接管。

注意,如果用戶端是11gR2的版本,則用戶端隻需在tns中配置域名解析,即可實作failover,如果用戶端版本低于11gR2,則無法通過域名解析出3個SCAN IP位址,是以如果要實作failover,必須在用戶端的tns中配置3個SCAN IP的位址進行解析,這也是為何oracle強烈建議在使用11gR2資料庫時,用戶端也最好使用11gR2的原因。

如:

 $srvctl config scan_listener

SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521

     SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521

     SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521

$srvctl config scan

SCAN name: scan-ip, Network: 1/192.168.1.0/255.255.255.0/

    SCAN VIP name: scan1, IP: /scan-ip.tianlesoftware.com/192.168.1.111

    SCAN VIP name: scan2, IP: /scan-ip.tianlesoftware.com/192.168.1.112

    SCAN VIP name: scan3, IP: /scan-ip.tianlesoftware.com/192.168.1.113

2.3.2    SCAN IP 配置方法及使用

  SCAN IP是跟資料庫instance無關的,例如一個12節點的RAC,隻有3個SCAN IP,并且SCAN IP是随機分布在各個instance的,那麼,SCAN IP LISTENER如何監聽各個節點的資料庫呢,該怎麼配置哪個instance去哪個SCAN IP LISTENER注冊?

 SCAN IP 和 SCAN LISTENER是獨立于RAC的各個節點的,而每個節點的 VIP , VIP LISTENER是跟instance綁定的,每個節點的VIP LISTENER,會監聽自己所屬節點的instance。

 是以,在資料庫中,我們需要設定remote_listener參數,這個參數設定很有講究,因為scan ip有3個,scan listener也有三個,但是他們對應的是同一個域名,是以,在資料庫中,我們需要使用easy connect naming method方式,就是在sqlnet.ora的配置檔案中,必須有NAMES.DIRECTORY_PATH=(tnsnames,ezconnect)存在。

另外,配置remote_listener的方式也有講究,以前的版本中,我們通常是在tnsnames.ora中寫好remote_listener的位址以及端口,但是對于scan listener,不能這麼做,必須按照标準格式,設定成REMOTE_LISTENER=SCAN:PORT的形式,

如: REMOTE_LISTENER=scan-ip.tianlesoftware.com:1521,而不需要在tnsnames.ora中進行額外設定。

經過以上設定後,RAC資料庫的每個節點的PMON程序,會用廣播的方式向每個SCAN LISTENER進行注冊,同時CRS的背景程序ONS,會采集各個節點的負載狀況,通知scan listener,以便scan listener根據負載情況,将新連接配接配置設定到目前負載最低的節點上。

2.4  10gR2 RAC 與11gR2 RAC安裝時的三方面不同

2.4.1  netca的配置不同

(1)oracle 10gR2 rac 是在安裝完oracle clusterware和oracle database 後,需要手工運作netca,這時監聽才配置完成

(2)oracle 11gR2 rac 是在安裝完oracle grid時運作完root.sh腳本後,自動會運作netca,監聽配置完成,并且多了listener_scan1監聽名稱

2.4.2  dbca的配置不同

(1)oracle 10gR2 rac dbca支援asm,共享檔案系統,裸裝置三種建庫時存放資料檔案方法

(2)oracle 11gR2 rac dbca隻支援asm,共享檔案系統,不再支援裸裝置的方法來建庫

2.4.3 TAF的配置不同

(1)oracle 10gR2 rac taf配置可以通過dbca圖形工具來配置

(2)oracle 11gR2 rac taf配置隻能通過EM圖形工具來配置

 轉:http://blog.csdn.net/tianlesoftware/article/details/5982972

本文轉自 張沖andy 部落格園部落格,原文連結:http://www.cnblogs.com/andy6/p/5766639.html   ,如需轉載請自行聯系原作者