[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# Spanner import and export overview\n\nYou can import and export a large amount of data into or out of\nSpanner using any of the following methods:\n\n- Import or export any Spanner database using [Dataflow](/dataflow).\n- Export any Spanner database into a Cloud Storage bucket using either Avro or CSV file formats.\n- Import data from Avro or CSV files into a new Spanner database.\n\n| **Note:** If you export a Spanner database to Cloud Storage, then import it back to Spanner, make sure you import the database into a Spanner instance with the same (or higher-tier) Spanner edition as the source instance. Otherwise, the import might fail. For more information, see the [Spanner editions overview](/spanner/docs/editions-overview).\n\nUse cases\n---------\n\nYou can use Spanner import and export for the following use cases:\n\n- **Bulk loading**: You can import data in bulk into Spanner.\n- **Long-term backup and archiving** : You can export your database at any time\n and store it in a Cloud Storage bucket location of your choice for long-term\n backup or archiving. In addition, you can use [point-in-time\n recovery](/spanner/docs/pitr) to export a database from a specific past timestamp.\n If you are looking for disaster recovery techniques that offer quicker\n restoration but have a shorter retention periods,\n consider using [backups](/spanner/docs/backup)\n or [point-in-time recovery (PITR)](/spanner/docs/pitr).\n\n- **Copying databases to development or test projects**: You can export a\n database from a production project and then import it into your development or\n test project to use for integration tests or other experiments.\n\n- **Ingesting for analytics**: You can export a database to ingest your\n operational data in bulk to analytics services such as BigQuery.\n BigQuery can automatically ingest data in Avro format\n from a Cloud Storage bucket, making it easier for you to run analytics\n on your operational data.\n If you want to use BigQuery for real-time analysis of\n Spanner data without copying or moving the data, you can use\n Spanner federated queries instead.\n\nCompare import and export to back up and restore\n------------------------------------------------\n\nSpanner import and export is similar to back up and restore\nin many ways. The following table describes similarities and differences\nbetween them to help you decide which one to use.\n\nCompare file formats\n--------------------\n\nThe following table compares the capability differences between Avro and CSV\nfile formats when importing and exporting Spanner data.\n\n### Avro files\n\nWhen exporting to Avro format, you can specify a [list of tables to\nexport](/spanner/docs/export#export-subset-tables). Any\n[child tables](/spanner/docs/schema-and-data-model#parent-child_table_relationships)\nexported this way need to be accompanied by their parent tables.\nSpanner maintains the entire database schema in the exported\nfiles.\n\nWhen importing from Avro format, Spanner recreates the exported\ndatabase's whole schema, including all tables. Tables included in the original\nexport receive all their exported data; all other tables remain empty.\n\nThe Spanner page of the Google Cloud console offers limited\nAvro-format import and export options. For example, you can't set network and\nsubnetwork options. For a wider set of options, use\n[Dataflow](/dataflow/docs/overview) instead.\n\n#### Limitations\n\nYou can't export and import [locality groups](/spanner/docs/create-manage-locality-groups)\nto the Avro format.\n\n### CSV files\n\nYou can export only a single Spanner table in the CSV format at\na time. When you export, the schema is not exported, only the data\nis exported.\n\nBefore importing from CSV files, you need to\n[create a JSON manifest](/spanner/docs/import-export-csv#create-json-manifest)\nfile.\n\nPricing\n-------\n\nThere are no additional charges from Spanner for using the\nexport or import tools; you pay the standard rates for data storage when you\nimport a database to Spanner. However, there are other potential\ncharges associated with importing and exporting databases. For more information,\nsee [Database export and import pricing](/spanner/pricing#export-import-pricing).\n\nWhat's next\n-----------\n\n- [Export databases from Spanner to Avro](/spanner/docs/export)\n- [Import Spanner Avro files](/spanner/docs/import)\n- [Import and export data in CSV format](/spanner/docs/import-export-csv)\n- [Import data from non-Spanner databases](/spanner/docs/import-non-spanner)"]]