Friday, December 29, 2023

Stop/Start Oracle Database Cloud Service using OCI CLI

 

- Overview:

  • Oracle Database Cloud Service (DBCS) supports stop billing for virtual machine databases. To take the advantage of this capability, you need to stop DB system's node (DB system virtual machine). 
  • Stopping a node stops billing for all OCPUs associated with that node. Billing resumes if you restart the node. However, the billing of other DBCS resources (like NVME disks) will continue.
  •  DB system nodes are stopped individually. For multi-node RAC DB systems, you may need to act on only one node.
  • You can stop/start DBCS node using
    • Oracle OCI console.
    • Oracle OCI CLI command line tool.
    • REST APIs.
In this blog, I'll demonstrate the commands to stop/start DBCS node using OCI CLI command line. 
If you have a requirement to run non-production DBCS on working hours only, then you can schedule stop/start commands (for example from CRONTAB).

Prerequisites:
  • An Oracle cloud fee trial or paid account.
  • Installed and configured OCI CLI client. I have OCI client installed and configured on Oracle OCI compute instance (a Linux virtual machine) under OPC account.

Stop DBCS Node

- OCI CLI command: oci db node stop --db-node-id <DBCS-Node-OCID>
- The JSON-formatted command's response will show "lifecycle-state": "STOPPING".
- You can get DBCS Node OCID from OCI console.
   1. Open the navigation menu. Select Oracle Database, then select Oracle Base Database.
   2. Select your Compartment. A list of DB systems is displayed.
   3. In the list of DB systems, find the DB system you want to stop, and then click its name to display  
       details about it.
   4. In the list of nodes, click the Actions menu for a node and click "copy OCID" action.    

- Example











Get the Status of DBCS Node

- OCI CLI command: oci db node get --db-node-id <DBCS-Node-OCID>
- The JSON-formatted command's response will show "lifecycle-state".
   - STOPPING: DB node is stopping.
   - STOPPED: DB node is stopped.
   - STARTING: DB node is starting.
   - AVAILABLE: DB node is running.

- Example









Start DBCS Node

- OCI CLI command: oci db node start --db-node-id <DBCS-Node-OCID>
- The JSON-formatted command's response will show "lifecycle-state": "STARTING".
- Example:




















Oracle 23ai: Quick Overview

  Oracle Database 23ai Oracle database 23ai is the next long-term support release of Oracle database. It brings AI to your data with the ad...