Last week I released a script that allows you to schedule the scaling of an Oracle Database running on the baremetal cloud instances. That script was designed to run inside the actual Database instance. The new Oracle Autonomous services do not allow you to do this, as these are fully managed platforms by Oracle, so you do not have access to the console to run script.
Both services work on a fixed per OCU per Hour price model. So the more more efficient you can scale this up and down, the more money you can save and the better performance you can get when you really need it! If you use the service “Including Licenses”, not just the hardware resources scale up/down but also the Oracle Database License cost!
As the ATP and ADW services also support turning an instance on and off (and reducing cost), the AWD_ATP script supports this now. If you specify and 0 (zero) for the hour, it will stop the service. If the services is stopped and the hour requires more then 0 cpu cores, it will automatically start the instance and then scale it to the appropriate size.
As the starting takes some time, I have updated the ADW_ATP script with support for multi threading, so that all scaling actions happen at the same time, and not sequentially.
How does it work
- You need to have an environment (capable of running a Python script), this can be in the cloud or on-premise, as long as it has internet connectivity so it can talk to the API of the Oracle Cloud.
- On each ADW or ATP service you can add a TAG with the schedule you want for that instance. This schedule can be for AnyDay, WeekDay, Weekend or a specific day like Tuesday.
- The TAG should contain 24 numbers separated by commas. Each number represents the amount of CPU cores you want for each hour of the day.
- If you specify 0 (zero) for the hour, the instances will be stopped.
- As I am not sure how strict Oracle is measuring the per hour consumption, you can the script just for Scale down or just for Scale up operations. This allows you to do Scale down operations just 2 minutes before the end of the hour and do Scale up operations just after the hour. If you do not specify what operation you want with the script, if will do both Scale UP and DOWN adjustments.
- Important to note, the time and timezone used, is based on what every system you are running the script from. Not the time and timezone within the service it self.
- If you do not know how to have the OCI python libraries installed and how to configure the config file for the credentials, you can check out this page
You can find the actual script here: