1. Registry
  2. Packages
  3. Oracle Cloud Infrastructure
  4. API Docs
  5. Database
  6. getDatabaseSnapshots
Viewing docs for Oracle Cloud Infrastructure v5.7.0
published on Thursday, Nov 12, 2026 by Pulumi
oci logo oci logo
Viewing docs for Oracle Cloud Infrastructure v5.7.0
published on Thursday, Nov 12, 2026 by Pulumi

    This data source provides the list of Database Snapshots in Oracle Cloud Infrastructure Database service.

    Gets a list of the Exadata Database Snapshots in the specified compartment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testDatabaseSnapshots = oci.database.getDatabaseSnapshots({
        clusterId: testCluster.id,
        compartmentId: compartmentId,
        databaseId: testDatabase.id,
        name: databaseSnapshotName,
        state: databaseSnapshotState,
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_database_snapshots = oci.database.get_database_snapshots(cluster_id=test_cluster["id"],
        compartment_id=compartment_id,
        database_id=test_database["id"],
        name=database_snapshot_name,
        state=database_snapshot_state)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/v5/go/oci/database"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := database.GetDatabaseSnapshots(ctx, &database.GetDatabaseSnapshotsArgs{
    			ClusterId:     pulumi.StringRef(testCluster.Id),
    			CompartmentId: pulumi.StringRef(compartmentId),
    			DatabaseId:    pulumi.StringRef(testDatabase.Id),
    			Name:          pulumi.StringRef(databaseSnapshotName),
    			State:         pulumi.StringRef(databaseSnapshotState),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testDatabaseSnapshots = Oci.Database.GetDatabaseSnapshots.Invoke(new()
        {
            ClusterId = testCluster.Id,
            CompartmentId = compartmentId,
            DatabaseId = testDatabase.Id,
            Name = databaseSnapshotName,
            State = databaseSnapshotState,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Database.DatabaseFunctions;
    import com.pulumi.oci.Database.inputs.GetDatabaseSnapshotsArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var testDatabaseSnapshots = DatabaseFunctions.getDatabaseSnapshots(GetDatabaseSnapshotsArgs.builder()
                .clusterId(testCluster.get("id"))
                .compartmentId(compartmentId)
                .databaseId(testDatabase.get("id"))
                .name(databaseSnapshotName)
                .state(databaseSnapshotState)
                .build());
    
        }
    }
    
    variables:
      testDatabaseSnapshots:
        fn::invoke:
          function: oci:Database:getDatabaseSnapshots
          arguments:
            clusterId: ${testCluster.id}
            compartmentId: ${compartmentId}
            databaseId: ${testDatabase.id}
            name: ${databaseSnapshotName}
            state: ${databaseSnapshotState}
    
    terraform {
      required_providers {
        oci = {
          source = "pulumi/oci"
        }
      }
    }
    
    data "oci_database_database_snapshots" "testDatabaseSnapshots" {
      cluster_id     = testCluster.id
      compartment_id = compartmentId
      database_id    = testDatabase.id
      name           = databaseSnapshotName
      state          = databaseSnapshotState
    }
    

    Using getDatabaseSnapshots

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getDatabaseSnapshots(args: GetDatabaseSnapshotsArgs, opts?: InvokeOptions): Promise<GetDatabaseSnapshotsResult>
    function getDatabaseSnapshotsOutput(args: GetDatabaseSnapshotsOutputArgs, opts?: InvokeOutputOptions): Output<GetDatabaseSnapshotsResult>
    def get_database_snapshots(cluster_id: Optional[str] = None,
                               compartment_id: Optional[str] = None,
                               database_id: Optional[str] = None,
                               filters: Optional[Sequence[GetDatabaseSnapshotsFilter]] = None,
                               name: Optional[str] = None,
                               state: Optional[str] = None,
                               opts: Optional[InvokeOptions] = None) -> GetDatabaseSnapshotsResult
    def get_database_snapshots_output(cluster_id: pulumi.Input[Optional[str]] = None,
                               compartment_id: pulumi.Input[Optional[str]] = None,
                               database_id: pulumi.Input[Optional[str]] = None,
                               filters: pulumi.Input[Optional[Sequence[pulumi.Input[GetDatabaseSnapshotsFilterArgs]]]] = None,
                               name: pulumi.Input[Optional[str]] = None,
                               state: pulumi.Input[Optional[str]] = None,
                               opts: Optional[InvokeOutputOptions] = None) -> Output[GetDatabaseSnapshotsResult]
    func GetDatabaseSnapshots(ctx *Context, args *GetDatabaseSnapshotsArgs, opts ...InvokeOption) (*GetDatabaseSnapshotsResult, error)
    func GetDatabaseSnapshotsOutput(ctx *Context, args *GetDatabaseSnapshotsOutputArgs, opts ...InvokeOption) GetDatabaseSnapshotsResultOutput

    > Note: This function is named GetDatabaseSnapshots in the Go SDK.

    public static class GetDatabaseSnapshots 
    {
        public static Task<GetDatabaseSnapshotsResult> InvokeAsync(GetDatabaseSnapshotsArgs args, InvokeOptions? opts = null)
        public static Output<GetDatabaseSnapshotsResult> Invoke(GetDatabaseSnapshotsInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetDatabaseSnapshotsResult> Invoke(GetDatabaseSnapshotsInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetDatabaseSnapshotsResult> getDatabaseSnapshots(GetDatabaseSnapshotsArgs args, InvokeOptions options)
    public static Output<GetDatabaseSnapshotsResult> getDatabaseSnapshots(GetDatabaseSnapshotsArgs args, InvokeOptions options)
    public static Output<GetDatabaseSnapshotsResult> getDatabaseSnapshots(GetDatabaseSnapshotsArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: oci:Database/getDatabaseSnapshots:getDatabaseSnapshots
      arguments:
        # arguments dictionary
    data "oci_database_get_database_snapshots" "name" {
        # arguments
    }

    The following arguments are supported:

    ClusterId string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    CompartmentId string
    The compartment OCID.
    DatabaseId string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    Filters List<GetDatabaseSnapshotsFilter>
    Name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    State string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    ClusterId string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    CompartmentId string
    The compartment OCID.
    DatabaseId string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    Filters []GetDatabaseSnapshotsFilter
    Name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    State string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    cluster_id string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartment_id string
    The compartment OCID.
    database_id string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    filters list(object)
    name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    clusterId String
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartmentId String
    The compartment OCID.
    databaseId String
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    filters List<GetSnapshotsFilter>
    name String
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state String
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    clusterId string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartmentId string
    The compartment OCID.
    databaseId string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    filters GetDatabaseSnapshotsFilter[]
    name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    cluster_id str
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartment_id str
    The compartment OCID.
    database_id str
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    filters Sequence[GetDatabaseSnapshotsFilter]
    name str
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state str
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    clusterId String
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartmentId String
    The compartment OCID.
    databaseId String
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    filters List<Property Map>
    name String
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state String
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.

    getDatabaseSnapshots Result

    The following output properties are available:

    DatabaseSnapshotCollections List<GetDatabaseSnapshotsDatabaseSnapshotCollection>
    The list of database_snapshot_collection.
    Id string
    The provider-assigned unique ID for this managed resource.
    ClusterId string
    The OCID of the VM cluster.
    CompartmentId string
    The OCID of the compartment.
    DatabaseId string
    The OCID of the Exadata Database.
    Filters List<GetDatabaseSnapshotsFilter>
    Name string
    The user-friendly name for the Database Snapshot. The name should be unique.
    State string
    The current state of the Exadata Database Snapshot.
    DatabaseSnapshotCollections []GetDatabaseSnapshotsDatabaseSnapshotCollection
    The list of database_snapshot_collection.
    Id string
    The provider-assigned unique ID for this managed resource.
    ClusterId string
    The OCID of the VM cluster.
    CompartmentId string
    The OCID of the compartment.
    DatabaseId string
    The OCID of the Exadata Database.
    Filters []GetDatabaseSnapshotsFilter
    Name string
    The user-friendly name for the Database Snapshot. The name should be unique.
    State string
    The current state of the Exadata Database Snapshot.
    database_snapshot_collections list(object)
    The list of database_snapshot_collection.
    id string
    The provider-assigned unique ID for this managed resource.
    cluster_id string
    The OCID of the VM cluster.
    compartment_id string
    The OCID of the compartment.
    database_id string
    The OCID of the Exadata Database.
    filters list(object)
    name string
    The user-friendly name for the Database Snapshot. The name should be unique.
    state string
    The current state of the Exadata Database Snapshot.
    databaseSnapshotCollections List<GetSnapshotsSnapshotCollection>
    The list of database_snapshot_collection.
    id String
    The provider-assigned unique ID for this managed resource.
    clusterId String
    The OCID of the VM cluster.
    compartmentId String
    The OCID of the compartment.
    databaseId String
    The OCID of the Exadata Database.
    filters List<GetSnapshotsFilter>
    name String
    The user-friendly name for the Database Snapshot. The name should be unique.
    state String
    The current state of the Exadata Database Snapshot.
    databaseSnapshotCollections GetDatabaseSnapshotsDatabaseSnapshotCollection[]
    The list of database_snapshot_collection.
    id string
    The provider-assigned unique ID for this managed resource.
    clusterId string
    The OCID of the VM cluster.
    compartmentId string
    The OCID of the compartment.
    databaseId string
    The OCID of the Exadata Database.
    filters GetDatabaseSnapshotsFilter[]
    name string
    The user-friendly name for the Database Snapshot. The name should be unique.
    state string
    The current state of the Exadata Database Snapshot.
    database_snapshot_collections Sequence[GetDatabaseSnapshotsDatabaseSnapshotCollection]
    The list of database_snapshot_collection.
    id str
    The provider-assigned unique ID for this managed resource.
    cluster_id str
    The OCID of the VM cluster.
    compartment_id str
    The OCID of the compartment.
    database_id str
    The OCID of the Exadata Database.
    filters Sequence[GetDatabaseSnapshotsFilter]
    name str
    The user-friendly name for the Database Snapshot. The name should be unique.
    state str
    The current state of the Exadata Database Snapshot.
    databaseSnapshotCollections List<Property Map>
    The list of database_snapshot_collection.
    id String
    The provider-assigned unique ID for this managed resource.
    clusterId String
    The OCID of the VM cluster.
    compartmentId String
    The OCID of the compartment.
    databaseId String
    The OCID of the Exadata Database.
    filters List<Property Map>
    name String
    The user-friendly name for the Database Snapshot. The name should be unique.
    state String
    The current state of the Exadata Database Snapshot.

    Supporting Types

    GetDatabaseSnapshotsDatabaseSnapshotCollection

    GetDatabaseSnapshotsDatabaseSnapshotCollectionItem

    ClusterId string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    CompartmentId string
    The compartment OCID.
    DatabaseId string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    DefinedTags Dictionary<string, string>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    FreeformTags Dictionary<string, string>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    The OCID of the Exadata Database Snapshot.
    LifecycleDetails string
    Additional information about the current lifecycle state of the Exadata Database Snapshot.
    Name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    State string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    SystemTags Dictionary<string, string>
    System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    TimeCreated string
    The date and time that the Exadata Database Snapshot was created, as expressed in RFC 3339 format. For example: 2023-06-27T21:10:29Z
    ClusterId string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    CompartmentId string
    The compartment OCID.
    DatabaseId string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    DefinedTags map[string]string
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    FreeformTags map[string]string
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    Id string
    The OCID of the Exadata Database Snapshot.
    LifecycleDetails string
    Additional information about the current lifecycle state of the Exadata Database Snapshot.
    Name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    State string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    SystemTags map[string]string
    System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    TimeCreated string
    The date and time that the Exadata Database Snapshot was created, as expressed in RFC 3339 format. For example: 2023-06-27T21:10:29Z
    cluster_id string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartment_id string
    The compartment OCID.
    database_id string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    defined_tags map(string)
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    freeform_tags map(string)
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id string
    The OCID of the Exadata Database Snapshot.
    lifecycle_details string
    Additional information about the current lifecycle state of the Exadata Database Snapshot.
    name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    system_tags map(string)
    System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    time_created string
    The date and time that the Exadata Database Snapshot was created, as expressed in RFC 3339 format. For example: 2023-06-27T21:10:29Z
    clusterId String
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartmentId String
    The compartment OCID.
    databaseId String
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    definedTags Map<String,String>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    freeformTags Map<String,String>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    The OCID of the Exadata Database Snapshot.
    lifecycleDetails String
    Additional information about the current lifecycle state of the Exadata Database Snapshot.
    name String
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state String
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    systemTags Map<String,String>
    System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    timeCreated String
    The date and time that the Exadata Database Snapshot was created, as expressed in RFC 3339 format. For example: 2023-06-27T21:10:29Z
    clusterId string
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartmentId string
    The compartment OCID.
    databaseId string
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    definedTags {[key: string]: string}
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    freeformTags {[key: string]: string}
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id string
    The OCID of the Exadata Database Snapshot.
    lifecycleDetails string
    Additional information about the current lifecycle state of the Exadata Database Snapshot.
    name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state string
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    systemTags {[key: string]: string}
    System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    timeCreated string
    The date and time that the Exadata Database Snapshot was created, as expressed in RFC 3339 format. For example: 2023-06-27T21:10:29Z
    cluster_id str
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartment_id str
    The compartment OCID.
    database_id str
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    defined_tags Mapping[str, str]
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    freeform_tags Mapping[str, str]
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id str
    The OCID of the Exadata Database Snapshot.
    lifecycle_details str
    Additional information about the current lifecycle state of the Exadata Database Snapshot.
    name str
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state str
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    system_tags Mapping[str, str]
    System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    time_created str
    The date and time that the Exadata Database Snapshot was created, as expressed in RFC 3339 format. For example: 2023-06-27T21:10:29Z
    clusterId String
    A filter to return only Exadata Database Snapshots that match the given VM cluster.
    compartmentId String
    The compartment OCID.
    databaseId String
    A filter to return only Exadata Database Snapshots that match the given Database Id.
    definedTags Map<String>
    Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    freeformTags Map<String>
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    id String
    The OCID of the Exadata Database Snapshot.
    lifecycleDetails String
    Additional information about the current lifecycle state of the Exadata Database Snapshot.
    name String
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    state String
    A filter to return only Exadata Database Snapshots that match the given lifecycle state exactly.
    systemTags Map<String>
    System tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
    timeCreated String
    The date and time that the Exadata Database Snapshot was created, as expressed in RFC 3339 format. For example: 2023-06-27T21:10:29Z

    GetDatabaseSnapshotsFilter

    Name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    Values List<string>
    Regex bool
    Name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    Values []string
    Regex bool
    name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    values list(string)
    regex bool
    name String
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    values List<String>
    regex Boolean
    name string
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    values string[]
    regex boolean
    name str
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    values Sequence[str]
    regex bool
    name String
    A filter to return only resources that match the entire name given. The match is not case sensitive.
    values List<String>
    regex Boolean

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo oci logo
    Viewing docs for Oracle Cloud Infrastructure v5.7.0
    published on Thursday, Nov 12, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial