OCI-AutoScale
OCI-AutoScale copied to clipboard
Error applying with Autonomous Database
Hello! We're getting this error to use this code with our Autonomous Database:
Checking XXX_XXX (AutonomousDatabase) CurentState: STOPPED...
- Active schedule for XXX_XXX: ,,,,,,,,1,,,,,,,0,[1],,,,,,,*,
Traceback (most recent call last):
File "/home/xxx/AutoScaleALL.py", line 1782, in
autoscale_region(region_name) File "/home/xxx/AutoScaleALL.py", line 1034, in autoscale_region if (resourceDetails.cpu_core_count == int(schedulehours[CurrentHour]) and resourceDetails.compute_model == "OCPU") or ((resourceDetails.compute_count == int(schedulehours[CurrentHour]) and resourceDetails.compute_model == "ECPU") ): AttributeError: 'AutonomousDatabase' object has no attribute 'compute_count'
Any clue about this error?
Thanks in advance
Which version of Autonomous database are you running? OCPU or ECPU based?
ECPU based
Can you add a:
print (resourceDetails)
above that if statement (line 1034) and send me the output
blank
mm strange. I will try to do a test this week and see what is going on.
Not blank sorry Checking ATP_BVR (AutonomousDatabase) CurentState: STOPPED...
- Active schedule for ATP_BVR: ,,,,,,,,1,,,,,,1,1,[1],1,0,,,,,,
{
"actual_used_data_storage_size_in_tbs": 0.0,
"allocated_storage_size_in_tbs": 0.0498046875,
"apex_details": {
"apex_version": "23.2.3",
"ords_version": "23.4.0.346.1619"
},
"are_primary_whitelisted_ips_used": null,
"autonomous_container_database_id": null,
"autonomous_maintenance_schedule_type": "REGULAR",
"available_upgrade_versions": [],
"backup_config": {
"manual_backup_bucket_name": null,
"manual_backup_type": "NONE"
},
"compartment_id": "ocid1.compartment.xxx",
"connection_strings": {
"all_connection_strings": {
"HIGH": "xxx",
"LOW": "xxx",
"MEDIUM": "xxx",
"TP": "xx",
"TPURGENT": "xx"
},
"dedicated": null,
"high": "xxx",
"low": "xxx",
"profiles": [
{
"consumer_group": "HIGH",
"display_name": "atpbvr_high",
"host_format": "FQDN",
"protocol": "TCPS",
"session_mode": "DIRECT",
"syntax_format": "LONG",
"tls_authentication": "MUTUAL",
"value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=xx))(security=(ssl_server_dn_match=yes)))"
},
{
"consumer_group": "LOW",
"display_name": "atpbvr_low",
"host_format": "FQDN",
"protocol": "TCPS",
"session_mode": "DIRECT",
"syntax_format": "LONG",
"tls_authentication": "MUTUAL",
"value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx))(connect_data=(service_name=xxx))(security=(ssl_server_dn_match=yes)))"
},
{
"consumer_group": "MEDIUM",
"display_name": "atpbvr_medium",
"host_format": "FQDN",
"protocol": "TCPS",
"session_mode": "DIRECT",
"syntax_format": "LONG",
"tls_authentication": "MUTUAL",
"value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=xxx))(security=(ssl_server_dn_match=yes)))"
},
{
"consumer_group": "TP",
"display_name": "atpbvr_tp",
"host_format": "FQDN",
"protocol": "TCPS",
"session_mode": "DIRECT",
"syntax_format": "LONG",
"tls_authentication": "MUTUAL",
"value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx))(connect_data=(service_name=xxx))(security=(ssl_server_dn_match=yes)))"
},
{
"consumer_group": "TPURGENT",
"display_name": "atpbvr_tpurgent",
"host_format": "FQDN",
"protocol": "TCPS",
"session_mode": "DIRECT",
"syntax_format": "LONG",
"tls_authentication": "MUTUAL",
"value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx))(connect_data=(service_name=xxx))(security=(ssl_server_dn_match=yes)))"
}
]
},
"connection_urls": {
"apex_url": "xxx),
"graph_studio_url": "xxx,
"machine_learning_user_management_url": "xxx,
"sql_dev_web_url": "xxx
},
"cpu_core_count": 0,
"customer_contacts": null,
"data_safe_status": "REGISTERED",
"data_storage_size_in_gbs": 61,
"data_storage_size_in_tbs": null,
"database_management_status": null,
"dataguard_region_type": null,
"db_name": "ATPBVR",
"db_version": "19c",
"db_workload": "OLTP",
"defined_tags": {
"Oracle-Tags": {
"CreatedBy": "oracleidentitycloudservice/xxx.com",
"CreatedOn": "2020-08-02T17:01:25.743Z"
},
"Schedule": {
"WeekDay": ",,,,,,,,1,,,,,,1,1,1,1,0,,,,,"
}
},
"display_name": "ATP_BVR",
"failed_data_recovery_in_seconds": null,
"freeform_tags": {},
"id": "ocid1.autonomousdatabase.xxxx",
"infrastructure_type": null,
"is_access_control_enabled": null,
"is_auto_scaling_enabled": false,
"is_auto_scaling_for_storage_enabled": true,
"is_data_guard_enabled": false,
"is_dedicated": false,
"is_free_tier": false,
"is_mtls_connection_required": true,
"is_preview": false,
"is_reconnect_clone_enabled": false,
"is_refreshable_clone": null,
"key_history_entry": [
{
"id": "ORACLE_MANAGED_KEY",
"kms_key_version_id": null,
"time_activated": "2020-07-31T15:01:40+00:00",
"vault_id": null
}
],
"key_store_id": null,
"key_store_wallet_name": null,
"kms_key_id": "ORACLE_MANAGED_KEY",
"kms_key_lifecycle_details": null,
"kms_key_version_id": null,
"license_model": "BRING_YOUR_OWN_LICENSE",
"lifecycle_details": null,
"lifecycle_state": "STOPPED",
"memory_per_oracle_compute_unit_in_gbs": null,
"nsg_ids": null,
"ocpu_count": null,
"open_mode": "READ_WRITE",
"operations_insights_status": "NOT_ENABLED",
"peer_db_ids": null,
"permission_level": "UNRESTRICTED",
"private_endpoint": null,
"private_endpoint_ip": null,
"private_endpoint_label": null,
"refreshable_mode": null,
"refreshable_status": null,
"role": null,
"scheduled_operations": null,
"service_console_url": null,
"source_id": null,
"standby_db": null,
"standby_whitelisted_ips": null,
"subnet_id": null,
"supported_regions_to_clone_to": [
"AMS",
"ZRH",
"LHR",
"MTZ",
"JED",
"LIN",
"CDG",
"PHX",
"MAD",
"IAD"
],
"system_tags": {},
"time_created": "2020-08-02T17:01:25.747000+00:00",
"time_data_guard_role_changed": null,
"time_deletion_of_free_autonomous_database": null,
"time_local_data_guard_enabled": null,
"time_maintenance_begin": "2024-02-10T21:00:00+00:00",
"time_maintenance_end": "2024-02-10T23:00:00+00:00",
"time_of_last_failover": null,
"time_of_last_refresh": null,
"time_of_last_refresh_point": null,
"time_of_last_switchover": null,
"time_of_next_refresh": null,
"time_reclamation_of_free_autonomous_database": null,
"time_until_reconnect_clone_enabled": null,
"used_data_storage_size_in_tbs": 1,
"vault_id": null,
"whitelisted_ips": null
}
Traceback (most recent call last):
File "/home/xxx/AutoScaleALL.py", line 1783, in
autoscale_region(region_name) File "/home/xxx/AutoScaleALL.py", line 1035, in autoscale_region if (resourceDetails.cpu_core_count == int(schedulehours[CurrentHour]) and resourceDetails.compute_model == "OCPU") or (resourceDetails.compute_count == int(schedulehours[CurrentHour]) and resourceDetails.compute_model == "ECPU"): AttributeError: 'AutonomousDatabase' obj
See what is going wrong. I will need to fix the IF statement logic. Will try to do that tomorrow.
We would be very grateful, we are pretty much stuck. 😊
I just tested with one autonomous DB based ocpu basis and one on ecpu basis. But scale up and down, power off / on and power on and rescale all without issue.
Are you using the latest version of the script? Can you share the full output of the script with me via email ([email protected])
yes, we are using the latest version. We have already used it on several occasions and with other Autonomous Databases without problems. The complete output is the one we have shared with you before. In that output, what is strange for us is that compute-count and compute-model do not appear, we understand that this is where the problem comes from.
agree, it show a null value. What does that database show in the OCI Console?
if you don't mind I'll tell you tomorrow morning 😊
Morning, the request we are launching from the cloud shell returns this: { "data": { "actual-used-data-storage-size-in-tbs": 0.01070404052734375, "allocated-storage-size-in-tbs": 0.0498046875, "apex-details": { "apex-version": "23.2.3", "ords-version": "23.4.0.346.1619" }, "are-primary-whitelisted-ips-used": null, "autonomous-container-database-id": null, "autonomous-maintenance-schedule-type": "REGULAR", "available-upgrade-versions": [], "backup-config": { "manual-backup-bucket-name": null, "manual-backup-type": "NONE" }, "backup-retention-period-in-days": 30, "character-set": null, "compartment-id": "ocid1.compartment.xxx", "compute-count": 2.0, "compute-model": "ECPU", "connection-strings": { "all-connection-strings": { "HIGH": "adb.eu-frankfurt-1.xxx", "LOW": "adb.eu-frankfurt-1.xxx", "MEDIUM": "adb.eu-frankfurt-1.xxx", "TP": "adb.eu-frankfurt-1.xxx", "TPURGENT": "adb.eu-frankfurt-1.xxx" }, "dedicated": null, "high": "adb.eu-frankfurt-1.xxx", "low": "adb.eu-frankfurt-1.xxx", "medium": "adb.eu-frankfurt-1.xxx", "profiles": [ { "consumer-group": "HIGH", "display-name": "atpbvr_high", "host-format": "FQDN", "is-regional": null, "protocol": "TCPS", "session-mode": "DIRECT", "syntax-format": "LONG", "tls-authentication": "MUTUAL", "value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxxx))(connect_data=(service_name=xxx.atp.oraclecloud.com))(security=(ssl_server_dn_match=yes)))" }, { "consumer-group": "LOW", "display-name": "atpbvr_low", "host-format": "FQDN", "is-regional": null, "protocol": "TCPS", "session-mode": "DIRECT", "syntax-format": "LONG", "tls-authentication": "MUTUAL", "value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx))(connect_data=(service_name=xxx.atp.oraclecloud.com))(security=(ssl_server_dn_match=yes)))" }, { "consumer-group": "MEDIUM", "display-name": "atpbvr_medium", "host-format": "FQDN", "is-regional": null, "protocol": "TCPS", "session-mode": "DIRECT", "syntax-format": "LONG", "tls-authentication": "MUTUAL", "value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=xxx.oraclecloud.com))(security=(ssl_server_dn_match=yes)))" }, { "consumer-group": "TP", "display-name": "atpbvr_tp", "host-format": "FQDN", "is-regional": null, "protocol": "TCPS", "session-mode": "DIRECT", "syntax-format": "LONG", "tls-authentication": "MUTUAL", "value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=xxx.atp.oraclecloud.com))(security=(ssl_server_dn_match=yes)))" }, { "consumer-group": "TPURGENT", "display-name": "atpbvr_tpurgent", "host-format": "FQDN", "is-regional": null, "protocol": "TCPS", "session-mode": "DIRECT", "syntax-format": "LONG", "tls-authentication": "MUTUAL", "value": "(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx.oraclecloud.com))(connect_data=(service_name=xxx.atp.oraclecloud.com))(security=(ssl_server_dn_match=yes)))" } ] }, "connection-urls": { "apex-url": "https://xxxx.adb.eu-frankfurt-1.xxx", "database-transforms-url": "https://xxx-ATPBVR.adb.eu-frankfurt-1.xxx", "graph-studio-url": "https://xxxx.adb.eu-frankfurt-1.oraclecloudapps.com/xxx/", "machine-learning-notebook-url": "https://xxx.adb.eu-frankfurt-1.oraclecloudapps.com/xxx/", "machine-learning-user-management-url": "https://xxx.adb.eu-frankfurt-1.xxx", "mongo-db-url": null, "ords-url": "https://xxx.adb.eu-frankfurt-1.oraclecloudapps.com/xxx/", "sql-dev-web-url": "https://xxx.adb.eu-frankfurt-1.oraclecloudapps.com/xxx" }, "cpu-core-count": 0, "customer-contacts": null, "data-safe-status": "REGISTERED", "data-storage-size-in-gbs": 61, "data-storage-size-in-tbs": null, "database-edition": "ENTERPRISE_EDITION", "database-management-status": null, "dataguard-region-type": null, "db-name": "ATPBVR", "db-tools-details": [ { "compute-count": null, "is-enabled": true, "max-idle-time-in-minutes": null, "name": "APEX" }, { "compute-count": 2.0, "is-enabled": true, "max-idle-time-in-minutes": 10, "name": "DATA_TRANSFORMS" }, { "compute-count": null, "is-enabled": true, "max-idle-time-in-minutes": null, "name": "DATABASE_ACTIONS" }, { "compute-count": 2.0, "is-enabled": true, "max-idle-time-in-minutes": 240, "name": "GRAPH_STUDIO" }, { "compute-count": null, "is-enabled": false, "max-idle-time-in-minutes": null, "name": "MONGODB_API" }, { "compute-count": 2.0, "is-enabled": true, "max-idle-time-in-minutes": 60, "name": "OML" }, { "compute-count": null, "is-enabled": true, "max-idle-time-in-minutes": null, "name": "ORDS" } ], "db-version": "19c", "db-workload": "OLTP", "defined-tags": { "Oracle-Tags": { "CreatedBy": "xxx", "CreatedOn": "2020-08-02T17:01:25.743Z" }, "Schedule": { "WeekDay": ",,,,,,,,1,,,,,,,0,,,,,,,," } }, "disaster-recovery-region-type": null, "display-name": "ATP_BVR", "failed-data-recovery-in-seconds": null, "freeform-tags": {}, "id": "ocid1.autonomousdatabase.xxxx", "in-memory-area-in-gbs": null, "in-memory-percentage": null, "infrastructure-type": null, "is-access-control-enabled": null, "is-auto-scaling-enabled": false, "is-auto-scaling-for-storage-enabled": true, "is-data-guard-enabled": false, "is-dedicated": false, "is-free-tier": false, "is-local-data-guard-enabled": false, "is-mtls-connection-required": true, "is-preview": false, "is-reconnect-clone-enabled": false, "is-refreshable-clone": null, "is-remote-data-guard-enabled": false, "key-history-entry": [ { "id": "ORACLE_MANAGED_KEY", "kms-key-version-id": null, "time-activated": "2020-07-31T15:01:40+00:00", "vault-id": null } ], "key-store-id": null, "key-store-wallet-name": null, "kms-key-id": "ORACLE_MANAGED_KEY", "kms-key-lifecycle-details": null, "kms-key-version-id": null, "license-model": "BRING_YOUR_OWN_LICENSE", "lifecycle-details": null, "lifecycle-state": "AVAILABLE", "local-adg-auto-failover-max-data-loss-limit": null, "local-disaster-recovery-type": "BACKUP_BASED", "local-standby-db": null, "long-term-backup-schedule": null, "max-cpu-core-count": null, "memory-per-oracle-compute-unit-in-gbs": null, "ncharacter-set": null, "next-long-term-backup-time-stamp": null, "nsg-ids": null, "ocpu-count": null, "open-mode": "READ_WRITE", "operations-insights-status": "NOT_ENABLED", "peer-db-ids": null, "permission-level": "UNRESTRICTED", "private-endpoint": null, "private-endpoint-ip": null, "private-endpoint-label": null, "provisionable-cpus": null, "refreshable-mode": null, "refreshable-status": null, "remote-disaster-recovery-configuration": null, "resource-pool-leader-id": null, "resource-pool-summary": { "is-disabled": true, "pool-size": null }, "role": null, "scheduled-operations": null, "service-console-url": null, "source-id": null, "standby-db": null, "standby-whitelisted-ips": null, "subnet-id": null, "supported-regions-to-clone-to": [ "AMS", "ZRH", "LHR", "MTZ", "JED", "LIN", "CDG", "PHX", "MAD", "IAD" ], "system-tags": {}, "time-created": "2020-08-02T17:01:25.747000+00:00", "time-data-guard-role-changed": null, "time-deletion-of-free-autonomous-database": null, "time-disaster-recovery-role-changed": null, "time-local-data-guard-enabled": null, "time-maintenance-begin": "2024-02-10T21:00:00+00:00", "time-maintenance-end": "2024-02-11T05:00:00+00:00", "time-of-joining-resource-pool": null, "time-of-last-failover": null, "time-of-last-refresh": null, "time-of-last-refresh-point": null, "time-of-last-switchover": null, "time-of-next-refresh": null, "time-reclamation-of-free-autonomous-database": null, "time-until-reconnect-clone-enabled": null, "total-backup-storage-size-in-gbs": 16.0, "used-data-storage-size-in-gbs": null, "used-data-storage-size-in-tbs": 1, "vault-id": null, "whitelisted-ips": null }, "etag": "5e98a813--gzip" }
I was more referring to OCI Console, not the cloud shell. I see you are using 0 and 1 in your schedule. but as this is ECPU based, the smallest is 2 Cores. Can you change the 1 to a 2 in the schedule.
You are just getting the error on power on operations, or also on scaling and power off operations?
Okay, we will make the change and let you know. At the moment we have only done it with power on operations.
Hello I'm sdominguez colleague, we try what you said on the tags but the issues is that the compute-count still not populated, did you have time to look it up