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

一,创建服务
在实例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博客 ” ,链接:http://blog.itpub.net/29047826/viewspace-1219610/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29047826/viewspace-1219610/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值