How to Automate Start and Stop of DBCS Node using REST API in OCI

Share on:


Recently we migrated databases from ODA (Oracle Database Appliance) to OCI DBCS for a client. And client asking to stop the dev DBCS node from 5 PM to 6 AM to save cost.


NOTE: For Virtual machine DB systems – Stopping a node stops billing for all OCPUs associated with that node, and billing resumes when you restart the node.

So this task is possible by console -> go to console and stop the DBCS node and again start in the morning.

But we can not automate this from the console. I found REST API is the best and easiest way to automate this task.

Please see my previous post on the deployment of DBCS using REST API.

In my above post, I specify the oci-curl script that you can copy. 

Here is the link again to copy script oci-curl

OCI-CURL will sign and encrypt your APIs so they are not sent in the clear over the internet.

You basically need to change the Tenancy OCID, USER OCID, KeyFingerprint, and private key .pem file location in that script. You can easily get these from the OCI console.



  1. I am assuming you already have VCN, subnet, security rules, and compartment.
  2. Running DBCS
  3. OCI-CURL script with the above changes as per your tenancy.


So what else do we need

  • API Endpoint for the Database: I used , if your cloud database is located somewhere else you can use that. full list here .. API Endpoints
  • DB Node Action Command: POST /20160918/dbNodes/{dbNodeId}


How it works:

I created a very small shell script to stop the DBCS node.

$ cat


. ./

oci-curl POST ./empty.json /20160918/dbNodes/<dbnodeid>?action=stop

where : will load and source the function with our tenant data. : API endpoint that listens for DB service from the Toronto region. It might be different for your region if your region is not Toronto.

POST : API Request

./empty.json : This is the empty file I used for starting and stopping dbcs node, because we have to use any config json file for POST API requests. Here we are not changing anything like OCPU etc. that’s why it’s empty.

/20160918/dbNodes/<dbnodeid>?action=stop : This is the command we have to use to start/stop dbcs node. The first number in this command is the API version. and dbnodeid is OCID of dbcs node we have to copy from the console to use here.

After that just make this file executable.

chmod +x

After running the above script I saw my DBCS node start stopping. here is the output response.


Once DBCS node stopped.


I created another small script to start the DBCS node.

$ cat


. ./

oci-curl POST ./empty.json /20160918/dbNodes/<dbnodeid>?action=start

and then run this script to start dbcs node, here is the output response.


We can see dbnode starting via oci console.


Now as per client requirement, we can schedule this stop-and-start script via crontab.

Share on:

More from this Author

How to Import Custom Visualization in Oracle Analytics Cloud to See Images

In this blog, I will show you how to download and import the Image Gallery Plugin into OCI Oracle Analytics Cloud. using this plugin we can see ... Read More

Analyze Invoices with Oracle Analytics and AI Document Understanding

OCI Document Understanding is an AI service that enables developers to extract text, tables, and other key data from document files through APIs and ... Read More

Back to Top