# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
from datetime import datetime
import oci
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
psql_client = oci.psql.PostgresqlClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_db_system_response = psql_client.create_db_system(
create_db_system_details=oci.psql.models.CreateDbSystemDetails(
display_name="EXAMPLE-displayName-Value",
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
db_version="EXAMPLE-dbVersion-Value",
storage_details=oci.psql.models.OciOptimizedStorageDetails(
system_type="OCI_OPTIMIZED_STORAGE",
is_regionally_durable=True,
availability_domain="EXAMPLE-availabilityDomain-Value",
iops=15),
shape="EXAMPLE-shape-Value",
network_details=oci.psql.models.NetworkDetails(
subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
primary_db_endpoint_private_ip="EXAMPLE-primaryDbEndpointPrivateIp-Value",
nsg_ids=["EXAMPLE--Value"],
is_reader_endpoint_enabled=False),
description="EXAMPLE-description-Value",
system_type="OCI_OPTIMIZED_STORAGE",
config_id="ocid1.test.oc1..<unique_ID>EXAMPLE-configId-Value",
instance_ocpu_count=171,
instance_memory_size_in_gbs=652,
instance_count=323,
instances_details=[
oci.psql.models.CreateDbInstanceDetails(
display_name="EXAMPLE-displayName-Value",
description="EXAMPLE-description-Value",
private_ip="EXAMPLE-privateIp-Value")],
credentials=oci.psql.models.Credentials(
username="EXAMPLE-username-Value",
password_details=oci.psql.models.VaultSecretPasswordDetails(
password_type="VAULT_SECRET",
secret_id="ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value",
secret_version="EXAMPLE-secretVersion-Value")),
management_policy=oci.psql.models.ManagementPolicyDetails(
maintenance_window_start="EXAMPLE-maintenanceWindowStart-Value",
backup_policy=oci.psql.models.MonthlyBackupPolicy(
kind="MONTHLY",
backup_start="EXAMPLE-backupStart-Value",
days_of_the_month=[24],
retention_days=26,
copy_policy=oci.psql.models.BackupCopyPolicy(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
retention_period=132,
regions=["EXAMPLE--Value"])),
pitr_policy=oci.psql.models.NonePitrPolicy(
kind="NONE")),
source=oci.psql.models.PointInTimeDbSystemSourceDetails(
source_type="POINT_IN_TIME_DB_SYSTEM",
db_system_id="ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
time_to_restore=datetime.strptime(
"2026-12-29T02:45:19.963Z",
"%Y-%m-%dT%H:%M:%S.%fZ")),
replication_config=oci.psql.models.CreateReplicationConfigDetails(
is_rpo_enforced=False,
rpo_in_seconds=704),
odsp_insight_details=oci.psql.models.EnabledInsightDetails(
kind="ENABLED",
odsp_insight_list=[
oci.psql.models.OdspInsight(
insight_type="QUERY_INSIGHT",
retention_period_in_days=7)]),
freeform_tags={
'EXAMPLE_KEY_UnsXT': 'EXAMPLE_VALUE_MV7wPHGzlhL3sFFyh1s7'},
defined_tags={
'EXAMPLE_KEY_iSreM': {
'EXAMPLE_KEY_xXz2E': 'EXAMPLE--Value'}}),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="HT5VG9NZLTYR7FTZSWJA<unique_ID>")
# Get the data from response
print(create_db_system_response.data)