Some useful SRVCTL commands
STOP DATABASE
srvctl stop database -d db_name [-o stop_options] where stop_options is normal/immediate(default)/transactional/abort
srvctl stop database -d TANSID -o normal
srvctl stop database -d TANSID -o immediate
srvctl stop database -d TANSID -o transactional
srvctl stop database -d TANSID -o abort
START DATABASE
srvctl start database -d db_name [-o start_options] where start_option is nomount/mount/open(default)
srvctl start database -d TANSID -o nomount
srvctl start database -d TANSID -o mount
srvctl start database -d TANSID -o open
STOP AN INSTANCE
srvctl stop instance -d db_unique_name [-i “instance_name_list”]} [-o stop_options] [-f]
srvctl stop instance -d TANSID -i TANSID1
START AN INSTANCE
srvctl start instance -d db_unique_name [-i “instance_name_list”} [-o start_options]
srvctl start instance -d TANSID -i TANSID1
REMOVING DB FROM CRS
srvctl remove database -d db_unique_name [-f] [-y] [-v]
srvctl remove database -d TANSID -f -y
ADDING DB IN CRS
srvctl add database -d db_unique_name -o ORACLE_HOME [-p spfile]
srvctl add database -d TANSID -o /oracle/product/19.3.0 -p +DATA/TANSID/parameterfile/spfileTANSID.ora
REMOVING AN INSTANCE FROM CRS
srvctl remove instance -d DB_UNIQUE_NAME -i INSTANCE_NAME
srvctl remove instance -d TANSID - i TANSID1
ADDING AN INSTANCE TO CRS
srvctl add instance –d db_unique_name –i inst_name -n node_name
srvctl add instance -d TANSID - i TANSID1 -n racnode1
Enable/disable auto restart of the instance
srvctl enable instance -d DB_UNIQUE_NAME-i INSTANCE_NAME
srvctl disable instance -d DB_UNIQUE_NAME-i INSTANCE_NAME
Enable/disable auto restart of the database
srvctl enable database -d DB_UNIQUE_NAME
srvctl disable database -d DB_UNIQUE_NAME
ADDING A SERVICE
srvctl add servicec -d {DB_NAME} -s {SERVICE_NAME} -r {“preferred_list”} -a {“available_list”} [-P {BASIC | NONE | PRECONNECT}]
srvctl add service -d TANSID -s TANSIDNEW -r "TANSID1,TANSID2" -a "TANSID2" -P BASIC
REMOVING A SERVICE:
srvctl remove service -d {DB_NAME} -s {SERVICE_NAME}
srvctl remove service TANSID -s TANSIDNEW
START A SERVICE
srvctl start service -d {DB_NAME} -s {SERVICE_NAME}
srvctl start service -d TANSID -s TANSIDNEW
STOP A SERVICE
srvctl stop servicec -d {DB_NAME} -s {SERVICE_NAME}
srvctl stop service -d TANSID -s TANSIDNEW
RELOCATE A SERVICE
srvctl relocate service -d {database_name} -s {service_name} -i {old_inst_name} -r {new_inst_name}
(Relocating service TANSID from TANSID1 to NEWTANSID1)
srvctl relocate service -d TANSID -s TANSIDNEW -i TANSID1 -t NEWTANSID1
Check the status of service
srvctl status service -d {database_name} -s {service_name}
srvctl status service -d TANSID -s TANSIDNEW
Check the configuration of the service
srvctl config service -d {database_name} -s {service_name}
srvctl config service -d TANSID -s TANSIDNEW
Check scan listener configuration
srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
Registration invited nodes:
Registration invited subnets:
SCAN Listener is enabled.
SCAN Listener is individually enabled on nodes:
SCAN Listener is individually disabled on nodes:
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521
Registration invited nodes:
Registration invited subnets:
SCAN Listener is enabled.
SCAN Listener is individually enabled on nodes:
SCAN Listener is individually disabled on nodes:
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521
Registration invited nodes:
Registration invited subnets:
SCAN Listener is enabled.
SCAN Listener is individually enabled on nodes:
SCAN Listener is individually disabled on nodes:
Modify scan_listener port
srvctl modify scan_listener -p {new-SCAN-port}
srvctl modify scan_listener -p 1522
$GRID_HOME/bin/srvctl stop scan_listener
$GRID_HOME/bin/srvctl start scan_listener
Alter system set remote_listener='test-scan.appsolworld.com:1522' scope=both sid='*'
Enable trace for srvctl commands:
-- set this to enable trace at os
SRVM_TRACE=true
export SRVM_TRACE
-- run any srvctl command
srvctl status database -d TANSID
Set environment variables through srvctl.
-- setenv to set env variables.(TANSID is the db_unique_name)
srvctl setenv database -db ORCL -env "ORACLE_HOME=/oracle/product/19.3.0"
srvctl setenv database -db ORCL -env "TNS_ADMIN=/oracle/product/19.3.0/network/admin"
Getenv to view the env setting
srvctl getenv database -db TANSID
TANSID
ORACLE_HOME=/oracle/product/19.3.0
TNS_ADMIN=/oracle/product/19.3.0/network/admin
Check status and config of ASM instance
srvctl config asm
ASM home:
Password file: +DAC1/orapwASM
ASM listener: LISTENER
srvctl status asm
ASM is running on node1,node2
Stop and start services running from ORACLE_HOME
srvctl stop home -oraclehome /oracle/product/19.3.0 -statefile /home/oracle/state.txt -node dbnode1
srvctl start home -oraclehome /oracle/product/19.3.0 -statefile /home/oracle/state.txt -node dbnode2
Configure Listener:
srvctl add listener -listener tansid -endpoints "1524" -oraclehome /tnbtyi/oracle/product/19.3.0
SRVCTL Command to list the scan-ip
srvctl config scan
Check all resources configured
$ crsctl status resource
$ crsctl status resource ora.staii14.vip NAME=ora.staii14.vip TYPE=ora.cluster_vip_net1.type TARGET=ONLINE STATE=ONLINE on staii14The following example shows the start dependencies for a resource named
ora.newdb.db
:$ crsctl status resource ora.newdb.db -dependency ora.newdb.db(ora.database.type)
Comments
Post a Comment