---
title: "PATCH /v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}"
method: PATCH
path: "/v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}"
tags: ["projects"]
---

# PATCH /v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}

`PATCH /v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}`

## Request

- Base URL: `https://spanner.googleapis.com`
- URL: `https://spanner.googleapis.com/v1/projects/{projectsId}/instances/{instancesId}/databases/{databasesId}`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/spanner.admin`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/spanner.admin`

Updates a Cloud Spanner database. The returned long-running operation can be used to track the progress of updating the database. If the named database does not exist, returns `NOT_FOUND`. While the operation is pending: * The database's reconciling field is set to true. * Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata's cancel_time is set, the updates are reverted, and the operation terminates with a `CANCELLED` status. * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation is done (returns successfully or with error). * Reading the database via the API continues to give the pre-request values. Upon completion of the returned operation: * The new values are in effect and readable via the API. * The database's reconciling field becomes false. The returned long-running operation will have a name of the format `projects//instances//databases//operations/` and can be used to track the database modification. The metadata field type is UpdateDatabaseMetadata. The response field type is Database, if successful.

## Path parameters

- `projectsId` string, required
- `instancesId` string, required
- `databasesId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string
- `updateMask` string, google-fieldmask

## Request body

- Database: A Cloud Spanner database.
  - `createTime` string, google-datetime: Output only. If exists, the time at which the database creation started.
  - `databaseDialect` 'DATABASE_DIALECT_UNSPECIFIED' | 'GOOGLE_STANDARD_SQL' | 'POSTGRESQL': Output only. The dialect of the Cloud Spanner Database.
  - `defaultLeader` string: Output only. The read-write region which contains the database's leader replicas. This is the same as the value of default_leader database option set using DatabaseAdmin.CreateDatabase or DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
  - `defaultReadLockMode` 'READ_LOCK_MODE_UNSPECIFIED' | 'PESSIMISTIC' | 'OPTIMISTIC': Output only. The default read lock mode for transactions. If not configured via DDL, `READ_LOCK_MODE_UNSPECIFIED` will be returned. For transactions, if lock mode is unspecified, it defaults to `PESSIMISTIC` for `SERIALIZABLE` isolation and `OPTIMISTIC` for `REPEATABLE_READ` isolation.
  - `defaultTransactionIsolation` 'ISOLATION_LEVEL_UNSPECIFIED' | 'SERIALIZABLE' | 'REPEATABLE_READ': Output only. The default isolation level for transactions in this database. If not configured via DDL, `ISOLATION_LEVEL_UNSPECIFIED` will be returned. For transactions, if isolation level is unspecified, it defaults to `SERIALIZABLE`.
  - `earliestVersionTime` string, google-datetime: Output only. Earliest timestamp at which older versions of the data can be read. This value is continuously updated by Cloud Spanner and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery.
  - `enableDropProtection` boolean: Optional. Whether drop protection is enabled for this database. Defaults to false, if not set. For more details, please see how to [prevent accidental database deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion).
  - `encryptionConfig` EncryptionConfig: Encryption configuration for a Cloud Spanner database.
    - `kmsKeyName` string: The Cloud KMS key to be used for encrypting and decrypting the database. Values are of the form `projects//locations//keyRings//cryptoKeys/`.
    - `kmsKeyNames` string[]: Specifies the KMS configuration for one or more keys used to encrypt the database. Values are of the form `projects//locations//keyRings//cryptoKeys/`. The keys referenced by `kms_key_names` must fully cover all regions of the database's instance configuration. Some examples: * For regional (single-region) instance configurations, specify a regional location KMS key. * For multi-region instance configurations of type `GOOGLE_MANAGED`, either specify a multi-region location KMS key or multiple regional location KMS keys that cover all regions in the instance configuration. * For an instance configuration of type `USER_MANAGED`, specify only regional location KMS keys to cover each region in the instance configuration. Multi-region location KMS keys aren't supported for `USER_MANAGED` type instance configurations.
  - `encryptionInfo` EncryptionInfo[]: Output only. For databases that are using customer managed encryption, this field contains the encryption information for the database, such as all Cloud KMS key versions that are in use. The `encryption_status` field inside of each `EncryptionInfo` is not populated. For databases that are using Google default or other types of encryption, this field is empty. This field is propagated lazily from the backend. There might be a delay from when a key version is being used and when it appears in this field.
    - `encryptionStatus` Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
      - `code` integer: The status code, which should be an enum value of google.rpc.Code.
      - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
      - `message` string: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
    - `encryptionType` 'TYPE_UNSPECIFIED' | 'GOOGLE_DEFAULT_ENCRYPTION' | 'CUSTOMER_MANAGED_ENCRYPTION': Output only. The type of encryption.
    - `kmsKeyVersion` string: Output only. A Cloud KMS key version that is being used to protect the database or backup.
  - `name` string: Required. The name of the database. Values are of the form `projects//instances//databases/`, where `` is as specified in the `CREATE DATABASE` statement. This name can be passed to other API methods to identify the database.
  - `quorumInfo` QuorumInfo: Information about the dual-region quorum.
    - `etag` string: Output only. The etag is used for optimistic concurrency control as a way to help prevent simultaneous `ChangeQuorum` requests that might create a race condition.
    - `initiator` 'INITIATOR_UNSPECIFIED' | 'GOOGLE' | 'USER': Output only. Whether this `ChangeQuorum` is Google or User initiated.
    - `quorumType` QuorumType: Information about the database quorum type. This only applies to dual-region instance configs.
      - `dualRegion` DualRegionQuorum: Message type for a dual-region quorum. Currently this type has no options.
      - `singleRegion` SingleRegionQuorum: Message type for a single-region quorum.
        - `servingLocation` string: Required. The location of the serving region, for example, "us-central1". The location must be one of the regions within the dual-region instance configuration of your database. The list of valid locations is available using the GetInstanceConfig API. This should only be used if you plan to change quorum to the single-region quorum type.
    - `startTime` string, google-datetime: Output only. The timestamp when the request was triggered.
  - `reconciling` boolean: Output only. If true, the database is being updated. If false, there are no ongoing update operations for the database.
  - `restoreInfo` RestoreInfo: Information about the database restore.
    - `backupInfo` BackupInfo: Information about a backup.
      - `backup` string: Name of the backup.
      - `createTime` string, google-datetime: The time the CreateBackup request was received.
      - `sourceDatabase` string: Name of the database the backup was created from.
      - `versionTime` string, google-datetime: The backup contains an externally consistent copy of `source_database` at the timestamp specified by `version_time`. If the CreateBackup request did not specify `version_time`, the `version_time` of the backup is equivalent to the `create_time`.
    - `sourceType` 'TYPE_UNSPECIFIED' | 'BACKUP': The type of the restore source.
  - `state` 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'READY_OPTIMIZING': Output only. The current database state.
  - `versionRetentionPeriod` string: Output only. The period in which Cloud Spanner retains all versions of data for the database. This is the same as the value of version_retention_period database option set using UpdateDatabaseDdl. Defaults to 1 hour, if not set.

## Response `200`

Successful response

- Operation: This resource represents a long-running operation that is the result of a network API call.
  - `done` boolean: If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
  - `error` Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
    - `code` integer: The status code, which should be an enum value of google.rpc.Code.
    - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
    - `message` string: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  - `metadata` object: Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
  - `name` string: The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
  - `response` object: The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.

## Changes

- **2026-12-05** `a7213b86b5d7`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/spanner.admin` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/spanner.admin` was removed from the endpoint's security scheme `Oauth2c`
- **2026-11-20** `54a0040f5251`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/spanner.admin` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/spanner.admin` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/spanner/changes/v1/projects/:projectsId/instances/:instancesId/databases/:databasesId/patch.md)

---

[API](https://skmtc.dev/google/apis/spanner.md) - [All operations](https://skmtc.dev/google/apis/spanner/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/spanner/revisions/a7213b86b5d7?raw)
