Wednesday, May 22, 2013

srvctl commands 11gr2

Here are some very handy srvctl commands in11gr2

$ srvctl status database -d GSXQ9_01

Instance GSXQ91 is running on node oesv5071
Instance GSXQ92 is running on node oesv6071
-d is db_unique_name of the database

$ srvctl status database -d GSXQ9_01 -v
Instance GSXQ91 is running on node oesv5071. Instance status: Open.
Instance GSXQ92 is running on node oesv6071 with online services SRV0GSXQ901,SRVGSXQ9RMN. Instance status: Open.
-v verbose mode as you see that when you login with service_name SRV0GSXQ901,SRVGSXQ9RMN
you be logon to instance GSXQ92.

to see witch instance is preferd or available use the following command

$ srvctl config service -d GSXQ9_01 -s SRV0GSXQ901
Service name: SRV0GSXQ901
Service is enabled
Server pool: GSXQ9_01_SRV0GSXQ901
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: true
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 5
TAF failover delay: 180
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: THROUGHPUT
TAF policy specification: BASIC
Edition:
Preferred instances: GSXQ91
Available instances: GSXQ92

Now set instance to preferred

srvctl modify service -d gsxq9_01 -s srv0gsxq901 -i GSXQ91,GSXQ92 -n

-d db_unique_name of database
-s service name
-i instance name
-n Only uses the instances named for this service (unnamed instances already assigned to the service are removed).

now lets see if it has worked

$ srvctl config service -d GSXQ9_01 -s SRV0GSXQ901
Service name: SRV0GSXQ901
Service is enabled
Server pool: GSXQ9_01_SRV0GSXQ901
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: true
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 5
TAF failover delay: 180
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: THROUGHPUT
TAF policy specification: BASIC
Edition:
Preferred instances: GSXQ91,GSXQ92
Available instances:
Oke it worked now lets make 1 instance available.

$ srvctl modify service -d gsxq9_01 -s srv0gsxq901 -n -i GSXQ91 -a GSXQ92

oke lets see if GSXQ92 is now an available instance again.

$ srvctl config service -d GSXQ9_01 -s SRV0GSXQ901
Service name: SRV0GSXQ901
Service is enabled
Server pool: GSXQ9_01_SRV0GSXQ901
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: true
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 5
TAF failover delay: 180
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: THROUGHPUT
TAF policy specification: BASIC
Edition:
Preferred instances: GSXQ91
Available instances: GSXQ92
the following command gives more information on the database

$ srvctl config service -d GSXQ9_01
Service name: SRV0GSXQ901
Service is enabled
Server pool: GSXQ9_01_SRV0GSXQ901
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: true
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 5
TAF failover delay: 180
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: THROUGHPUT
TAF policy specification: BASIC
Edition:
Preferred instances: GSXQ91
Available instances: GSXQ92
Service name: SRVGSXQ9RMN
Service is enabled
Server pool: GSXQ9_01_SRVGSXQ9RMN
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: true
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 5
TAF failover delay: 180
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: THROUGHPUT
TAF policy specification: BASIC
Edition:
Preferred instances: GSXQ91
Available instances: GSXQ92
now lets add a service_name

$ srvctl add  service -d GSXQ9_01 -s SRV0GSXQ999 -r GSXQ91 -a GSXQ92

now lets see if it exsist and which is the available an preferred instance.

$ srvctl config service -d GSXQ9_01 -s SRV0GSXQ999
Service name: SRV0GSXQ999
Service is enabled
Server pool: GSXQ9_01_SRV0GSXQ999
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: GSXQ91
Available instances: GSXQ92
and yes GSXQ91 is preferred and GSXQ92 is the available instance.

now how to remove the service_name

$ srvctl remove service -d GSXQ9_01 -s SRV0GSXQ999

$ srvctl config service -d GSXQ9_01 -s SRV0GSXQ999
PRCR-1001 : Resource ora.gsxq9_01.srv0gsxq999.svc does not exist
and yes it is gone

now lets relocate the service to an other instance

srvctl status database -d gsxq9_01 -v
Instance GSXQ91 is running on node oesv5071. Instance status: Open.
Instance GSXQ92 is running on node oesv6071 with online services SRV0GSXQ901,SRVGSXQ9RMN. Instance status: Open.
$ srvctl relocate service -s SRV0OGSXQ901 -d gsxq9_01 -i GSXQ92  -t GSXQ91

This will relocate the the service SRV0OGSXQ901  from instance GSXQ92  to GSXQ91

$ srvctl status database -d gsxq9_01 -v
Instance GSXQ91 is running on node oesv5071 with online services SRV0GSXQ901. Instance status: Open.
Instance GSXQ92 is running on node oesv6071 with online services SRVGSXQ9RMN. Instance status: Open.
you can run the same command with the -f (Force) option

$ srvctl relocate service -s SRV0OGSXQ901 -d gsxq9_01 -i GSXQ92  -t GSXQ91 -f

this will do the same but with -f all connection are disconnected immediately and where update/insert/delete statements will be rollback as without -f the statements will finished on the instance where the service was running before the will be closed.

now some basic commando as stopping/starting the database or an instance.

stop the whole database

$ srvctl stop database -d gsxq9_01

start the whole database

$ srvctl start database -d gsxq9_01

stop an instance

$srvctl stop instance -d  gsxq9_01 -i GSXQ92 
this will only stop instance GSXQ92 .

$srvctl stop instance -d  gsxq9_01 -i GSXQ92  -o abort
this stop the instance with the abort option

start an instance

$srvctl start instance -d  gsxq9_01 -i GSXQ92 
$srvctl start instance -d  gsxq9_01 -i GSXQ92  -o mount
the second command start the instance in mount fase.

stop a service_name

$ srvctl stop service -d odba5_01 -s SRV0ODBA501

start a service_name

$ srvctl start service -d odba5_01 -s SRV0ODBA501

$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:39000
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:39000
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:39000

$ srvctl config scan
SCAN name: prodcl21-scan, Network: 1/10.233.130.0/255.255.254.0/bond0
SCAN VIP name: scan1, IP: /10.233.130.221/10.233.130.221
SCAN VIP name: scan2, IP: /10.233.130.222/10.233.130.222
SCAN VIP name: scan3, IP: /10.233.130.223/10.233.130.223

$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node oesv3031
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node oesv3032
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running on node oesv3030

modify scan listener

$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:39000
$ srvctl modify scan_listener -p TCP:39000/TCPS:39003

$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:39000/TCPS:39003

as you see port tcps:39003 is added

$ srvctl stop scan_listener
$ srvctl start scan_listener



No comments:

Post a Comment