The script content on this page is for navigation purposes only and does not alter the content in any way.

4 Configuring Automatic Restart of an Oracle Database

Configure your Oracle database with the Oracle Restart feature to automatically restart the database, the listener, and other Oracle components after a hardware or software failure or whenever your database host computer restarts.

Oracle Restart Overview

Oracle Restart improves the availability of your Oracle database. When you install Oracle Restart, various Oracle components can be automatically restarted after a hardware or software failure or whenever your database host computer restarts. Table 4-1 lists these components.

Table 4-1 Oracle Components Automatically Restarted by Oracle Restart

Component

Notes

Database instance

Oracle Restart can accommodate multiple databases on a single host computer.

Oracle Net listener

-

Database services

Does not include the default service created upon installation because it is automatically managed by Oracle Database, and does not include any default services created during database creation.

Oracle Automatic Storage Management (Oracle ASM) instance

-

Oracle ASM disk groups

Restarting a disk group means mounting it.

Oracle Notification Services (ONS)

In a standalone server environment, ONS can be used in Oracle Data Guard installations for automating failover of connections between primary and standby database through Fast Application Notification (FAN). ONS is a service for sending FAN events to integrated clients upon failover.

Oracle Restart runs periodic check operations to monitor the health of these components. If a check operation fails for a component, the component is shut down and restarted.

Oracle Restart runs out of the Oracle Grid Infrastructure home, which you install separately from Oracle Database homes. See the Oracle Database Installation Guide for your platform for information about installing the Oracle Grid Infrastructure home.

About Startup Dependencies

Oracle Restart ensures that Oracle components are started in the proper order, in accordance with component dependencies. For example, if database files are stored in Oracle ASM disk groups, then before starting the database instance, Oracle Restart ensures that the Oracle ASM instance is started and the required disk groups are mounted. Likewise, if a component must be shut down, Oracle Restart ensures that dependent components are cleanly shut down first.

Oracle Restart also manages the weak dependency between database instances and the Oracle Net listener (the listener): When a database instance is started, Oracle Restart attempts to start the listener. If the listener startup fails, then the database is still started. If the listener later fails, Oracle Restart does not shut down and restart any database instances.

About Starting and Stopping Components with Oracle Restart

Oracle Restart automatically restarts various Oracle components when required, and automatically stops Oracle components in an orderly fashion when you manually shut down your system. There may be times, however, when you want to manually start or stop individual Oracle components. Oracle Restart includes the Server Control (SRVCTL) utility that you use to manually start and stop Oracle Restart–managed components. When Oracle Restart is in use, Oracle strongly recommends that you use SRVCTL to manually start and stop components.

After you stop a component with SRVCTL, Oracle Restart does not automatically restart that component if a failure occurs. If you then start the component with SRVCTL, that component is again available for automatic restart.

Oracle utilities such as SQL*Plus, the Listener Control utility (LSNRCTL), and ASMCMD are integrated with Oracle Restart. If you shut down the database with SQL*Plus, Oracle Restart does not interpret this as a database failure and does not attempt to restart the database. Similarly, if you shut down the Oracle ASM instance with SQL*Plus or ASMCMD, Oracle Restart does not attempt to restart it.

An important difference between starting a component with SRVCTL and starting it with SQL*Plus (or another utility) is the following:

When you start a component with SRVCTL, any components on which this component depends are automatically started first, and in the proper order.

When you start a component with SQL*Plus (or another utility), other components in the dependency chain are not automatically started; you must ensure that any components on which this component depends are started.

In addition, Oracle Restart enables you to start and stop all of the components managed by Oracle Restart in a specified Oracle home using a single command. The Oracle home can be an Oracle Database home or an Oracle Grid Infrastructure home. This capability is useful when you are installing a patch.

About Starting and Stopping Oracle Restart

The CRSCTL utility starts and stops Oracle Restart. You can also use the CRSCTL utility to enable or disable Oracle high availability services. Oracle Restart uses Oracle high availability services to start and stop automatically the components managed by Oracle Restart. For example, Oracle high availability services daemons automatically start databases, listeners, and Oracle ASM instances. When Oracle high availability services are disabled, none of the components managed by Oracle Restart are started when a node is rebooted.

Typically, you use the CRSCTL utility when you must stop all of the running Oracle software in an Oracle installation. For example, you might need to stop Oracle Restart when you are installing a patch or performing operating system maintenance. When the maintenance is complete, you use the CRSCTL utility to start Oracle Restart.

Oracle Restart Configuration

Oracle Restart maintains a list of all the Oracle components that it manages, and maintains configuration information for each component. All of this information is collectively known as the Oracle Restart configuration. When Oracle Restart starts a component, it starts the component according to the configuration information for that component. For example, the Oracle Restart configuration includes the location of the server parameter file (SPFILE) for databases, and the TCP port to listen on for listeners.

If you install Oracle Restart and then create your database with Database Configuration Assistant (DBCA), DBCA automatically adds the database to the Oracle Restart configuration. When DBCA then starts the database, the required dependencies between the database and other components (for example disk groups in which the database stores data) are established, and Oracle Restart begins to manage the database.

You can manually add and remove components from the Oracle Restart configuration with SRVCTL commands. For example, if you install Oracle Restart onto a host on which a database is already running, you can use SRVCTL to add that database to the Oracle Restart configuration. When you manually add a component to the Oracle Restart configuration and then start it with SRVCTL, Oracle Restart begins to manage the component, restarting it when required.

Note:

Adding a component to the Oracle Restart configuration is also referred to as "registering a component with Oracle Restart."

Other SRVCTL commands enable you to view the status and configuration of Oracle Restart–managed components, temporarily disable and then reenable management for components, and more.

When Oracle Restart is installed, many operations that create Oracle components automatically add the components to the Oracle Restart configuration. Table 4-2 lists some create operations and whether the created component is automatically added.

Delete a database by removing database files with operating system commandsFoot 1

No

Delete a listener with NETCA

Yes

Drop an Oracle ASM disk group (any method)

Yes

Delete a database service with SRVCTL

Yes

Delete a database service by any other means

No

Footnote 1 Not recommended

Oracle Restart Integration with Oracle Data Guard

Oracle Restart is integrated with Oracle Data Guard (Data Guard) and the Oracle Data Guard Broker (the broker). When a database shutdown and restart is required in response to a role change request, Oracle Restart shuts down and restarts the database in an orderly fashion (taking dependencies into account), and according to the settings in the Oracle Restart configuration. Oracle Restart also ensures that, following a Data Guard role transition, all database services configured to run in the new database role are active and all services not configured to run in the new role are stopped.

In addition, the Oracle Restart configuration supports Data Guard–related configuration options for the following components:

Databases—When you add a database to the Oracle Restart configuration, you can specify the current Data Guard role for the database: PRIMARY, PHYSICAL_STANDBY, LOGICAL_STANDBY, or SNAPSHOT_STANDBY. If the role is later changed using the broker, Oracle Restart automatically updates the database configuration with the new role. If you change the database role without using the broker, you must manually modify the database's role in the Oracle Restart configuration to reflect the new role.

Database Services—When adding a database service to the Oracle Restart configuration, you can specify one or more Data Guard roles for the service. When this configuration option is present, upon database open Oracle Restart starts the service only if one of the service roles matches the current database role.

Fast Application Notification with Oracle Restart

In a standalone server environment, Oracle Restart uses Oracle Notification Services (ONS) and Oracle Advanced Queues to publish Fast Application Notification (FAN) high availability events. Integrated Oracle clients use FAN to provide fast notification to clients when the service or instance goes down. The client can automate the failover of database connections between a primary database and a standby database.

This section describes how ONS and FAN work with Oracle Restart. It contains the following topics:

Overview of Fast Application Notification

FAN is a notification mechanism that Oracle Restart can use to notify other processes about configuration changes that include service status changes, such as UP or DOWN events. FAN provides the ability to immediately terminate inflight transaction when an instance or server fails. Integrated Oracle clients receive the events and respond. Applications can respond either by propagating the error to the user or by resubmitting the transactions and masking the error from the application user. When a DOWN event occurs, integrated clients immediately clean up connections to the terminated database. When an UP event occurs, the clients create new connections to the new primary database instance.

Oracle Restart publishes FAN events whenever a managed instance or service goes up or down. After a failover, the Oracle Data Guard Broker (broker) publishes FAN events. These FAN events can be used in the following ways:

Applications can use FAN with Oracle Restart without programmatic changes if they use one of these Oracle integrated database clients: Oracle Database JDBC, Universal Connection Pool for Java, Oracle Call Interface, and Oracle Database ODP.NET. These clients can be configured for Fast Connection Failover (FCF) to automatically connect to a new primary database after a failover.

FAN server-side callouts can be configured on the database tier.

For DOWN events, such as a failed primary database, FAN provides immediate notification to the clients so that they can failover as fast as possible to the new primary database. The clients do not wait for a timeout. The clients are notified immediately, and they must be configured to failover when they are notified.

For UP events, when services and instances are started, new connections can be created so that the application can immediately take advantage of the extra resources.

Through server-side callouts, you can also use FAN to:

Log status information

Page DBAs or open support tickets when resources fail to start

Automatically start dependent external applications that must be co-located with a service

FAN events are published using ONS and Oracle Streams Advanced Queuing queues. The queues are configured automatically when you configure a service. You must configure ONS manually using SRVCTL commands.

The Connection Manager (CMAN) and Oracle Net Services listeners are integrated with FAN events, enabling the CMAN and the listener to immediately de-register services provided by the failed instance and to avoid erroneously sending connection requests to a failed database.

Application High Availability with Services and FAN

Oracle Database focuses on maintaining service availability. With Oracle Restart, Oracle services are designed to be continuously available. Oracle Restart monitors the database and its services and, when configured, sends event notifications using FAN.

Managing Unplanned Outages

If Oracle Restart detects an outage, then it isolates the failed component and recovers the dependent components. If the failed component is the database instance, then after Oracle Data Guard fails over to the standby database, Oracle Restart on the new primary database starts any services defined with the current role.

FAN events are published by Oracle Restart and the Oracle Data Guard Broker through ONS and Advanced Queuing. You can also perform notifications using FAN callouts.

Note:

Oracle Restart does not run callouts with guaranteed ordering. Callouts are run asynchronously, and they are subject to scheduling variability.

With Oracle Restart, restart and recovery are automatic, including the restarting of the subsystems, such as the listener and the Oracle Automatic Storage Management (Oracle ASM) processes, not just the database. You can use FAN callouts to report faults to your fault management system and to initiate repair jobs.

Managing Planned Outages

For repairs, upgrades, and changes that require you to shut down the primary database, Oracle Restart provides interfaces that disable and enable services to minimize service disruption to application users. Using Oracle Data Guard Broker with Oracle Restart allows a coordinated failover of the database service from the primary to the standby for the duration of the planned outage. Once you complete the operation, you can return the service to normal operation.

The management policy for a service controls whether the service starts automatically when the database is restarted. If the management policy for a service is set to AUTOMATIC, then it restarts automatically. If the management policy for a service is set to MANUAL, then it must be started manually.

Fast Application Notification High Availability Events

Table 4-4 describes the FAN event record parameters and the event types, followed by name-value pairs for the event properties. The event type is always the first entry and the timestamp is always the last entry. In the following example, the name in the name-value pair is shown in Faneventtype (service_member), and the value in the name-value pair is shown in Properties:

The number of service members that are currently active; included in all UP events.

TIMESTAMP

The local time zone to use when ordering notification events.

A FAN record matches the database signature of each session as shown in Table 4-5.

Table 4-5 FAN Parameters and Matching Database Signatures

FAN Parameter

Matching Oracle Database Signature

SERVICE

sys_context('userenv', 'service_name')

DATABASEUNIQUENAME

sys_context('userenv', 'db_unique_name')

INSTANCE

sys_context('userenv', 'instance_name')

NODENAME

sys_context('userenv', 'server_host')

Using Fast Application Notification Callouts

FAN callouts are server-side executables that Oracle Restart executes immediately when high availability events occur. You can use FAN callouts to automate the following activities when events occur, such as:

Opening fault tracking tickets

Sending messages to pagers

Sending e-mail

Starting and stopping server-side applications

Maintaining an uptime log by logging each event as it occurs

To use FAN callouts, place an executable in the directory grid_home/racg/usrco on both the primary and the standby database servers. If you are using scripts, then set the shell as the first line of the executable. The following is an example file for the grid_home/racg/usrco/callout.sh callout:

Oracle Clients That Are Integrated with Fast Application Notification

Oracle has integrated FAN with many of the common Oracle client drivers that are used to connect to Oracle Restart databases. Therefore, the easiest way to use FAN is to use an integrated Oracle Client.

You can use the CMAN session pools, Oracle Call Interface, Universal Connection Pool for Java, JDBC simplefan API, and ODP.NET connection pools. The overall goal is to enable applications to consistently obtain connections to the available primary database at anytime.

Configuring Oracle Restart

If you install Oracle Restart by installing the Oracle Grid Infrastructure for a standalone server and then create your database, the database is automatically added to the Oracle Restart configuration, and is then automatically restarted when required. However, if you install Oracle Restart on a host computer on which a database already exists, you must manually add the database, the listener, the Oracle Automatic Storage Management (Oracle ASM) instance, and possibly other components to the Oracle Restart configuration.

After configuring Oracle Restart to manage your database, you may want to:

Add additional components to the Oracle Restart configuration.

Remove components from the Oracle Restart configuration.

Temporarily suspend Oracle Restart management for one or more components.

Modify the Oracle Restart configuration options for an individual component.

This section describes the SRVCTL commands that you use to accomplish these and other tasks. It contains the following topics:

Preparing to Run SRVCTL

The tasks in the following sections require that you run the SRVCTL utility. You must ensure that you run SRVCTL from the correct Oracle home, and that you log in to the host computer with the correct user account. Table 4-6 lists the components that you can configure with SRVCTL, and for each component, lists the Oracle home from which you must run SRVCTL.

Footnote 1 Assumes the listener was started from the Oracle Grid Infrastructure home. If you installed Oracle Restart for an existing database, the listener may have been started from the database home, in which case you start SRVCTL from the database home.

To prepare to run SRVCTL:

Use Table 4-6 to determine the Oracle home from which you must run SRVCTL.

If you intend to run a SRVCTL command that modifies the Oracle Restart configuration (add, remove, enable, disable, and so on), then do one of the following:

On UNIX and Linux, log in to the database host computer as the user who installed the Oracle home that you determined in Step 1.

On Windows, log in as an Administrator.

Otherwise, log in to the host computer as any user.

Open the command window that you will use to enter the SRVCTL commands.

To enter commands, you might need to ensure that the SRVCTL program is in your PATH environment variable. Otherwise, you can enter the absolute path to the program.

Adding Components to the Oracle Restart Configuration

In most cases, creating an Oracle component on a host that is running Oracle Restart automatically adds the component to the Oracle Restart configuration. (See Table 4-2.) The component is then automatically restarted when required.

The following are occasions when you must manually add components to the Oracle Restart configuration with SRVCTL:

You install Oracle Restart after creating the database.

You create an additional Oracle database on the same host computer using the CREATEDATABASE SQL statement.

You create a database service with DBMS_SERVICE.CREATE_SERVICE package procedure. (The recommended way is to use SRVCTL.)

Note:

Adding a component to the Oracle Restart configuration is also referred to as "registering a component with Oracle Restart."

Adding a component to the Oracle Restart configuration does not start that component. You must use a srvctlstart command to start it.

You can also use Oracle Enterprise Manager Database Control (Database Control) to add a database or listener to the Oracle Restart configuration. Both the SRVCTL and Database Control methods are described in the following sections:

When you manually add a database to the Oracle Restart configuration, you must also add the Oracle grid infrastructure software owner as a member of the OSDBA group of that database. This is because the grid infrastructure components must be able to connect to the database as SYSDBA to start and stop the database.

For example, if the host user who installed the grid infrastructure home is named grid and the OSDBA group of the new database is named dba, then user grid must be a member of the dba group.

in the High Availability section, next to the Oracle Restart label, click the Disabled link.

Note:

If the Oracle Restart label shows "Enabled," then the listener is already being managed by Oracle Restart and there is no need to continue.

On the confirmation page, click Continue.

Removing Components from the Oracle Restart Configuration

When you use an Oracle-recommended method to delete an Oracle component, the component is also automatically removed from the Oracle Restart configuration. For example, if you use Database Configuration Assistant (DBCA) to delete a database, DBCA removes the database from the Oracle Restart configuration. Likewise, if you use Oracle Net Configuration Assistant (NETCA) to delete a listener, NETCA removes the listener from the Oracle Restart configuration. See Table 4-3 for more examples. If you use a non-recommended or manual method to delete an Oracle component, you must first use SRVCTL to remove the component from the Oracle Restart configuration. Failing to do so could result in an error.

Disabling and Enabling Oracle Restart Management for a Component

You can temporarily disable Oracle Restart management for a component. One reason to do this is when you are performing maintenance on the component. For example, if a component must be repaired, then you might not want it to be automatically restarted if it fails or if the host computer is restarted.

When maintenance is complete, you can reenable management for the component.

When you disable a component:

It is no longer automatically restarted.

It is no longer automatically started through a dependency.

It cannot be started with SRVCTL.

Any component dependent on this resource is no longer automatically started or restarted.

Viewing the Oracle Restart Configuration for a Component

You can use SRVCTL to view the Oracle Restart configuration for any component. Oracle Restart maintains different configuration information for each component type. In one form of the SRVCTL command, you can obtain a list of components managed by Oracle Restart.

Modifying the Oracle Restart Configuration for a Component

You can use SRVCTL to modify the Oracle Restart configuration of a component. For example, you can modify the port number that a listener listens on when Oracle Restart starts it, or the server parameter file (SPFILE) that Oracle Restart points to when it starts a database.

where object is one of the components listed in Table 4-8. See the SRVCTL modify command for available options for each component.

Example 4-11 Modifying the Oracle Restart Configuration for a Database

For the database with a DB_UNIQUE_NAME of dbcrm, the following command changes the management policy to MANUAL and the start option to NOMOUNT.

srvctl modify database -d dbcrm -y MANUAL -s NOMOUNT

With a MANUAL management policy, the database is never automatically started when the database host computer is restarted. However, Oracle Restart continues to monitor the database and restarts it if a failure occurs.

Managing Environment Variables in the Oracle Restart Configuration

The Oracle Restart configuration can store name/value pairs for environment variables. If you typically set environment variables (other than ORACLE_HOME and ORACLE_SID) prior to starting your Oracle database, you can set these environment variable values in the Oracle Restart configuration. You can store any number environment variables in the individual configurations of the following components:

Database instance

Listener

Oracle ASM instance

When Oracle Restart starts one of these components, it first sets environment variables for that component to the values stored in the component configuration. Although you can set environment variables that are used by Oracle components in this manner, this capability is primarily intended for operating system environment variables.

The following sections provide instructions for setting, unsetting, and viewing environment variables:

Creating and Deleting Database Services with SRVCTL

When managing a database with Oracle Restart, Oracle recommends that you use SRVCTL to create and delete database services. When you use SRVCTL to add a database service, the service is automatically added to the Oracle Restart configuration and a dependency between the service and the database is established. Thus, if you start the service, Oracle Restart first starts the database if it is not started.

When you use SRVCTL to delete a database service, the service is also removed from the Oracle Restart configuration.

The database service is created and added to the Oracle Restart configuration. See the srvctl add service command for available options.

Example 4-15 Creating a Database Service

For the database with the DB_UNIQUE_NAME of dbcrm, this example creates a new database service named crmbatch.

srvctl add service -d dbcrm -s crmbatch

Example 4-16 Creating a Role-Based Database Service

This example creates the crmbatch database service and assigns it the Data Guard role of PHYSICAL_STANDBY. The service is automatically started only if the current role of the dbcrm database is physical standby.

The database service is removed from the Oracle Restart configuration. If the -f (force) flag is present, the service is removed even if it is still running. Without this flag, an error occurs if the service is running.

Enabling FAN Events in an Oracle Restart Environment

To enable Oracle Restart to publish Fast Application Notification (FAN) events, you must create an Oracle Notification Services (ONS) network that includes the Oracle Restart servers and the integrated clients. These clients can include Oracle Connection Manager (CMAN), Java Database Connectivity (JDBC), and Universal Connection Pool (UCP) clients. If you are using Oracle Call Interface or ODP.NET clients, then you must enable Oracle Advanced Queuing (AQ) HA notifications for your services. In addition, ONS must be running on the server.

Automating the Failover of Connections Between Primary and Standby Databases

In a configuration that uses Oracle Restart and Oracle Data Guard primary and standby databases, the database services fail over automatically from the primary to the standby during either a switchover or failover. You can use Oracle Notification Services (ONS) to immediately notify clients of the failover of services between the primary and standby databases. The Oracle Data Guard Broker uses Fast Application Notification (FAN) to send notifications to clients when a failover occurs. Integrated Oracle clients automatically failover connections and applications can mask the failure from end-users.

To automate connection failover, you must create an ONS network that includes the Oracle Restart servers and the integrated clients (CMAN, listener, JDBC, and UCP). If you are using Oracle Call Interface or ODP.NET clients, you must enable the Oracle Advanced Queuing queue. The database and the services must be managed by Oracle Restart and the Oracle Data Guard Broker to automate the failover of services.

To automate the failover of services between primary and standby databases:

Enabling Clients for Fast Connection Failover

In a configuration with a standby database, after you have added Oracle Notification Services (ONS) to your Oracle Restart configurations and enabled Oracle Advanced Queuing (AQ) HA notifications for your services, you can enable clients for fast connection failover. The clients receive Fast Application Notification (FAN) events and can relocate connections to the current primary database after an Oracle Data Guard failover. See "Automating the Failover of Connections Between Primary and Standby Databases" for information about adding ONS.

For databases with no standby database configured, you can still configure the client FAN events. When there is a failure, you can configure the client to retry the connection to the database. Since Oracle Restart will restart the failed database, the client can reconnect when the database restarts. Ensure that you program the appropriate delay and retries on the connection string, as illustrated in the examples in this section.

You can enable fast connection failover for the following types of clients in an Oracle Restart configuration:

Enabling Fast Connection Failover for JDBC Clients

Enabling FAN for the Oracle Universal Connection Pool enables Fast Connection Failover (FCF) for the client. Your application can use either thick or thin JDBC clients to use FCF.

To configure the JDBC client, set the FastConnectionFailoverEnabled property before making the first getConnection() request to a data source. When you enable Fast Connection Failover, the failover applies to every connection in the connection cache. If your application explicitly creates a connection cache using the Connection Cache Manager, then you must first set FastConnectionFailoverEnabled.

This section describes how to enable FCF for JDBC with the Universal Connection Pool. For thick JDBC clients, if you enable Fast Connection Failover, do not enable Transparent Application Failover (TAF), either on the client or for the service. Enabling FCF with thin or thick JDBC clients enables the connection pool to receive and react to all FAN events.

To enable Fast Connection Failover for JDBC clients:

On a cache enabled DataSource, set the DataSource property FastConnectionFailoverEnabled to true as in the following example to enable FAN for the Oracle JDBC Implicit Connection Cache:

Enabling Fast Connection Failover for Oracle Call Interface Clients

Oracle Call Interface clients can enable Fast Connection Failover (FCF) by registering to receive notifications about Oracle Restart high availability FAN events and respond when events occur. This improves the session failover response time in Oracle Call Interface and removes terminated connections from connection and session pools. This feature works on Oracle Call Interface applications, including those that use Transparent Application Failover (TAF), connection pools, or session pools.

First, you must enable a service for high availability events to automatically populate the Advanced Queuing ALERT_QUEUE. If your application is using TAF, then enable the TAF settings for the service. Configure client applications to connect to an Oracle Restart database. Clients can register callbacks that are used whenever an event occurs. This reduces the time that it takes to detect a connection failure.

Enabling Fast Connection Failover for ODP.NET Clients

Oracle Data Provider for .NET (ODP.NET) connection pools can subscribe to notifications that indicate when services are down. After a DOWN event, Oracle Database cleans up sessions in the connection pool that go to the instance that stops, and ODP.NET proactively disposes connections that are no longer valid.

To enable Fast Connection Failover for ODP.NET clients:

Enable Advanced Queuing notifications by using SRVCTL modifyservice command, as in the following example:

srvctl modify service –d dbname –s gl –q true, -j long

Execute the following for the users that will be connecting by way of the .Net Application, where user_name is the user name:

Enable Fast Connection Failover for ODP.NET connection pools by subscribing to FAN high availability events. Set the HA events connection string attribute to true at connection time. The pooling attribute must be set to true, which is the default. The following example illustrates these settings, where user_name is the name of the user and password is the user password:

Starting and Stopping Components Managed by Oracle Restart

When Oracle Restart is in use, Oracle strongly recommends that you use the SRVCTL utility to start and stop components, for the following reasons:

When starting a component with SRVCTL, Oracle Restart can first start any components on which this component depends. When stopping a component with SRVCTL, Oracle Restart can stop any dependent components first.

SRVCTL always starts a component according to its Oracle Restart configuration. Starting a component by other means may not.

For example, if you specified a server parameter file (SPFILE) location when you added a database to the Oracle Restart configuration, and that location is not the default location for SPFILEs, if you start the database with SQL*Plus, the SPFILE specified in the configuration may not be used.

See the srvctl add database command for a table of configuration options for a database instance.

When you start a component with SRVCTL, environment variables stored in the Oracle Restart configuration for the component are set.

You can also use Oracle Enterprise Manager Database Control (Database Control) to start a database managed by Oracle Restart. Both the SRVCTL and Database Control methods are described in the following sections:

where object is one of the components listed in Table 4-8. See the SRVCTL start command and the stop command for available options for each component.

Example 4-17 Starting a Database

This example starts the database with a DB_UNIQUE_NAME of dbcrm:

srvctl start database -d dbcrm

Example 4-18 Starting a Database NOMOUNT

This example starts the database instance without mounting the database:

srvctl start database -d dbcrm -o nomount

Example 4-19 Starting the Default Listener

This example starts the default listener:

srvctl start listener

Example 4-20 Starting a Specified Listener

This example starts the listener named crmlistener:

srvctl start listener -l crmlistener

Example 4-21 Starting Database Services

This example starts the database services bizdev and support for the database with a DB_UNIQUE_NAME of dbcrm. If the database is not started, Oracle Restart first starts the database.

srvctl start service -d dbcrm -s "bizdev,support"

Example 4-22 Starting (Mounting) Oracle ASM Disk Groups

This example starts (mounts) the Oracle ASM disk groups data and recovery. The user running this command must be a member of the OSASM group.

srvctl start diskgroup -g "data,recovery"

Example 4-23 Shutting Down a Database

This example stops (shuts down) the database with a DB_UNIQUE_NAME of dbcrm. Because a stop option (-o) is not provided, the database shuts down according to the stop option in its Oracle Restart configuration. The default stop option is IMMEDIATE.

srvctl stop database -d dbcrm

Example 4-24 Shutting Down a Database with the ABORT option

This example does a SHUTDOWNABORT of the database with a DB_UNIQUE_NAME of dbcrm.

Enter the host computer credentials for the user who installed the database Oracle home.

Enter the database credentials consisting of the user name SYS and the password that you assigned to SYS during the installation.

In the Connect As list, choose the value SYSOPER.

(Optional) Select the Save as Preferred Credential option if you want these credentials to be automatically filled in for you the next time that this page appears.

Click OK.

The Select Startup Type page appears.

To start the database with Oracle Restart, select Start database along with dependent resources.

This ensures that resources on which the database depends, such as the Oracle Automatic Storage Management instance, are successfully started before the database is started.

Click OK.

A confirmation page appears.

Click Yes.

The Startup/Shutdown: Activity Information page appears, indicating that the database is being started up. When startup is complete, the Login page appears.

Log in to the database (and to Database Control).

The Database Home page appears indicating that the database instance status is Up.

Stopping and Restarting Oracle Restart for Maintenance Operations

When several components in an Oracle home are managed by Oracle Restart, you can stop Oracle Restart and the components managed by Oracle Restart in the Oracle home. You can also disable Oracle Restart so that it is not restarted if the node reboots. You might need to do this when you are performing maintenance that includes the Oracle home, such as installing a patch. When the maintenance operation is complete, you can enable and restart Oracle Restart, and you can restart the components managed by Oracle Restart in the Oracle home.

Use both the SRVCTL utility and the CRSCTL utility for the stop and start operations:

The stophome SRVCTL command stops all of the components that are managed by Oracle Restart in the specified Oracle home. The starthome SRVCTL command starts these components. The Oracle home can be an Oracle Database home or an Oracle Grid Infrastructure home.

When you use the home object, a state file, specified in the -s option, tracks the state of each component. The stop and status commands create the state file. The start command uses the state file to identify the components to restart.

In addition, you can check the status of the components managed by Oracle Restart using the statushome command.

Use the SRVCTL utility to stop the components managed by Oracle Restart in an Oracle home:

srvctl stop home -o oracle_home -s state_file [-t stop_options] [-f]

where oracle_home is the complete path of the Oracle home and state_file is the complete path to the state file. State information for the Oracle home is recorded in the specified state file. Make a note of the state file location because it must be specified in Step 7.

Before stopping the components in an Oracle Grid Infrastructure home, ensure that you first stop the components in a dependent Oracle Database home.

If you are patching an Oracle Grid Infrastructure home, then disable and stop Oracle Restart. Otherwise, go to Step 4.

To disable and stop Oracle Restart, use the CRSCTL utility to run the following commands:

crsctl disable has
crsctl stop has

Perform the maintenance operation.

Use the CRSCTL utility to enable automatic restart of the components managed by Oracle Restart:

crsctl enable has

Use the CRSCTL utility to start Oracle Restart:

crsctl start has

Use the SRVCTL utility to start the components that were stopped in Step 2:

command is a verb such as start, stop, or remove. See Table 4-7 for a complete list.

object is the component on which SRVCTL performs the command, such as database, listener, and so on. You can also use component abbreviations. See Table 4-8 for a complete list of components and their abbreviations.

options extend the use of a preceding command combination to include additional parameters for the command. For example, the -d option indicates that a database unique name follows, and the -s option indicates that a comma-delimited list of database service names follows.

Note:

On the Windows platform, when specifying a comma-delimited list, you must enclose the list within double-quotes ("...,..."). You must also use double-quotes on the UNIX and Linux platforms if any list member contains shell metacharacters.

add

The srvctladd command adds the specified component to the Oracle Restart configuration, and optionally sets Oracle Restart configuration parameters for the component. After a component is added, Oracle Restart begins to manage it, restarting it when required.

To perform srvctladd operations, you must be logged in to the database host computer with the proper user account. See "Preparing to Run SRVCTL" for more information.

There is no srvctladd command for Oracle ASM disk groups. Disk groups are automatically added to the Oracle Restart configuration when they are first mounted. If you remove a disk group from the Oracle Restart configuration and later want to add it back, connect to the Oracle ASM instance with SQL*Plus and use an ALTERDISKGROUP ... MOUNT command.

srvctl add asm

Adds an Oracle ASM instance to the Oracle Restart configuration.

Syntax and Options

Use the srvctladdasm command with the following syntax:

srvctl add asm [-l listener_name [-p spfile] [-d asm_diskstring]]

Table 4-10 srvctl add asm Options

Option

Description

-l listener_name

Name of the listener with which Oracle ASM should register. A weak dependency is established with this listener. (Before starting the Oracle ASM instance, Oracle Restart attempts to start the listener. If the listener does not start, the Oracle ASM instance is still started. If the listener later fails, Oracle Restart does not restart Oracle ASM.)

If omitted, defaults to the listener named listener.

-p spfile

The full path of the server parameter file for the database. If omitted, the default SPFILE is used.

-d asm_diskstring

Oracle ASM disk group discovery string. An Oracle ASM discovery string is a comma-delimited list of strings that limits the set of disks that an Oracle ASM instance discovers. The discovery strings can include wildcard characters. Only disks that match one of the strings are discovered.

Example

srvctl add database

Adds a database to the Oracle Restart configuration.

After adding a database to the Oracle Restart configuration, if the database then accesses data in an Oracle ASM disk group, a dependency between the database that disk group is created. Oracle Restart then ensures that the disk group is mounted before attempting to start the database.

However, if the database and Oracle ASM instance are not running when you add the database to the Oracle Restart configuration, you must manually establish the dependency between the database and its disk groups by specifying the -a option in the SRVCTL command. See the example later in this section.

Note:

When you manually add a database to the Oracle Restart configuration, you must also add the Oracle grid infrastructure software owner as a member of the OSDBA group of that database. This is because the grid infrastructure components must be able to connect to the database as SYSDBA to start and stop the database.

For example, if the host user who installed the grid infrastructure home is named grid and the OSDBA group of the new database is named dba, then user grid must be a member of the dba group.

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-o Oracle_home

The full path of Oracle home for the database.

-m domain_name

The domain for the database. Must match the DB_DOMAIN initialization parameter

-c {RACONENODE | RAC | SINGLE}

The type of database you are adding: Oracle RAC One Node, Oracle RAC, or single instance. The default is RAC unless you specify the -xnode_name option, and the -c option defaults to SINGLE.

When adding a database to the Oracle Restart configuration, SINGLE must be specified.

-n db_name

If provided, must match the DB_NAME initialization parameter setting. You must include this option if DB_NAME is different from the unique name given by the -d option

-i instance_name

The instance name.

You must include this option if the instance name is different from the unique name given by the -d option. For example, if the unique name includes an underscore, and the instance name omits the underscore, then use this parameter to specify the instance name.

Note: The -i option is available only with Oracle Database release 11.2.0.3 or later databases.

-p spfile

The full path of the server parameter file for the database. If omitted, the default SPFILE is used.

-s start_options

Startup options for the database (OPEN, MOUNT, or NOMOUNT). If omitted, defaults to OPEN.

-t stop_options

Shutdown options for the database (NORMAL, IMMEDIATE, TRANSACTIONAL, or ABORT). If omitted, defaults to IMMEDIATE.

-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}

The current role of the database (PRIMARY, PHYSICAL_STANDBY, SNAPSHOT_STANDBY, or LOGICAL_STANDBY). Applicable in Oracle Data Guard environments only.

-y {AUTOMATIC | MANUAL}

Management policy for the database. If AUTOMATIC (the default), the database is automatically restored to its previous running condition (started or stopped) upon restart of the database host computer. If MANUAL, the database is never automatically restarted upon restart of the database host computer. A MANUAL setting does not prevent Oracle Restart from monitoring the database while it is running and restarting it if a failure occurs.

-a disk_group_list

List of disk groups upon which the database is dependent. When starting the database, Oracle Restart first ensures that these disk groups are mounted. This option is required only if the database instance and the Oracle ASM instance are not started when adding the database. Otherwise, the dependency is recorded automatically between the database and its disk groups.

ONS listening port for connections from remote hosts. The default is 6200.

-t host[:port],[host[:port],...

A list of host:port pairs of remote hosts that are part of the ONS network

Note: If port is not specified for a remote host, then ons_remote_port is used.

-v

Verbose output

srvctl add service

Adds a database service to the Oracle Restart configuration. Creates the database service if it does not exist. This method of creating a service is preferred over using the DBMS_SERVICE PL/SQL package.

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name

The database service name

-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]

A list of service roles. Applicable in Oracle Data Guard environments only. When this option is present, upon database open, the service is started only when one of its service roles matches the current database role.

-y {AUTOMATIC | MANUAL}

Management policy for the service. If AUTOMATIC (the default), the service is automatically started upon restart of the database, either by a planned restart (with SRVCTL) or after a failure. Automatic restart is also subject to the service role, however (the -l option). If MANUAL, the service is never automatically restarted upon planned restart of the database (with SRVCTL). A MANUAL setting does not prevent Oracle Restart from monitoring the service when it is running and restarting it if a failure occurs.

When an edition is specified for a service, all subsequent connections that specify the service use this edition as the initial session edition. However, if a session connection specifies a different edition, then the edition specified in the session connection is used for the initial session edition.

SRVCTL does not validate the specified edition name. During connection, the connect user must have USE privilege on the specified edition. If the edition does not exist or if the connect user does not have USE privilege on the specified edition, then an error is raised.

Example

This example adds the sales service for the database with DB_UNIQUE_NAMEdbcrm. The service is started only when dbcrm is in PRIMARY mode.

Example

srvctl config database

Displays the Oracle Restart configuration information for the specified database, or lists all databases managed by Oracle Restart.

Syntax and Options

Use the srvctlconfigdatabase command with the following syntax:

srvctl config database [-d db_unique_name [-a]]

Table 4-17 srvctl config database Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-a

Display enabled/disabled status also

Examples

An example of this command to list all Oracle Restart–managed databases is:

srvctl config database
dbcrm
orcl

An example of this command to display configuration and enabled/disabled status for the database with the DB_UNIQUE_IDorcl is:

srvctl config ons

Syntax and Options

srvctl config service

For the specified database, displays the Oracle Restart configuration information for the specified database service or for all Oracle Restart–managed database services.

Syntax and Options

Use the srvctlconfigservice command with the following syntax:

srvctl config service -d db_unique_name [-s service_name] [-a]

Table 4-19 srvctl config service Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name

Database service name. If omitted, SRVCTL displays configuration information for all Oracle Restart–managed services for the database

disable

Disables a component, which suspends management of that component by Oracle Restart. The srvctldisable command is intended to be used when a component must be repaired or shut down for maintenance, and should not be restarted automatically. When you disable a component:

It is no longer automatically restarted.

It is no longer automatically started through a dependency.

It cannot be started with SRVCTL.

To perform srvctldisable operations, you must be logged in to the database host computer with the proper user account. See "Preparing to Run SRVCTL" for more information.

srvctl disable asm

Syntax and Options

srvctl disable database

Syntax and Options

Use the srvctldisabledatabase command with the following syntax:

srvctl disable database -d db_unique_name

Table 4-21 srvctl disable database Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

Example

An example of this command is:

srvctl disable database -d dbcrm

srvctl disable diskgroup

Disables an Oracle ASM disk group.

Syntax and Options

Use the srvctldisablediskgroup command with the following syntax:

srvctl disable diskgroup -g diskgroup_name

Table 4-22 srvctl disable diskgroup Options

Option

Description

-g diskgroup_name

Disk group name

Example

An example of this command is:

srvctl disable diskgroup -g DATA

srvctl disable listener

Disables the specified listener or all listeners.

Syntax and Options

Use the srvctldisablelistener command with the following syntax:

srvctl disable listener [-l listener_name]

Table 4-23 srvctl disable listener Options

Option

Description

-l listener_name

Listener name. If omitted, all listeners are disabled.

Example

An example of this command is:

srvctl disable listener -l crmlistener

srvctl disable ons

Disables ONS.

Syntax and Options

Use the srvctldisableons command with the following syntax:

srvctl disable ons -v

Table 4-24 srvctl disable ons Options

Option

Description

-v

Verbose output

srvctl disable service

Disables one or more database services.

Syntax and Options

Use the srvctldisableservice command with the following syntax:

srvctl disable service -d db_unique_name -s service_name_list

Table 4-25 srvctl disable service Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name_list

Comma-delimited list of database service names

Example

The following example disables the database service sales and mfg:

srvctl disable service -d dbcrm -s sales,mfg

enable

The srvctlenable command reenables the specified disabled component so that:

Oracle Restart can automatically restart it.

It can be automatically started through a dependency.

You can start it manually with SRVCTL.

If the component is already enabled, then the command is ignored.

When you add a component to the Oracle Restart configuration, it is enabled by default.

To perform srvctlenable operations, you must be logged in to the database host computer with the proper user account. See "Preparing to Run SRVCTL" for more information.

srvctl enable asm

Syntax and Options

srvctl enable database

Syntax and Options

Use the srvctlenabledatabase command with the following syntax:

srvctl enable database -d db_unique_name

Table 4-27 srvctl enable database Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

Example

An example of this command is:

srvctl enable database -d dbcrm

srvctl enable diskgroup

Enables an Oracle ASM disk group.

Syntax and Options

Use the srvctlenablediskgroup command with the following syntax:

srvctl enable diskgroup -g diskgroup_name

Table 4-28 srvctl enable diskgroup Options

Option

Description

-g diskgroup_name

Disk group name

Example

An example of this command is:

srvctl enable diskgroup -g DATA

srvctl enable listener

Enables the specified listener or all listeners.

Syntax and Options

Use the srvctlenablelistener command with the following syntax:

srvctl enable listener [-l listener_name]

Table 4-29 srvctl enable listener Options

Option

Description

-l listener_name

Listener name. If omitted, all listeners are enabled.

Example

An example of this command is:

srvctl enable listener -l crmlistener

srvctl enable ons

Enables ONS.

Syntax and Options

Use the srvctlenableons command with the following syntax:

srvctl enable ons -v

Table 4-30 srvctl enable ons Options

Option

Description

-v

Verbose output

srvctl enable service

Enables one or more database services for the specified database.

Syntax and Options

Use the srvctlenableservice command with the following syntax:

srvctl enable service -d db_unique_name -s service_name_list

Table 4-31 srvctl enable service Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name_list

Comma-delimited list of database service names

Examples

The following example enables the database services sales and mfg in the database with DB_UNIQUE_NAMEdbcrm:

srvctl enable service -d dbcrm -s "sales,mfg"

getenv

Gets and displays environment variables and their values from the Oracle Restart configuration for a database, listener, or Oracle ASM instance.

srvctl getenv asm

Displays the configured environment variables for the Oracle ASM instance.

Syntax and Options

Use the srvctlgetenvasm command with the following syntax:

srvctl getenv asm [-t name_list]

Table 4-33 srvctl getenv asm Options

Options

Description

-t name_list

Comma-delimited list of names of environment variables to display. If omitted, SRVCTL displays all configured environment variables for Oracle ASM.

Example

The following example displays all configured environment variables for the Oracle ASM instance:

srvctl getenv asm

srvctl getenv database

Displays the configured environment variables for the specified database.

Syntax and Options

Use the srvctlgetenvdatabase command with the following syntax:

srvctl getenv database -d db_unique_name [-t name_list]

Table 4-34 srvctl getenv database Options

Options

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

srvctl modify asm

Modifies the Oracle Restart configuration for the Oracle ASM instance.

Syntax and Options

Use the srvctlmodifyasm command with the following syntax:

srvctl modify asm [-l listener_name] [-p spfile] [-d asm_diskstring]

Table 4-37 srvctl modify asm Options

Option

Description

-l listener_name

Name of the listener with which Oracle ASM must register. A weak dependency is established with this listener. (Before Oracle ASM is started, Oracle Restart ensures that this listener is started.)

-p spfile

The full path of the server parameter file for the database. If omitted, the default SPFILE is used.

-d asm_diskstring

Oracle ASM disk group discovery string. An Oracle ASM discovery string is a comma-delimited list of strings that limits the set of disks that an Oracle ASM instance discovers. The discovery strings can include wildcard characters. Only disks that match one of the strings are discovered.

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name

Service name

-t edition_name

The initial session edition of the service

If this option is not specified, then the edition is not modified for the service.

If this option is specified but edition_name is empty, then the edition is set to NULL. A NULL edition has no effect.

When an edition is specified for a service, all subsequent connections that specify the service use this edition as the initial session edition. However, if a session connection specifies a different edition, then the edition specified in the session connection is used for the initial session edition.

SRVCTL does not validate the specified edition name. During connection, the connect user must have USE privilege on the specified edition. If the edition does not exist or if the connect user does not have USE privilege on the specified edition, then an error is raised.

srvctl remove asm

Syntax and Options

Force remove, even when disk groups and databases that use Oracle ASM exist or when the Oracle ASM instance is running.

Example

An example of this command is:

srvctl remove asm

srvctl remove database

Removes a database. Prompts for confirmation first.

Syntax and Options

Use the srvctlremovedatabase command with the following syntax:

srvctl remove database -d db_unique_name [-f] [-y] [-v]

Table 4-44 srvctl remove database Options

Options

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-f

Force. Removes the database even if it is running.

-y

Suppresses the confirmation prompt and removes immediately

-v

Verbose output. A success or failure message is displayed.

Example

An example of this command is:

srvctl remove database -d dbcrm

srvctl remove diskgroup

Removes an Oracle ASM disk group.

Syntax and Options

Use the srvctlremovediskgroup command with the following syntax:

srvctl remove diskgroup -g diskgroup_name [-f]

Table 4-45 srvctl remove diskgroup Options

Option

Description

-g diskgroup_name

Disk group name

-f

Force. Removes the disk group even if files are open on it.

Examples

This example removes the disk group named DATA. An error is returned if files are open on this disk group.

srvctl remove diskgroup -g DATA

srvctl remove listener

Removes the specified listener or all listeners.

Syntax and Options

Use the srvctlremovelistener command with the following syntax:

srvctl remove listener [-l listener_name] [-a] [-f]

Table 4-46 srvctl remove listener Options

Options

Description

-l listener_name

Name of the listener that you want to remove. If omitted, then the default is LISTENER.

-a

Remove all listeners

-f

Force. Removes the listener even if databases are using it.

Example

The following command removes the listener lsnr01:

srvctl remove listener -l lsnr01

srvctl remove ons

Removes ONS.

Syntax and Options

Use the srvctlremoveons command as follows:

srvctl remove ons -f -v

Table 4-47 srvctl remove ons Options

Options

Description

-f

Force. Removes ONS even if it is enabled.

-v

Verbose output

srvctl remove service

Removes the specified database service.

Syntax and Options

Use the srvctlremoveservice command as follows:

srvctl remove service -d db_unique_name -s service_name]

Table 4-48 srvctl remove service Options

Options

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name

Service name

Example

An example of this command is:

srvctl remove service -d dbcrm -s sales

setenv

The setenv command sets values of environment variables in the Oracle Restart configuration for a database, a listener, or the Oracle ASM instance.

To perform srvctlsetenv operations, you must be logged in to the database host computer with the proper user account. See "Preparing to Run SRVCTL" for more information.

srvctl setenv asm

Sets the values of environment variables in the Oracle Restart configuration for the Oracle ASM instance. Before starting the instance, Oracle Restart sets environment variables to the values stored in the configuration.

Syntax and Options

Use the srvctlsetenvasm command with the following syntax:

srvctl setenv asm {-t name=val[,name=val,...] | -T name=val}

Table 4-50 srvctl setenv database Options

Options

Description

-t name=val[,name=val,...]

Comma-delimited list of name/value pairs of environment variables

-T name=val

Enables single environment variable to be set to a value that contains commas or other special characters

Example

The following example sets the AIX operating system environment variable AIXTHREAD_SCOPE in the Oracle ASM instance configuration:

srvctl setenv asm -t AIXTHREAD_SCOPE=S

srvctl setenv database

Sets the values of environment variables in the Oracle Restart configuration for a database instance. Before starting the instance, Oracle Restart sets environment variables to the values stored in the configuration.

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-t name=val[,name=val,...]

Comma-delimited list of name/value pairs of environment variables

-T name=val

Enables single environment variable to be set to a value that contains commas or other special characters

Example

The following example sets the LANG environment variable in the configuration of the database with a DB_UNIQUE_NAME of dbcrm:

srvctl setenv database -d dbcrm -t LANG=en

srvctl setenv listener

Sets the values of environment variables in the Oracle Restart configuration for a listener. Before starting the listener, Oracle Restart sets environment variables to the values stored in the configuration.

srvctl start asm

Starts the Oracle ASM instance.

For this command, SRVCTL connects "/ as sysasm" to perform the operation. To run such operations, the owner of the executables in the Oracle Grid Infrastructure home must be a member of the OSASM group, and users running the commands must also be in the OSASM group.

Syntax and Options

Use the srvctlstartasm command with the following syntax:

srvctl start asm [-o start_options]

Table 4-54 srvctl start asm Option

Option

Description

-o start_options

Comma-delimited list of options for the startup command (OPEN, MOUNT, NOMOUNT, or FORCE). If omitted, defaults to normal startup (OPEN).

Examples

This example starts the Oracle ASM instance, which then mounts any disk groups named in the ASM_DISKGROUPS initialization parameter:

srvctl start asm

This example starts the Oracle ASM instance without mounting any disk groups:

srvctl start asm -o nomount

srvctl start database

Starts the specified database instance.

For this command, SRVCTL connects "/ as sysdba" to perform the operation. To run such operations, the owner of the Oracle executables in the database Oracle home must be a member of the OSDBA group (for example, the dba group on UNIX and Linux), and users running the commands must also be in the OSDBA group.

Syntax and Options

Use the srvctlstartdatabase command with the following syntax:

srvctl start database -d db_unique_name [-o start_options]

Table 4-55 srvctl start database Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

Example

srvctl start home

Starts all of the components that are managed by Oracle Restart in the specified Oracle home. The Oracle home can be an Oracle Database home or an Oracle Grid Infrastructure home.

This command starts the components that were stopped by a srvctlstophome. This command uses the information in the specified state file to identify the components to start.

Note:

Use this command to restart components after you install a patch in an Oracle home.

Syntax and Options

Use the srvctlstarthome command with the following syntax:

srvctl start home -o oracle_home -s state_file

Table 4-57 srvctl start home Options

Option

Description

-o

Complete path of the Oracle home

-s

Complete path of the state file. The state file contains the current state information for the components in the Oracle home and is created when the srvctlstophome command or the srvctlstatushome command is run.

srvctl start listener

Starts the specified listener or all listeners.

Syntax and Options

Use the srvctlstartlistener command with the following syntax:

srvctl start listener [-l listener_name]

Table 4-58 srvctl start listener Options

Option

Description

-l listener_name

Listener name. If omitted, all Oracle Restart–managed listeners are started.

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name_list

Comma-delimited list of service names. The service name list is optional and if not provided, SRVCTL starts all of the database's services

-o start_options

Options for database startup (for example: OPEN, MOUNT, NOMOUNT and so on) if the database must be started first

Example

For the database with a DB_UNIQUE_NAME of dbcrm, the following example starts the sales database service:

srvctl start service -d dbcrm -s sales

status

Displays the running status of the specified component or set of components.

Example

srvctl status database

Syntax and Options

Use the srvctlstatusdatabase command with the following syntax:

srvctl status database -d db_unique_name [-f] [-v]

Table 4-63 srvctl status database Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

Example

An example of this command is:

srvctl status diskgroup -g DATA
Disk Group DATA is running on dbhost

srvctl status home

Displays the running status of all of the components that are managed by Oracle Restart in the specified Oracle home. The Oracle home can be an Oracle Database home or an Oracle Grid Infrastructure home.

This command writes the current status of the components to the specified state file.

Syntax and Options

Use the srvctlstatushome command with the following syntax:

srvctl status home -o oracle_home -s state_file

Table 4-65 srvctl status home Options

Option

Description

-o

Complete path of the Oracle home

-s

Complete path of the state file

srvctl status listener

Displays the running status of the specified listener or of all Oracle Restart–managed listeners.

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name_list

Comma-delimited list of service names. If omitted, status is listed for all database services for the designated database.

-f

Display a message if a service is disabled

-v

Verbose output

Example

For the database with the DB_UNIQUE_NAME of dbcrm, the following example displays the running status of the service sales:

srvctl status service -d dbcrm -s sales
Service sales is running on dbhost

stop

Stops the specified component or components.

If you want a component to remain stopped after you issue a srvctlstop command, disable the component. See the disable command.

Note:

If a component is stopped and is not disabled, it could restart as a result of another planned operation. That is, although a stopped component will not restart as a result of a failure, it might be started if a dependent component is started with a srvctlstart command.

Syntax and Options

Options for the shutdown operation, for example, NORMAL, TRANSACTIONAL, IMMEDIATE, or ABORT

-f

Force. Must be present if disk groups are currently started (mounted). This option enables SRVCTL to stop the disk groups before stopping Oracle ASM. Each dependent database instance is also stopped according to its stop options, or with the ABORT option if the configured stop options fail.

Example

An example of this command is:

srvctl stop asm -o abort -f

srvctl stop database

Stops a database.

Syntax and Options

Use the srvctlstopdatabase command with the following syntax:

srvctl stop database -d db_unique_name [-o stop_options] [-f]

Table 4-70 srvctl stop database Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

Syntax and Options

srvctl stop service

Syntax and Options

Use the srvctlstopservice command with the following syntax:

srvctl stop service -d db_unique_name [-s service_name_list] [-f]

Table 4-75 srvctl stop service Options

Option

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-s service_name_list

Comma-delimited list of database service names. If you do not provide a service name list, then SRVCTL stops all services on the database

-f

Force. This option disconnects all of the stopped services' sessions immediately. Uncommitted transactions are rolled back. If this option is omitted, active sessions remain connected to the services, but no further connections to the services can be made.

Examples

The following example stops the sales database service on the database with a DB_UNIQUE_NAME of dbcrm:

srvctl stop service -d dbcrm -s sales

unsetenv

The unsetenv command deletes one or more environment variables from the Oracle Restart configuration for a database, a listener, or an Oracle ASM instance.

To perform srvctlunsetenv operations, you must be logged in to the database host computer with the proper user account. See "Preparing to Run SRVCTL" for more information.

srvctl unsetenv asm

Removes the specified environment variables from the Oracle Restart configuration for the Oracle ASM instance.

Syntax and Options

Use the srvctlunsetenvasm command with the following syntax:

srvctl unsetenv asm -t name_list

Table 4-77 srvctl unsetenv asm Options

Options

Description

-t name_list

Comma-delimited list of environment variables to remove

Example

The following example removes the AIX operating system environment variable AIXTHREAD_SCOPE from the Oracle ASM instance configuration:

srvctl unsetenv asm -t AIXTHREAD_SCOPE

srvctl unsetenv database

Removes the specified environment variables from the Oracle Restart configuration for the specified database.

Syntax and Options

Use the srvctlunsetenvdatabase command as follows:

srvctl unsetenv database -d db_unique_name -t name_list

Table 4-78 srvctl unsetenv database Options

Options

Description

-d db_unique_name

Unique name for the database. Must match the DB_UNIQUE_NAME initialization parameter setting. If DB_UNIQUE_NAME is unspecified, then this option must match the DB_NAME initialization parameter setting. The default setting for DB_UNIQUE_NAME uses the setting for DB_NAME.

-t name_list

Comma-delimited list of environment variables to remove

Example

The following example deletes the AIXTHREAD_SCOPE environment variable from the Oracle Restart configuration for the database with a DB_UNIQUE_NAME of dbcrm:

srvctl unsetenv database -d dbcrm -t AIXTHREAD_SCOPE

srvctl unsetenv listener

Removes the specified environment variables from the Oracle Restart configuration for the specified listener or all listeners.

Syntax and Options

Use the srvctlunsetenvlistener command with the following syntax:

srvctl unsetenv listener [-l listener_name] -t name_list

Table 4-79 srvctl unsetenv listener Options

Options

Description

-l listener_name

Listener name. If omitted, the specified environment variables are removed from the configurations of all listeners.

-t name_list

Comma-delimited list of environment variables to remove

Example

The following example removes the AIX operating system environment variable AIXTHREAD_SCOPE from the listener configuration for the listener named crmlistener:

srvctl unsetenv listener -l crmlistener -t AIXTHREAD_SCOPE

CRSCTL Command Reference

This section provides details about the syntax for the CRSCTL commands that are relevant for Oracle Restart.

Note:

You must be the root user or Oracle grid infrastructure software owner to run these CRSCTL commands.

CRSCTL Command Syntax Overview

CRSCTL expects the following command syntax:

crsctl command has

where command is a verb such as start, stop, or enable. The has object indicates Oracle high availability services. See Table 4-80 for a complete list of commands.

disable

enable

start

Starts Oracle Restart.

Syntax and Options

crsctl start has

stop

Stops Oracle Restart.

Syntax and Options

crsctl stop has [-f]

Table 4-81 crsctl stop has Options

Options

Description

-f

Force. If any resources that are managed by Oracle Restart are still running, then try to stop these resources gracefully. If a resource cannot be stopped gracefully, then try to force the resource to stop.

For example, if an Oracle ASM instance is running, then SHUTDOWNIMMEDIATE attempts to stop the Oracle ASM instance gracefully, while SHUTDOWNABORT attempts to force the Oracle ASM instance to stop.

When the -f option is not specified, this command tries to stop resources managed by Oracle Restart gracefully but does not try to force them to stop.