ITPub博客

首页 > 数据库 > Oracle > RAC 11.2.0.3 维护命令(三) SRVCTL管理services

RAC 11.2.0.3 维护命令(三) SRVCTL管理services

原创 Oracle 作者:SnowDBA 时间:2014-07-15 16:04:03 0 删除 编辑
一,创建服务
在实例1创建服务 team1
[oracle@node1 ~]$ srvctl add service -d PROD -s team1 -r "PROD1"
[oracle@node1 ~]$
[oracle@node1 ~]$ srvctl config database -d PROD
Database unique name: PROD
Database name:
Oracle home: /s01/oracle/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: PROD
Database instances: PROD1,PROD2
Disk Groups: DATA,ARCH
Mount point paths:
Services: team1
Type: RAC
Database is administrator managed

在实例2创建服务team2
[oracle@node1 ~]$ srvctl add service -d PROD -s team2 -r "PROD2"
[oracle@node1 ~]$
[oracle@node1 ~]$ srvctl config database -d PROD
Database unique name: PROD
Database name:
Oracle home: /s01/oracle/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: PROD
Database instances: PROD1,PROD2
Disk Groups: DATA,ARCH
Mount point paths:
Services: team1,team2
Type: RAC
Database is administrator managed


二,查看服务状态
刚刚创建好的服务team1, team2为离线状态
[grid@node1 ~]$ crsctl status res ora.prod.team1.svc -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.prod.team1.svc
      1        OFFLINE OFFLINE                                                  


[grid@node1 ~]$ crsctl status res ora.prod.team2.svc -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.prod.team2.svc
      1        OFFLINE OFFLINE     


三,启动服务
启动新建服务team1, team2
[grid@node1 ~]$ srvctl start service -d PROD -s team1

[grid@node1 ~]$ crsctl status res ora.prod.team1.svc -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.prod.team1.svc
      1        ONLINE  ONLINE       node1                                       


[grid@node1 ~]$ srvctl start service -d PROD -s team2
[grid@node1 ~]$ crsctl status res ora.prod.team2.svc -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.prod.team2.svc
      1        ONLINE  ONLINE       node2 


四,停止服务
停止新建服务team1, team2
[grid@node1 ~]$ srvctl stop service -d PROD -s team1

[grid@node1 ~]$ crsctl status res ora.prod.team1.svc -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.prod.team1.svc
      1        OFFLINE OFFLINE  


[grid@node1 ~]$ srvctl stop service -d PROD -s team2

[grid@node1 ~]$ crsctl status res ora.prod.team2.svc -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.prod.team2.svc
      1        OFFLINE OFFLINE 


五,禁用服务
[grid@node1 ~]$ srvctl disable service -d PROD -s team1

[grid@node1 ~]$ srvctl config service -d PROD
Service name: team1
Service is disabled
Server pool: PROD_team1
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: NONE
Edition:
Preferred instances: PROD1
Available instances:
Service name: team2
Service is enabled
Server pool: PROD_team2
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: NONE
Edition:
Preferred instances: PROD2

六,启用服务
[grid@node1 ~]$ srvctl enable service -d PROD -s team1

[grid@node1 ~]$ srvctl config service -d PROD
Service name: team1
Service is enabled
Server pool: PROD_team1
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: NONE
Edition:
Preferred instances: PROD1
Available instances:
Service name: team2
Service is enabled
Server pool: PROD_team2
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: NONE
Edition:
Preferred instances: PROD2
Available instances: 


七,查看服务状态
[grid@node1 ~]$ srvctl status service -d PROD
Service team1 is not running.
Service team2 is not running.

八,再次启动服务team1,team2
[grid@node1 ~]$ srvctl start service -d prod -s team1

[grid@node1 ~]$ srvctl start service -d prod -s team2

[grid@node1 ~]$ srvctl status service -d PROD
Service team1 is running on instance(s) PROD1
Service team2 is running on instance(s) PROD2

通过数据字典查看服务状态

SYS@PROD1> col name format a20
SYS@PROD1> col network_name for a20
SYS@PROD1> select inst_id,service_id,name,network_name from gv$services;

   INST_ID SERVICE_ID NAME                 NETWORK_NAME
---------- ---------- -------------------- --------------------
         1          3 team1                team1
         1          5 PRODXDB              PRODXDB
         1          6 PROD                 PROD
         1          1 SYS$BACKGROUND
         1          2 SYS$USERS
         2          4 team2                team2
         2          5 PRODXDB              PRODXDB
         2          6 PROD                 PROD
         2          1 SYS$BACKGROUND
         2          2 SYS$USERS

创建数据库会默认创建与全局数据库同名的Service名称,PROD。在查询结果中可以看到实例1,实例2都有一个相同名字的服务PROD。team1,team2为手工创建。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29047826/viewspace-1219610/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-06-21

  • 博文量
    223
  • 访问量
    1633584