Use the srvctl command to configure the service

Source: Internet
Author: User

. Use the srvctl command to configure the service

 

In addition to using DBCA graphics, you can also use commands to configure services. This method is especially useful for remote maintenance. Both creation and maintenance use the srvctl command. First, let's take a look at the srvctl command and service-related syntax, as shown below:

Create a service

[Oracle @ felix1 ~] $ Srvctl add service-h

Usage: srvctl add service-d <name>-s <service_name>-r "<preferred_list>" [-a "<available_list>"] [-P <TAF_policy>]

-D <name> Unique name forthe database

-S <service> Service name

-R "<pref_list>" List ofpreferred instances

-A "<avail_list>" List ofavailable instances

-P <TAF_policy> TAF policy (NONE, BASIC, or PRECONNECT)

Usage: srvctl add service-d <name>-s <service_name>-u {-r "<new_pref_inst>" |-a "<new_avail_inst> "}

-D <name> Unique name forthe database

-S <service> Service name

-U Add a new instance to serviceconfiguration

-R <new_pref_inst> Name of newpreferred instance

-A <new_avail_inst> Name of new available instance

-H Print usage

[Oracle @ felix1 ~] $

Example:

Felix1, felix2 indicates the Instance name; Felix indicates the database name; Policy: BASIC

[Oracle @ felix1 ~] $ Srvctl add service-d felix-s taf_srvctl-r felix2-a felix1-P BASIC

[Oracle @ felix1 ~] $

 

View service configurations

[Oracle @ felix1 ~] $ Srvctl config service-d felix-

Taf_server PREF: felix1 AVAIL: felix2 TAF: basic

Taf_srvctl PREF: felix2 AVAIL: felix1 TAF: BASIC

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $ Srvctl config service-d felix-h

Usage: srvctl config service-d <name> [-s <service_name>] [-a] [-S <level>]

-D <name> Unique name forthe database

-S <service> Service name

-A Additional attributes

-S <level> Additionalinformation for EM Console

-H Print usage

[Oracle @ felix1 ~] $

If "-s service_name" is not specified, all service configurations are displayed, including preferred and avilable instance. Use the-a option to display TAF information.

 

Automatic or not

When the database is started, all services are automatically started. Sometimes this feature needs to be disabled for maintenance purposes. Start this feature after maintenance is complete.

 

[Oracle @ felix1 ~] $ Srvctl disable service-h

Usage: srvctl disable service-d <name>-s "<service_name_list>" [-I <inst_name>]

-D <name> Unique name forthe database

-S "<serv,...>" Commaseparated service names

-I <inst> Instance name

-H Print usage

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $ Srvctl disable service-d felix-s taf_server-I felix1

[Oracle @ felix1 ~] $ Srvctl config service-d felix-

Taf_server PREF: felix1 AVAIL: felix2 TAF: basic

Service taf_server is disabled on instance (s) felix1.

Taf_srvctl PREF: felix2 AVAIL: felix1 TAF: BASIC

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $ Srvctl disable service-d felix-s taf_server

The PRKP-1024: The service taf_server is stillrunning.

 

Disable service and diable:

 

[Oracle @ felix1 ~] $ Srvctl stop service-h

Usage: srvctl stop service-d <name> [-s "<service_name_list>" [-I <inst_name>] [-f]

-D <name> Unique name forthe database

-S "<serv,...>" Commaseparated service names

-I <inst> Instance name

-F Disconnect all sessionsduring stop or relocate service operations

-H Print usage

[Oracle @ felix1 ~] $ Srvctl stop service-d felix-staf_server

[Oracle @ felix1 ~] $ Srvctl config service-d felix-

Taf_server PREF: felix1 AVAIL: felix2 TAF: basic

Taf_srvctl PREF: felix2 AVAIL: felix1 TAF: BASIC

[Oracle @ felix1 ~] $ Srvctl disable service-d felix-s taf_server

[Oracle @ felix1 ~] $ Srvctl config service-d felix-

Taf_server PREF: felix1 AVAIL: felix2 TAF: basic

Service taf_server is disabled.

Taf_srvctl PREF: felix2 AVAIL: felix1 TAF: BASIC

[Oracle @ felix1 ~] $

Start service

[Oracle @ felix1 ~] $ Srvctl start service-h

Usage: srvctl start service-d <name> [-s "<service_name_list>" [-I <inst_name>] [-o <start_options>]

-D <name> Unique name forthe database

-S "<serv,...>" Commaseparated service names

-I <inst> Instance name

-O <start_options> Options to startupcommand (e.g. open, mount, or nomount)

-H Print usage

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $Srvctl start service-d felix-s taf_server

[Oracle @ felix1 ~] $

 

View the service status.

[Oracle @ felix1 ~] $ Srvctl status service-h

Usage: srvctl status service-d <name> [-s "<service_name_list>"] [-f] [-v] [-S <level>]

-D <name> Unique name forthe database

-S "<serv,...>" Commaseparated service names

-F Include disabled applications

-V Verbose output

-S <level> Additionalinformation for EM Console

-H Print usage

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $ Srvctl status service-d felix-s taf_server-f-v

Service taf_server is running on instance (s) felix2

[Oracle @ felix1 ~] $ Srvctl status service-d felix-s taf_server-f-v-S 3

# @ = Info: operation = {status} config = {full} ver = {10.2.0.0.0}

# @ = Service [0]: name = {taf_server} enabled = {true} pref = {felix1} avail = {felix2} disabled_insts = {felix1} tafpolicy = {basic} type = {user}

# @ = Service [1]: name = {felix} enabled = {true} pref = {felix1, felix2} avail = {} disabled_insts = {} tafpolicy = {NONE} type = {internal}

Service taf_server is running on instance (s) felix2

# @ = Result [0]: up = {felix2} down = {felix1} disabled = {felix1} unknown = {}

# @ = Result [1]: up = {felix1, felix2} down = {} disabled = {} unknown = {}

##= Done: status = {0}

[Oracle @ felix1 ~] $

 

Delete a service.

[Oracle @ felix1 ~] $ Srvctl remove service-h

Usage: srvctl remove service-d <name>-s <service_name> [-I <inst_name>] [-f]

-D <name> Unique name forthe database

-S <service> Service name

-I <inst> Instance name

-F Force remove

-H Print usage

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $ Srvctl status service-d felix

Service taf_server is running oninstance (s) felix1

Service taf_srvctl is not running.

[Oracle @ felix1 ~] $ Srvctl remove service-d felix-s taf_server-I felix1

Taf_server PREF: felix1 AVAIL: felix2

Remove service taf_server from the instancefelix1? (Y/[n]) y

The PRKP-1024: The service taf_server is still running.

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $ Srvctl remove service-d felix-s taf_srvctl-I felix1

Taf_srvctl PREF: felix2 AVAIL: felix1

Remove service taf_srvctl from the instancefelix1? (Y/[n]) y

PRKP-1067: Instance felix1 is the last availableinstance for service taf_srvctl. Try modify service instead.

[Oracle @ felix1 ~] $ Srvctl config service-d felix-

Taf_server PREF: felix1 AVAIL: felix2 TAF: basic

Taf_srvctl PREF: felix2 AVAIL: felix1 TAF: BASIC

[Oracle @ felix1 ~] $

 

[Oracle @ felix1 ~] $Srvctl remove service-d felix-staf_srvctl-f

[Oracle @ felix1 ~] $ Srvctl config service-d felix-

Taf_server PREF: felix1 AVAIL: felix2 TAF: basic

[Oracle @ felix1 ~] $ Srvctl remove service-d felix-s taf_server-f

The PRKP-1024: The service taf_server is still running.

[Oracle @ felix1 ~] $Srvctl stop service-d felix-staf_server

[Oracle @ felix1 ~] $ Srvctl remove service-d felix-s taf_server-f

[Oracle @ felix1 ~] $ Srvctl config service-d felix-

[Oracle @ felix1 ~] $

Modify Service

[Oracle @ felix1 ~] $ Srvctl modify service-h

Usage: srvctl modify service-d <name>-s <service_name>-I <old_inst_name>-t <new_inst_name> [-f]

-D <name> Unique name forthe database

-S <service> Service name

-I <old_inst> Old instance name

-T <new_inst> New instance name

-F Disconnect all sessionsduring stop or relocate service operations

Usage: srvctl modify service-d <name>-s <service_name>-I <avail_inst_name>-r [-f]

-D <name> Unique name forthe database

-S <service> Service name

-I <inst> Instance name

-R Upgrade instance to preferred

-F Disconnect all sessionsduring stop or relocate service operations

Usage: srvctl modify service-d <name>-s <service_name>-n-I <prefered_inst> [-a <available_list>] [-f]

-D <name> Unique name forthe database

-S <service> Service name

-N Modify service configuration

-R "<pref_list>" List of preferred instances

-A "<avail_list>" List ofavailable instances

-F Disconnect all sessionsduring stop or relocate service operations

Usage: srvctl modify service-d <name>-s <service_name>-P <TAF_policy> [-f]

-D <name> Unique name forthe database

-S <service> Service name

-P <TAF_policy> TAF policy (NONE, BASIC, or PRECONNECT)

-F Disconnect all sessionsduring stop or relocate service operations

-H Print usage

[Oracle @ felix1 ~] $

 

[Oracle @ felix2 ~] $Srvctl modify service-d felix-s taf_srvctl-n-I felix1, felix2-f

[Oracle @ felix2 ~] $ Srvctl config service-d felix-

Taf_srvctlPREF: felix1 felix2 AVAIL: TAF: basic

[Oracle @ felix2 ~] $


[Reference RAC-Zhang Xiaoming]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.