新增叢集資料庫服務service

skyin_1603發表於2017-03-05

----測試目的:

1、新增公共的服務prod_tns

2、新增節點112服務 prod_node1

3、新增節點221服務 prod_node2

4、新增服務過程中是否有資源的狀態發生變化。

--新增共有服務:

srvctl add service -d prod -s prod_tns -r "prod1,prod2";

--新增節點1服務:

srvctl add service -d prod -s prod_node1 -r prod1 -a prod2 -P BASIC;

--新增節點2服務:

srvctl add service -d prod -s prod_node2 -r prod2 -a prod1 -P BASIC;

 

----檢視目前的服務名:

SQL> set lines 200

SQL> show parameter name

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_file_name_convert                 string

db_name                              string      prod

db_unique_name                       string      prod

global_names                         boolean     FALSE

instance_name                        string      prod1

lock_name_space                      string

log_file_name_convert                string

service_names                        string      prod

#該服務是搭建叢集庫的時候系統自動建立的服務。

 

----新增公共服務:

[oracle@node1 ~]$ srvctl add service -d prod -s prod_tns -r "prod1,prod2";

[oracle@node1 ~]$

 

----節點1新增服務:

[oracle@node1 ~]$ srvctl add service -d prod -s prod_node1 -r prod1 -a prod2 -P BASIC;

[oracle@node1 ~]$

 

----節點2新增服務:

[oracle@node2 ~]$ srvctl add service -d prod -s prod_node2 -r prod2 -a prod1 -P BASIC;

[oracle@node2 ~]$

#新增服務時候,可以在一個節點操作,也可以分別在各個節點新增對應自己的服務。

 

----檢視叢集所有的資源狀態:

[grid@node1 ~]$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS       

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.LISTENER.lsnr

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.OCR_VOTE.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.RCY.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.asm

               ONLINE  ONLINE       node1                    Started             

               ONLINE  ONLINE       node2                    Started             

ora.eons

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.gsd

               OFFLINE OFFLINE      node1                                        

               OFFLINE OFFLINE      node2                                        

ora.net1.network

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.ons

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.registry.acfs

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       node2                                        

ora.node1.vip

      1        ONLINE  ONLINE       node1                                        

ora.node2.vip

      1        ONLINE  ONLINE       node2                                        

ora.oc4j

      1        OFFLINE OFFLINE                                                   

ora.prod.db

      1        ONLINE  ONLINE       node1                    Open                

      2        ONLINE  ONLINE       node2                    Open                

ora.prod.prod_node1.svc

      1        OFFLINE OFFLINE                                                   

ora.prod.prod_node2.svc

      1        OFFLINE OFFLINE                                                   

ora.prod.prod_tns.svc

      1        OFFLINE OFFLINE                                                   

      2        OFFLINE OFFLINE                                                   

ora.scan1.vip

      1        ONLINE  ONLINE       node2                                        

[grid@node1 ~]$

#三個service資源已經新增上了,但新增的三個service資源還是offline狀態。

 

----嘗試設定新增的service自動開啟模式:

srvctl enable service -d prod -s prod_tns

srvctl enable service -d prod -s prod_node1

srvctl enable service -d prod -s prod_node2

 

[oracle@node1 ~]$ srvctl enable service -d prod -s prod_tns

PRCC-1010 : prod_tns was already enabled

#新增的服務已預設為自動開啟模式。

 

----開啟3個新增的服務:

srvctl start service -d prod -s prod_tns

srvctl start service -d prod -s prod_node1

srvctl start service -d prod -s prod_node2

 

[oracle@node1 ~]$ srvctl start service -d prod -s prod_tns

[oracle@node1 ~]$ srvctl start service -d prod -s prod_node1

[oracle@node1 ~]$ srvctl start service -d prod -s prod_node2

[oracle@node1 ~]$

--嘗試在節點2再次開啟節點2的服務

[oracle@node2 ~]$ srvctl start service -d prod -s prod_node2

PRCC-1014 : prod_node2 was already running

#節點2的服務可以在節點1中執行命令開啟。

 

----再次檢視叢集所有資源的狀態:

[grid@node1 ~]$ crsctl status res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS       

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.DATA.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.LISTENER.lsnr

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.OCR_VOTE.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.RCY.dg

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.asm

               ONLINE  ONLINE       node1                    Started             

               ONLINE  ONLINE       node2                    Started             

ora.eons

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.gsd

               OFFLINE OFFLINE      node1                                        

               OFFLINE OFFLINE      node2                                        

ora.net1.network

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.ons

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

ora.registry.acfs

               ONLINE  ONLINE       node1                                        

               ONLINE  ONLINE       node2                                        

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       node2                                        

ora.node1.vip

      1        ONLINE  ONLINE       node1                                        

ora.node2.vip

      1        ONLINE  ONLINE       node2                                        

ora.oc4j

      1        OFFLINE OFFLINE                                                   

ora.prod.db

      1        ONLINE  ONLINE       node1                    Open                

      2        ONLINE  ONLINE       node2                    Open                

ora.prod.prod_node1.svc

      1        ONLINE  ONLINE       node1                                        

ora.prod.prod_node2.svc

      1        ONLINE  ONLINE       node2                                        

ora.prod.prod_tns.svc

      1        ONLINE  ONLINE       node1                                        

      2        ONLINE  ONLINE       node2                                        

ora.scan1.vip

      1        ONLINE  ONLINE       node2                                        

[grid@node1 ~]$

#新增的3個服務現在都已線上狀態。

 

----檢視新增3個服務資訊狀態資訊

srvctl config service -d prod -s prod_tns

srvctl config service -d prod -s prod_node1

srvctl config service -d prod -s prod_node2

 

[oracle@node1 ~]$ srvctl config service -d prod -s prod_tns

Service name: prod_tns

Service is enabled

Server pool: prod_prod_tns

Cardinality: 2

Disconnect: false

Service role: PRIMARY

Management policy: AUTOMATIC

DTP transaction: false

AQ HA notifications: false

Failover type: NONE

Failover method: NONE

TAF failover retries: 0

TAF failover delay: 0

Connection Load Balancing Goal: LONG

Runtime Load Balancing Goal: NONE

TAF policy specification: NONE

Preferred instances: prod1,prod2

Available instances:

[oracle@node1 ~]$


[oracle@node1 ~]$ srvctl config service -d prod -s prod_node1

Service name: prod_node1

Service is enabled

Server pool: prod_prod_node1

Cardinality: 1

Disconnect: false

Service role: PRIMARY

Management policy: AUTOMATIC

DTP transaction: false

AQ HA notifications: false

Failover type: NONE

Failover method: NONE

TAF failover retries: 0

TAF failover delay: 0

Connection Load Balancing Goal: LONG

Runtime Load Balancing Goal: NONE

TAF policy specification: BASIC

Preferred instances: prod1

Available instances: prod2

[oracle@node1 ~]$


[oracle@node1 ~]$ srvctl config service -d prod -s prod_node2

Service name: prod_node2

Service is enabled

Server pool: prod_prod_node2

Cardinality: 1

Disconnect: false

Service role: PRIMARY

Management policy: AUTOMATIC

DTP transaction: false

AQ HA notifications: false

Failover type: NONE

Failover method: NONE

TAF failover retries: 0

TAF failover delay: 0

Connection Load Balancing Goal: LONG

Runtime Load Balancing Goal: NONE

TAF policy specification: BASIC

Preferred instances: prod2

Available instances: prod1

[oracle@node1 ~]$

#可以看到,新增的3個服務中,prod_tns服務是兩個節點公共的服務,不分主備關係;而

prod_node1服務是主要為節點1所有,主一備二關係;prod_node2服務則相反,是主要為節點2所有,主二備一關係。

 

----在例項中檢視服務的資訊:

SQL> show parameter name

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_file_name_convert                 string

db_name                              string      prod

db_unique_name                       string      prod

global_names                         boolean     FALSE

instance_name                        string      prod1

lock_name_space                      string

log_file_name_convert                string

service_names                        string      prod_tns, prod_node1

#服務成功新增並生效。

 

----注意:這裡特別要注意的一點是:在整個新增3個服務service資源的過程中,叢集中的所有資源都沒有發生狀態的變更,一直保持online狀態。
這也是我這次新增服務的主要目的:驗證
oracle11G在新增服務過程中有無導致部分叢集資源掉線或者自動重啟。這個在我的前些的博文中提及過
11G12C在新增服務中的區別。12C版本在新增服務的過程中,會導致叢集中的一些資源掉線,而且還需要手動才能啟動。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2134740/,如需轉載,請註明出處,否則將追究法律責任。

相關文章