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, returnsNOT_FOUND.
Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata'scancelTimeis set, the updates are reverted, and the operation terminates with aCANCELLEDstatus.
New databases.patch requests will return aFAILED_PRECONDITIONerror 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 returned long-running operation will have a name of the formatprojects/<project>/instances/<instance>/databases/<database>/operations/<operationId>and can be used to track the database modification. The metadata field type isUpdateDatabaseMetadata. The response field type isDatabase, if successful.
Required. The name of the database. Values are of the formprojects/<project>/instances/<instance>/databases/<database>, where<database>is as specified in theCREATE DATABASEstatement. This name can be passed to other API methods to identify the database.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-18 UTC."],[],[],null,["# Method: projects.instances.databases.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdates 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`.\n\nWhile the operation is pending:\n\n- The database's [reconciling](/spanner/docs/reference/rest/v1/projects.instances.databases#Database.FIELDS.reconciling) field is set to true.\n- Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata's [cancelTime](/spanner/docs/reference/rest/v1/UpdateDatabaseMetadata#FIELDS.cancel_time) is set, the updates are reverted, and the operation terminates with a `CANCELLED` status.\n- New databases.patch requests will return a `FAILED_PRECONDITION` error until the pending operation is done (returns successfully or with error).\n- Reading the database via the API continues to give the pre-request values.\n\nUpon completion of the returned operation:\n\n- The new values are in effect and readable via the API.\n- The database's [reconciling](/spanner/docs/reference/rest/v1/projects.instances.databases#Database.FIELDS.reconciling) field becomes false.\n\nThe returned long-running operation will have a name of the format `projects/\u003cproject\u003e/instances/\u003cinstance\u003e/databases/\u003cdatabase\u003e/operations/\u003coperationId\u003e` and can be used to track the database modification. The metadata field type is [UpdateDatabaseMetadata](/spanner/docs/reference/rest/v1/UpdateDatabaseMetadata). The response field type is [Database](/spanner/docs/reference/rest/v1/projects.instances.databases#Database), if successful.\n\n### HTTP request\n\nChoose a location: \nglobal europe-west8 me-central2 us-central1 us-central2 us-east1 us-east4 us-east5 us-south1 us-west1 us-west2 us-west3 us-west4 us-west8 us-east7 \n\n\u003cbr /\u003e\n\nThe URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Query parameters\n\n### Request body\n\nThe request body contains an instance of [Database](/spanner/docs/reference/rest/v1/projects.instances.databases#Database).\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/spanner/docs/reference/rest/v1/projects.instanceConfigs.operations#Operation).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/spanner.admin`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]