Symptoms
- Several production instances and databases go to
STOPPEDat exactly the same time, often on the hour or half hour. - No one on the team ran a stop. The audit log shows the action but not a person you recognise.
- It happens again the next evening or weekend at the same time.
- It started after someone set up "stop non-production at night" to save money.
1. Confirm a schedule did it (3 minutes)
List schedules in the compartments that hold your production resources, and in their parents. A schedule can target resources in other compartments.
export COMP=ocid1.compartment.oc1..xxxx
oci resource-scheduler schedule list --compartment-id $COMP --all
The output shape differs between CLI versions. Look for each schedule's display-name, id, action (START_RESOURCE or STOP_RESOURCE), lifecycle-state, recurrence-type (CRON or ICAL) and recurrence-details. Then open the suspect schedule:
export SCHED=<schedule-ocid> # the "id" from the list output
oci resource-scheduler schedule get --schedule-id $SCHED
Read two fields closely:
resources: a fixed list of OCIDs. Is a production OCID in it?resource-filters: dynamic selection by compartment, tags, resource type or state. A filter is where production usually gets pulled in by mistake.
Schedule times are in UTC. A schedule meant for 20:00 local time may fire during the business day in another region's time zone.
Also check the audit log for the stop events around the time of the outage. The caller is a resource principal for the schedule, not a user, so filter on time and read the principal fields:
oci logging-search search-logs \
--search-query 'search "'"$COMP"'/_Audit" | where data.request.action = '"'POST'"' | sort by datetime desc' \
--time-start 2026-11-15T19:55:00Z --time-end 2026-11-15T20:10:00Z \
--query 'data.results[].data.{time:datetime, event:data.eventName, principal:data.identity.principalName, type:data.identity.authType, resource:data.resourceName}'
2. Why production got caught
| What you find | Cause | Fix |
|---|---|---|
| Compartment filter on a parent compartment with child compartments included | Production sits under the same parent as non-production | Point the filter at the non-production compartment only |
Defined tag filter like Environment=* or a namespace-wide tag | Tag filter wider than intended | Filter on a specific tag value, e.g. Schedule.Policy=office-hours |
| Production resource tagged with the schedule tag | Tag copied from a template or a cloned resource | Remove the tag from production resources |
| Fixed OCID list includes production | OCID pasted from the wrong environment | Remove it from resources |
| Stop schedule has no matching start schedule | Only half the pair was created | Add or fix the start schedule, or disable both |
3. The fix
Disable the schedule first
This stops further runs while you work. It does not start anything.
oci resource-scheduler schedule deactivate --schedule-id $SCHED
oci resource-scheduler schedule get --schedule-id $SCHED --query 'data."lifecycle-state"'
Do this for every schedule that touches production. Disabling is reversible with oci resource-scheduler schedule activate --schedule-id $SCHED, so prefer it to deleting during the incident.
Warning
If a matching START schedule runs while you are recovering, it can start resources in the wrong order or start ones you meant to keep stopped. Disable the whole pair, then start resources yourself.
Start resources in dependency order
Databases first, then application tiers, then anything behind load balancers.
# Autonomous Database
oci db autonomous-database start --autonomous-database-id <adb-ocid> --wait-for-state AVAILABLE
# Base Database (VM DB system node)
oci db node start --db-node-id <dbnode-ocid> --wait-for-state AVAILABLE
# Compute instances
for id in $(cat prod-instances.txt); do
oci compute instance action --instance-id $id --action START --wait-for-state RUNNING &
done
wait
To build prod-instances.txt quickly, list stopped instances in the production compartment:
oci compute instance list --compartment-id $PROD_COMP --lifecycle-state STOPPED --all \
--query 'data[].id' --raw-output | tr -d '[]", ' | grep ocid > prod-instances.txt
Caution
Check the list before you start everything. A compartment can hold instances that were stopped on purpose (spares, retired hosts, DR targets that must not run at the same time as primaries). Starting a DR standby or a duplicate application node can cause split-brain or double processing.
If a start fails with Out of host capacity for a specific shape, see the capacity guidance for your region or move to a flexible shape. Stopped instances do not hold their host capacity. That is a real risk with nightly stop schedules on large or GPU shapes.
Fix the schedule, then re-enable it
Narrow the filters to the non-production scope and check the result before you activate the schedule again. Edit it in the console, or with oci resource-scheduler schedule update (check --help for the exact JSON shape of --resource-filters in your CLI version). Then:
oci resource-scheduler schedule activate --schedule-id $SCHED
4. Tighten the permissions
Resource Scheduler acts through its own resource principal and needs a policy that lets schedules manage the target resources. Scope that policy to non-production compartments only, so even a bad filter cannot touch production:
Allow any-user to manage instance-family in compartment nonprod where all {request.principal.type = 'resourceschedule'}
Allow any-user to manage autonomous-database-family in compartment nonprod where all {request.principal.type = 'resourceschedule'}
Check the Resource Scheduler documentation for the exact policy statements your resource types need. Find and remove any statement that grants the scheduler access to the whole tenancy or to production compartments:
oci iam policy list --compartment-id <tenancy-ocid> --all \
--query "data[?contains(to_string(statements), 'resourceschedule')].{name:name, statements:statements}"
Verify
- Every production instance is
RUNNINGand every database isAVAILABLE, with application health checks passing. - No active schedule has production OCIDs in
resourcesor filters that match production. - At the next scheduled run time, watch that only non-production resources change state.
Communicate
"At
Prevent it next time
- Use a dedicated tag (for example
Schedule.Policy = office-hours) as the only opt-in for schedules, and never apply it to production. - Keep production in its own compartment tree, separate from non-production, so compartment filters cannot overlap.
- Scope the scheduler's IAM policy to non-production compartments.
- Create an Events rule for stop events on production instances and databases that pages on-call immediately.
- Review schedules in change control like any other automation that can cause downtime, and manage them in Terraform.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get