11gR2维护service
1、添加service
[root@H096 bin]# su - oracle
[oracle@H096 ~]$ srvctl add service -h
Adds a service configuration to the Oracle Clusterware.
Usage: srvctl add service -d -s {-r "" [-a ""] [-P {BASIC | NONE | PRECONNECT}] | -g [-c {UNIFORM. SINGLETON}] } [-k ] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z ] [-w ] [-t ] [-f]
-d Unique name for the database
-s Service name
-r "" Comma separated list of preferred instances
-a "" Comma separated list of available instances
-g Server pool name
-c {UNIFORM. SINGLETON} Service runs on every active server in the server pool hosting this service (UNIFORM) or just one server (SINGLETON)
-k network number (default number is 1)
-P {NONE | BASIC | PRECONNECT} TAF policy specification
-l Role of the service (primary, physical_standby, logical_standby, snapshot_standby)
-y Management policy for the service (AUTOMATIC or MANUAL)
-e Failover type (NONE, SESSION, or SELECT)
-m Failover method (NONE or BASIC)
-w Failover delay
-z Failover retries
-t Edition (or "" for empty edition value)
-j Connection Load Balancing Goal (SHORT or LONG). Default is LONG.
-B Runtime Load Balancing Goal (SERVICE_TIME, THROUGHPUT, or NONE)
-x Distributed Transaction Processing (TRUE or FALSE)
-q AQ HA notifications (TRUE or FALSE)
Usage: srvctl add service -d -s -u {-r "" | -a ""} [-f]
-d Unique name for the database
-s Service name
-u Add a new instance to service configuration
-r Name of new preferred instance
-a Name of new available instance
-f Force the add operation even though a listener is not configured for a network
-h Print usage
[oracle@H096:/home/oracle]$srvctl add service -d test -s srv_test -r test1 -a test2,test3 -P basic -e select -m basic -z 180 -w 5
2、查看service状态和属性
[oracle@H096:/home/oracle]$crs_stat |grep svc
NAME=ora.test.srv_test.svc
[oracle@H096:/home/oracle]$srvctl start service -d test -s srv_test
[oracle@H096:/home/oracle]$crsctl status resource ora.test.srv_test.svc -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.test.srv_test.svc
1 ONLINE ONLINE h096
SQL> select name, failover_method, failover_type, goal, clb_goal from dba_services
NAME FAILOVER_M FAILOVER_T GOAL CLB_G
---------------------------------------- ---------- ---------- ------------ -----
SYS$BACKGROUND NONE SHORT
SYS$USERS NONE SHORT
test LONG
srv_test BASIC SELECT NONE LONG
[oracle@H096:/home/oracle]$srvctl status service -d test
Service srv_test is running on instance(s) test1
[oracle@H096:/home/oracle]$srvctl config service -d test -s srv_test
Service name: srv_test
Service is enabled
Server pool: test_srv_test
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 180
TAF failover delay: 5
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Preferred instances: test1
Available instances: test2,test3
[oracle@H096:/home/oracle]$lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-AUG-2013 16:10:34
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 21-AUG-2013 17:11:19
Uptime 0 days 22 hr. 59 min. 14 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/grid/diag/tnslsnr/H096/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.109)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.110)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM5", status READY, has 1 handler(s) for this service...
Service "srv_test" has 1 instance(s).
Instance "test1", status READY, has 1 handler(s) for this service...
Service "test" has 1 instance(s).
Instance "test1", status READY, has 1 handler(s) for this service...
The command completed successfully
3、修改服务
--srvctl modify service -d test -s srv_test -r test2 -a test1 -P basic -e select -m basic -z 100 -w 2
4、删除服务
--srvctl remove service -d test -s srv_test -f
[oracle@H096:/home/oracle]$srvctl remove service -h
Removes the service from Oracle Clusterware management.
Usage: srvctl remove service -d -s [-i ] [-f]
-d Unique name for the database
-s Service name
-i Instance name
-f Force remove
-h Print usage
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24996904/viewspace-769063/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24996904/viewspace-769063/