Skip to content

delete_tenant_database

delete_tenant_database(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_instance_identifier: Optional[String] = None,
    tenant_db_name: Optional[String] = None,
    skip_final_snapshot: Optional[Boolean] = None,
    final_db_snapshot_identifier: Optional[String] = None,
) -> DeleteTenantDatabaseResult

Deletes a tenant database from your DB instance. This command only applies to RDS for Oracle container database (CDB) instances.

You can't delete a tenant database when it is the only tenant in the DB instance.

Parameters:

  • db_instance_identifier (Optional[String], default: None ) –

    The user-supplied identifier for the DB instance that contains the tenant database that you want to delete.

  • tenant_db_name (Optional[String], default: None ) –

    The user-supplied name of the tenant database that you want to remove from your DB instance. Amazon RDS deletes the tenant database with this name. This parameter isn’t case-sensitive.

  • skip_final_snapshot (Optional[Boolean], default: None ) –

    Specifies whether to skip the creation of a final DB snapshot before removing the tenant database from your DB instance. If you enable this parameter, RDS doesn't create a DB snapshot. If you don't enable this parameter, RDS creates a DB snapshot before it deletes the tenant database. By default, RDS doesn't skip the final snapshot. If you don't enable this parameter, you must specify the FinalDBSnapshotIdentifier parameter.

  • final_db_snapshot_identifier (Optional[String], default: None ) –

    The DBSnapshotIdentifier of the new DBSnapshot created when the SkipFinalSnapshot parameter is disabled.

    If you enable this parameter and also enable SkipFinalShapshot, the command results in an error.

Raises:

Source code in docs_src/capo_rds/_services/rds.py
def delete_tenant_database(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_instance_identifier: Optional["capo_rds.types.string.String"] = None,
    tenant_db_name: Optional["capo_rds.types.string.String"] = None,
    skip_final_snapshot: Optional["capo_rds.types.boolean.Boolean"] = None,
    final_db_snapshot_identifier: Optional["capo_rds.types.string.String"] = None,
) -> "capo_rds.types.delete_tenant_database_result.DeleteTenantDatabaseResult":
    """<p>Deletes a tenant database from your DB instance. This command only applies to RDS for Oracle container database (CDB) instances.</p> <p>You can't delete a tenant database when it is the only tenant in the DB instance.</p>

    Args:
        db_instance_identifier: <p>The user-supplied identifier for the DB instance that contains the tenant database that you want to delete.</p>
        tenant_db_name: <p>The user-supplied name of the tenant database that you want to remove from your DB instance. Amazon RDS deletes the tenant database with this name. This parameter isn’t case-sensitive.</p>
        skip_final_snapshot: <p>Specifies whether to skip the creation of a final DB snapshot before removing the tenant database from your DB instance. If you enable this parameter, RDS doesn't create a DB snapshot. If you don't enable this parameter, RDS creates a DB snapshot before it deletes the tenant database. By default, RDS doesn't skip the final snapshot. If you don't enable this parameter, you must specify the <code>FinalDBSnapshotIdentifier</code> parameter.</p>
        final_db_snapshot_identifier: <p>The <code>DBSnapshotIdentifier</code> of the new <code>DBSnapshot</code> created when the <code>SkipFinalSnapshot</code> parameter is disabled.</p> <note> <p>If you enable this parameter and also enable <code>SkipFinalShapshot</code>, the command results in an error.</p> </note>

    Raises:
        capo_rds.errors.db_instance_not_found_fault.DBInstanceNotFoundFault: <p> <code>DBInstanceIdentifier</code> doesn't refer to an existing DB instance.</p>
        capo_rds.errors.db_snapshot_already_exists_fault.DBSnapshotAlreadyExistsFault: <p> <code>DBSnapshotIdentifier</code> is already used by an existing snapshot.</p>
        capo_rds.errors.invalid_db_instance_state_fault.InvalidDBInstanceStateFault: <p>The DB instance isn't in a valid state.</p>
        capo_rds.errors.tenant_database_not_found_fault.TenantDatabaseNotFoundFault: <p>The specified tenant database wasn't found in the DB instance.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.delete_tenant_database_message.DeleteTenantDatabaseMessage]",
    ) -> OperationResponse[
        "capo_rds.types.delete_tenant_database_result.DeleteTenantDatabaseResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.delete_tenant_database

        output, http_response = (
            capo_rds._operations.amazon_rd_sv19.delete_tenant_database.delete_tenant_database(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_rds.types.delete_tenant_database_result.DeleteTenantDatabaseResult",
    ) -> dict[str, Any]:
        import capo_rds.types.delete_tenant_database_result

        return capo_rds.types.delete_tenant_database_result.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("DeleteTenantDatabase", redact_output=_redact_output),
    )
    input_: capo_rds.types.delete_tenant_database_message.DeleteTenantDatabaseMessage = {}
    if db_instance_identifier is not None:
        input_["db_instance_identifier"] = db_instance_identifier
    if tenant_db_name is not None:
        input_["tenant_db_name"] = tenant_db_name
    if skip_final_snapshot is not None:
        input_["skip_final_snapshot"] = skip_final_snapshot
    if final_db_snapshot_identifier is not None:
        input_["final_db_snapshot_identifier"] = final_db_snapshot_identifier

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output