Saturday, June 29, 2019


SRVCTL command for ASM
To add/remove the ASM
    Command: srvctl add asm [-l lsnr_name] [-p spfile] [-d asm_diskstring]
    Command: srvctl remove asm -l [-f]
    Example: srvctl add asm -l LISTENER_ASM01 -p +diskg_data/spfile.ora
    Example: srvctl remove asm -l LISTENER_ASM01 -f
To start/stop the ASM
    Command: srvctl start asm [-n node_name] [-o start_options]
    Example: srvctl start asm -n lnxrac1
    Command: srvctl stop asm [-n node_name] [-o stop_options] [-f]
    Example: srvctl stop asm -n lnxrac1 -f
To check the status of the ASM
    Command: srvctl status asm [-n node_name] [-a]
    Example: srvctl status asm -n lnxrac1 -a
To enable/disable ASM
    Command: srvctl enable asm [-n node_name]
    Example: srvctl enable asm -n lnxrac1
    Command: srvctl disable asm [-n node_name]
    Example: srvctl disable asm -n lnxrac1
To configure the ASM
    Command: srvctl config asm [-a]
    Example: srvctl config asm -a
To modify the ASM parameters
    Command: srvctl modify asm [-n node_name] [-l listener_name] [-d asm_diskstring] [-p spfile_path]
    Example: srvctl modify asm -l listener01
To get/set/unset the environment of ASM
    Example: srvctl getenv asm
    Example: srvctl setenv asm -t LANG=en
    Example: srvctl unsetenv asm -t CLASSPATH

SRVCTL : For Database 


To Add Database
    srvctl add database -d racdb -o /db/oracle/app/oracle/product/11.2/
To Remove Database
    srvctl remove database -d racdb
To Start Database with different option
    srvctl start database -d racdb -o nomount
    srvctl start database -d racdb -o mount
    srvctl start db -d racdb
    srvctl start database -d racdb -o open
To Stop Database with different option
    srvctl stop database -d racdb -o transactional
    srvctl stop database -d racdb -o immediate
    srvctl stop database -d racdb -o abort
    srvctl stop db -d racdb -o immediate
To check the status of the database
    srvctl status database -d racdb -v service_name
    srvctl status database -d racdb
To enable and disable database
    srvctl enable database -d racdb
    srvctl disable db -d racdb
To configure databasee option
    srvctl config database -d racdb
To modify database settings
    srvctl modify database -d racdb -r logical_standby
    srvctl modify db -d racdb -p /db/oracle/oradata/racdb/spfilebhavik_test.ora -- moves p file
    srvctl modify database -d racdb -o /db/oracle/app/oracle/product/11.2/ -s open
To get/set/unset the environment settings
    srvctl getenv database -d racdb
    srvctl setenv database -d racdb -t "TNS_ADMIN=/db/oracle/app/oracle/product/11.2/asm/network/admin"
    srvctl setenv db -d racdb -t LANG=en
    srvctl unsetenv database -d racdb -t CLASSPATH

SRVCTL command for Diskgroup:
To add the diskgroup
There is no command like srvctl add for Oracle ASM disk groups. Disk groups are automatically added to the Oracle Restart configuration when they are first mounted.
But if in case you have removed a disk group from the Oracle Restart configuration and want to add it back you can connect to the Oracle ASM instance with SQL*Plus and use an ALTER DISKGROUP ... MOUNT command.
To remove the diskgroup
    Command: srvctl remove diskgroup -g diskgroup_name [-n node_list] [-f]
    Example: srvctl remove diskgroup -g DiskGroup1 -f
To start the diskgroup
    Command: srvctl start diskgroup -g diskgroup_name [-n node_list]
    Example: srvctl start diskgroup -g diskgroup1 -n lnxrac1, lnxrac2
To stop the diskgroup
    Command: srvctl stop diskgroup -g diskgroup_name [-n node_list] [-f]
    Example: srvctl stop diskgroup -g ASM_DG02
    Example: srvctl stop diskgroup -g diskgroup2 -n lnxrac1,lnxrac2 -f
To check the status of the diskgroup
    Command: srvctl status diskgroup -g diskgroup_name [-n node_list] [-a]
    Example: srvctl status diskgroup -g diskgroup2 -n lnxrac1,lnxrac2 -a
To enable the diskgroup
    Command: srvctl enable diskgroup -g diskgroup_name [-n node_list]
    Example: srvctl enable diskgroup -g diskgroup1 -n lnxrac1,lnxrac2
To disable the diskgroup
    Command: srvctl disable diskgroup -g diskgroup_name [-n node_list]
    Example: srvctl disable diskgroup -g diskgroup3 -n lnxrac1, lnxrac2
SRVCTL command for SCAN(Single Client Access Name):
To Add a SCAN
    Command: srvctl add scan -n nodename
    Example: srvctl add scan -n lnxrac1
To Remove a SCAN
Example: srvctl remove scan [-f]
Note: Below command is using ordinal_number parameter so An ordinal number is that identifies which SCAN VIP you want to start. The range of values you can specify for this option is 1 to 3.
To Start a SCAN
    Command: srvctl start scan [-i ordinal_number] [-n node_name]
    Example: srvctl start scan -i 1 -n lnxrac1
To Stop a SCAN
    Command: srvctl stop scan [-i ordinal_number] [-f]  
    Example: srvctl stop scan -i 1
To Check status of SCAN
    Command: srvctl status scan [-i ordinal_number]
    Example: srvctl status scan -i 1
To Enable a SCAN
    Command: srvctl enable scan [-i ordinal_number]
    Example: srvctl enable scan -i 1
To Disable a SCAN
    Command: srvctl disable scan [-i ordinal_number]
    Example: srvctl disable scan -i 3


To Configure a SCAN
    Command: srvctl config scan [-i ordinal_number]
    Example: srvctl config scan -i 2
To Modify SCAN
    Command: srvctl modify scan -n scan_name
    Example: srvctl modify scan -n SCAN1
To Relocate a SCAN
    Command: srvctl relocate scan -i ordinal_number [-n node_name]
    Example: srvctl relocate scan -i 2 -n lnxrac2

SRVCTL command for SCAN Listner:
To add SCAN Listener
    Command: srvctl add scan_listener [-l lsnr_name_prefix] [-s] [-p "[TCP:]port_list[/IPC:key][/NMP:pipe_name][/TCPS:s_port] [/SDP:port]"]
    Example: srvctl add scan_listener -l scanlistener01
To Remove Scan Listener
    Command: srvctl remove scan_listener [-f]
    Example: srvctl remove scan_listener -f
Note: Below command is using ordinal_number parameter so An ordinal number is that identifies which SCAN VIP you want to start. The range of values you can specify for this option is 1 to 3.
To Start Scan Listener
    Command: srvctl start scan_listener [-n node_name] [-i ordinal_number]
    Example: srvctl start scan_listener -n lnxrac1 -i 1
To Stop Scan Listener
    Command: srvctl stop scan_listener [-i ordinal_number] [-f]
    Example: srvctl stop scan_listener -i 3
To check the status of Scan Listner
    Command: srvctl status scan_listener [-i ordinal_number]
    Example: srvctl status scan_listener -i 1
 To Enable Scan Listener
    Command: srvctl enable scan_listener [-i ordinal_number]
    Example: srvctl enable scan_listener -i 2
To Disable Scan Listener
    Command: srvctl disable scan_listener [-i ordinal_number]
    Example: srvctl disable scan_listener -i 1
To Configure Scan Listener
    Command: srvctl config scan_listener [-i ordinal_number]
    Example: srvctl config scan_listener -i 3
To Modify Scan Listener
    Command: srvctl modify scan_listener {-p [TCP:]port[/IPC:key][/NMP:pipe_name] [/TCPS:s_port][/SDP:port] -u }
    Example: srvctl modify scan_listener -u -p TCP:1521
To relocate Scan Listener
    Command: srvctl relocate scan_listener -i ordinal_number [-n node_name]
    Example: srvctl relocate scan_listener -i 1 -n lnxrac2

SRVCTL for Service:
To add a service
         Command: srvctl add service -d db_name -s service_name -r pref_insts [-a avail_insts] [-P TAF_policy]
         Command: srvctl add service -d db_name -s service_name -u {-r "new_pref_inst" | -a "new_avail_inst"}
         Example: srvctl add service -d RAC -s PRD -r RAC01,RAC02 -a RAC03,RAC04
         Example: srvctl add serv -d CRM -s CRM -r CRM1 -a CRM3 -P basic
To remove a service
         Command: srvctl remove service -d db_name -s service_name [-i inst_name] [-f]
         Example: srvctl remove serv -d rac -s sales
         Example: srvctl remove service -d rac -s sales -i rac01,rac02
 To start a service
         Command: srvctl start service -d db_name [-s service_names [-i inst_name]] [-o start_options]
         Command: srvctl start service -d db_name -s service_names [-o open]
         Command: srvctl start service -d db_name -s service_names -o nomount
         srvctl start service -d db_name -s service_names -o mount
         srvctl start serv -d dwh -s dwh
To stop a service
         Command: srvctl stop service -d db_name [-s service_names [-i inst_name]] [-f]
         srvctl stop serv -d dwh -s dwh
To view the status of Service
         Command: srvctl status service -d db_name [-s service_names] [-f] [-v] [-S level]
         srvctl status service -d rac -s rac
TO enable the service at cluster startup
         Command: srvctl enable service -d db_name -s service_names [-i inst_name]
         srvctl enable service -d apps -s apps1
To disable the service at cluster startup
         Command: srvctl disable service -d db_name -s service_names [-i inst_name]
         Example: srvctl disable serv -d rac -s rac -i rac1
To view the config service
         Command: srvctl config service -d db_name [-s service_name] [-a] [-S level]
         Command: srvctl config service -d db_name -a -- -a shows TAF configuration
         Example: srvctl config service -d TEST -s test PREF:TST1 AVAIL:TST2
To modify the service
         Command: srvctl modify service -d db_name -s service_name -i old_inst_name -t new_inst_name [-f]
         Command: srvctl modify service -d db_name -s service_name -i avail_inst_name -r [-f]
         Command: srvctl modify service -d db_name -s service_name -n -i preferred_list [-a available_list] [-f]
         Command: srvctl modify service -d db_name -s service_name -i old_inst_name -a avail_inst -P TAF_policy
         Example: srvctl modify serv -d PROD -s DWH -n -i I1,I2,I3,I4 -a I5,I6
To relocate service
         Command: srvctl relocate service -d db_name -s service_name -i old_inst_name -t target_inst [-f]
To Get/set the environment for Service
         Command: srvctl getenv service -d db_name -s service_name -t name_list
         Command: srvctl setenv service -d db_name [-s service_name] {-t "name=val[,name=val,...]" | -T "name=val"}
         Command: srvctl unsetenv service -d db_name -s service_name -t name_list
11gR2
         Command: srvctl add service -d db_unique_name -s service_name
         -g server_pool [-c {UNIFORM|SINGLETON}] [-k network_number]
         [-l [PRIMARY|PHYSICAL_STANDBY|LOGICAL_STANDBY|SNAPSHOT_STANDBY]
         [-y {AUTOMATIC|MANUAL}] [-q {TRUE|FALSE}] [-j {SHORT|LONG}]
         [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}]
         [-m {NONE|BASIC}] [-P {BASIC|NONE|PRECONNECT}] [-x {TRUE|FALSE}]
         [-z failover_retries] [-w failover_delay]
To add service with service goals 

Example: srvctl add service -d rac -s rac1 -q TRUE -m BASIC -e SELECT -z 180 -w 5 -j LONG
To add service wih preconnect taf
         Command: srvctl add service -d db_unique_name -s service_name -u {-r preferred_list | -a available_list}
         Example: srvctl add serv -d rac -s report -r rac01,rac02 -a rac03 -P PRECONNECT
To start service
         Command: srvctl start service -d db_unique_name [-s "service_name_list" [-n node_name | -i instance_name]] [-o start_options]
         Example: srvctl start serv -d rac -s rac
         Example: srvctl start service -d rac -s rac -i rac2
To stop service
         srvctl stop service -d db_unique_name [-s "service_name_list"] [-n node_name | -i instance_name] [-f]
         srvctl stop service -d rac -s rac
         srvctl stop serv -d rac -s rac -i rac2
To view service
         srvctl status service -d db_unique_name [-s "service_name_list"] [-f] [-v]
         srvctl status service -d rac -s rac -v
To modify the service
Command: srvctl modify service -d db_unique_name -s service_name
[-c {UNIFORM|SINGLETON}] [-P {BASIC|PRECONNECT|NONE}]
[-l {[PRIMARY]|[PHYSICAL_STANDBY]|[LOGICAL_STANDBY]|[SNAPSHOT_STANDBY]
} [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] 
[-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z failover_retries] [-w failover_delay] [-y {AUTOMATIC|MANUAL}]  
Command: srvctl modify service -d db_unique_name -s service_name -i old_instance_name -t new_instance_name [-f]
Command: srvctl modify service -d db_unique_name -s service_name -i avail_inst_name -r [-f]
Command: srvctl modify service -d db_unique_name -s service_name -n -i preferred_list [-a available_list] [-f]
 
         Example: srvctl modify service -d rac -s rac -i rac1 -t rac2
         Example: srvctl modify serv -d rac -s rac -i rac1 -r
         Example: srvctl modify service -d rac -s rac -n -i rac1 -a rac2
To relocate the service
         Command: srvctl relocate service -d db_unique_name -s service_name {-c source_node -n target_node|-i old_instance_name -t new_instance_name} [-f]
         Example: srvctl relocate service -d rac -s rac -i rac1 -t rac3

SRVCTL for Instance
To add the instance
    Command: srvctl add instance -d db_name -i inst_name -n node_name
    Example: srvctl add instance -d racdb -i rac01 -n lnxrac1
To Remove the instance
    Command: srvctl remove instance -d db_name -i inst_name
    Example: srvctl remove instance -d racdb -i rac01

To Start the instance
    Command: srvctl start instance -d db_name -i inst_names [-o start_options] [-c connect_str|-q]
    Command: srvctl start instance -d db_name -i inst_names [-o open]
    Command: srvctl start instance -d db_name -i inst_names -o nomount
    Command: srvctl start instance -d db_name -i inst_names -o mount
    Example: srvctl start instance -d racdb -i rac02
To start the instance in Oracle 11g:
    Command: srvctl start instance -d db_unique_name {-n node_name -i "instance_name_list"} [-o start_options]
    Example: srvctl start instance -d racdb -n lnxrac2
    Example: srvctl start instance -d racdb -i "rac02,rac03"
To stop the instance
    Command: srvctl stop instance -d db_name -i inst_names [-o stop_options] [-c connect_str|-q]
    Command: srvctl stop instance -d db_name -i inst_names [-o normal]
    Command: srvctl stop instance -d db_name -i inst_names -o transactional
    Command: srvctl stop instance -d db_name -i inst_names -o immediate
    Command: srvctl stop instance -d db_name -i inst_names -o abort
    Example: srvctl stop instance -d racdb -i rac03
To stop the instance in Oracle 11g:
    Command: srvctl stop instance -d db_unique_name {[-n node_name]|[-i "instance_name_list"]} [-o stop_options] [-f]
    Example: srvctl stop instance -d racdb -n lnxrac1
    Example: srvctl stop instance -d racdb -i rac01
To check the status of the instance
    Command: srvctl status instance -d db_name -i inst_names [-f] [-v] [-S level]
    Example: srvctl status instance -d racdb -i rac02
To check the status of the instance in Oracle 11g:
    Command: srvctl status instance -d db_unique_name {-n node_name | -i "instance_name_list"} [-f] [-v]
    Example: srvctl status instance -d racdb -i "rac01,rac02" -v
To enable/disable the instance
    Command: srvctl enable instance -d db_name -i inst_names
    Example: srvctl enable instance -d racdb -i "rac01,rac02"
    Command: srvctl disable instance -d db_name -i inst_names
    Example: srvctl disable inst -d racdb -i "rac01,rac03"
To set dependency of instance to ASM
    Command: srvctl modify instance -d db_name -i inst_name {-s asm_inst_name|-r} 
    Command: srvctl modify instance -d db_unique_name -i instance_name {-n node_name|-z}
    Example: srvctl modify instance -d racdb -i rac01 -n lnxrac1
    Example: srvctl modify instance -d racdb -i rac01 -z
To move the database instance
    Command: srvctl modify instance -d db_name -i inst_name -n node_name 
    Example: srvctl modify instance -d racdb -i rac02 -n lnxrac1
To remove the database instance
    Command: srvctl modify instance -d db_name -i inst_name -r 
    Example: srvctl modify instance -d racdb -i rac01 -r
To get/set/unset the environment configuration of the instance
    Command: srvctl getenv instance -d db_name -i inst_name [-t name_list]
    Example: srvctl getenv instance -d racdb -i rac01
    Command: srvctl setenv instance -d db_name [-i inst_name] {-t "name=val[,name=val,...]" | -T "name=val"}
    Example: srvctl setenv instance -d racdb -i rac01 [options]
    Command: srvctl unsetenv instance -d db_name [-i inst_name] [-t name_list]
    Example: srvctl unsetenv instance -d racdb -i rac01 [-t options]

Post a Comment: