Starting and Stopping Oracle Database Instances with SRVCTL

Start and stops a specific Oracle Database instance with the Server Control Utility (SRVCTL)

SQL Code

Start Database (Specific Node or Instance)

1srvctl start instance -d <database name> -i <instance name>

Stop Database (Specific Node or Instance)

1srvctl stop instance -d <database name> -i <instance name>

Sample Oracle Output:

1
2no rows selected
3SQL>

Description of the Oracle Database SQL code:

Purpose:

  • Starts and stops a specific Oracle Database instance using the Server Control Utility (SRVCTL).

Breakdown and Key Points:

Command Structure:

  • srvctl <command> instance -d <database name> -i <instance name>:
    • srvctl: Invokes the SRVCTL utility for managing Oracle Database instances.
    • <command>: Specifies the action to perform (start or stop).
    • -d <database name>: Identifies the database containing the instance to start/stop.
    • -i <instance name>: Specifies the name of the instance to be started/stopped.

Starting an Instance:

Bash

srvctl start instance -d <database name> -i <instance name>

Use code with caution. Learn more

content_copy

  • This command initiates the startup process for the designated instance within the specified database.
  • Common reasons for starting an instance:
    • Bringing the database online for use (after planned downtime, maintenance, etc.).
    • Scaling up to handle increased workload.
    • Recovering from an unexpected instance failure.

Stopping an Instance:

Bash

srvctl stop instance -d <database name> -i <instance name>

Use code with caution. Learn more

content_copy

  • This command gracefully closes the instance, enabling any open connections to complete normally.
  • Common reasons for stopping an instance:
    • Taking the database offline for maintenance or upgrades.
    • Scaling down to conserve resources or during planned downtime.
    • Resolving errors or issues.

Key Points:

  • Database and Instance Names: Ensure precise values for both to target the correct instance.
  • Permissions: The user executing these commands must have appropriate database administrator privileges (CREATE DATABASE or OPER role).
  • Instance State: The instance cannot be started if it's already running or stopped if it's not running.
  • Database Startup Options: Use the -startoption parameter to specify startup configurations (e.g., READ ONLY).
  • Instance Stop Options: Use the -force parameter to forcibly stop the instance, potentially interrupting users.
  • Instance Monitoring: Employ srvctl status instance to track the instance's state (starting, running, stopped, etc.).

Additional Insights and Explanations:

  • Alternatives to SRVCTL: SQL*Plus START INSTANCE and SHUTDOWN INSTANCE commands (less flexible than SRVCTL).
  • Cluster Databases: For Oracle RAC, refer to srvctl start database and srvctl stop database to manage all instances simultaneously.
  • Instance Startup Time: Varies depending on factors like database size, configuration, and resource availability.
  • Instance Stop Time: Typically faster than startup, but depends on open connections and activity.
  • Best Practices:
    • Start/stop instances during off-peak hours to minimize impact on users.
    • Consider using ALTER SYSTEM ... SHUTDOWN IMMEDIATE (risky if users have unsaved work) or normal (graceful shutdown).
    • Plan instance restarts carefully to avoid potential disruptions.

Posts in this series