데이터 덤프 파일을 수동으로 가져오는 대신 AlloyDB용 Database Migration Service를 사용할 수 있습니다.
이 서비스를 사용하면 모든 데이터베이스와 메타데이터를 포함하여 활성 PostgreSQL 인스턴스의 전체 콘텐츠를 새 AlloyDB 클러스터로 마이그레이션할 수 있습니다. Database Migration Service를 사용하면 최소한의 다운타임으로 기존 애플리케이션을 AlloyDB를 새 데이터 스토어로 사용하는 방식으로 전환할 수 있습니다.
AlloyDB로 가져오려는 데이터베이스의 기본 언어가 여기에 나열된 두 가지 언어 이외의 libc 언어인 경우에도 데이터를 가져올 수 있지만 기본 언어는 적용되지 않습니다. ORDER BY를 사용하는 SQL 쿼리가 결과를 올바르게 정렬하도록 하려면 데이터를 가져온 후 추가 단계를 수행해야 할 수 있습니다.
새 데이터베이스에서 libc에서 제공하는 AlloyDB의 기본 언어인 C.UTF-8를 사용하도록 허용하는 것이 좋습니다. 그런 다음 애플리케이션의 쿼리가 ORDER BY 절에 포함될 수 있는 열에 정렬을 연결하고 각 열에 적절한 ICU 기반 정렬을 지정합니다. 다음과 같은 ALTER TABLE DDL 쿼리를 통해 이 작업을 실행할 수 있습니다.
새 AlloyDB 클러스터는 ICU에서 제공하는 언어를 기반으로 수백 개의 정렬을 정의하며 PostgreSQL CREATE COLLATION 기능을 사용하여 더 추가할 수 있습니다. AlloyDB 클러스터에 정의된 ICU 기반 정렬 이름의 전체 목록을 보려면 인스턴스에서 다음 쿼리를 실행합니다.
AlloyDB는 ICU 기반 정렬 외에도 ucs_basic라는 PostgreSQL 내장 정렬을 지원합니다. 이 정렬은 유니코드 코드 포인트의 표준 순서를 사용하여 특히 효율적인 정렬을 지원합니다. 적절한 정렬 순서가 유니코드 코드 포인트 목록과 일치하는 열에 사용하는 것이 좋습니다.
데이터 내보내기
명령줄 유틸리티를 사용하여 AlloyDB 데이터를 다양한 형식으로 Cloud Storage 버킷에 저장된 파일로 내보낼 수 있습니다.
[[["이해하기 쉬움","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(UTC)"],[[["\u003cp\u003eAlloyDB for PostgreSQL supports two primary methods for data migration: manually importing data from files or using Google Cloud Database Migration Service to migrate from an active PostgreSQL instance.\u003c/p\u003e\n"],["\u003cp\u003eData can be imported into AlloyDB from files in CSV, DMP, or SQL formats, located in a Cloud Storage bucket, using \u003ccode\u003epsql\u003c/code\u003e or \u003ccode\u003epg_restore\u003c/code\u003e utilities.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud Database Migration Service allows migrating an entire active PostgreSQL instance, including all databases and metadata, to a new AlloyDB cluster with minimal downtime.\u003c/p\u003e\n"],["\u003cp\u003eAlloyDB supports a range of locales, with a recommendation to use the default \u003ccode\u003eC.UTF-8\u003c/code\u003e locale and to define ICU-based collations for specific columns that require particular sort orders.\u003c/p\u003e\n"],["\u003cp\u003eData can be exported from AlloyDB to files in CSV, DMP, or SQL formats, stored in a Cloud Storage bucket, using \u003ccode\u003epsql\u003c/code\u003e or \u003ccode\u003epg_dump\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Migration overview\n\nThis page provides an overview of ways to migrate data into and out of\nAlloyDB for PostgreSQL.\n\nImporting data\n--------------\n\nYou can migrate data into AlloyDB through two methods:\n\n- Manually importing files containing your data.\n\n- Using Google Cloud Database Migration Service to migrate the contents of a whole,\n active PostgreSQL instance into a new AlloyDB cluster.\n\n| **Caution:** If your source database uses a default collation based on a locale provided by `libc`, you might need to add ICU-based collations to your tables after importing their data into AlloyDB. For more information, see [Supported locales for imported data](#locales).\n\n### Import archived data from files\n\nAlloyDB lets you import\ndata from files located in a Cloud Storage bucket.\nAlloyDB supports a variety of file formats for data\nimport, including the following:\n\n- [CSV](/alloydb/docs/import-csv-file), with the contents of one table\n per file, loaded using `psql`.\n\n- [DMP](/alloydb/docs/import-dmp-file), a binary archive of a whole\n PostgreSQL database, imported using `pg_restore`.\n\n- [SQL](/alloydb/docs/import-sql-file), a plain-text reconstruction of a\n PostgreSQL database, processed with `psql`.\n\n### Migrate an active instance with Database Migration Service\n\nAs an alternative to manually importing data-dump files, you can use\n[Database Migration Service for AlloyDB](/database-migration/docs/postgresql-to-alloydb).\nThis service lets you migrate the entire contents of an\nactive PostgreSQL instance---including all of its databases and\nmetadata---into a new AlloyDB cluster. Database Migration Service can\nhelp you transition your existing applications to using\nAlloyDB as their new datastore with minimal downtime.\n\n### Supported locales for imported data\n\nAlloyDB supports the following\n[locales](https://www.postgresql.org/docs/16//locale.html):\n\n- The full set of ICU-provided locales.\n- A limited set of locales provided by `libc`:\n - `C.UTF-8`\n - `en_US.utf8`\n\nIf the database you want to import into AlloyDB defaults\nto a `libc` locale other than the two listed here, you can still import\nyour data, but that default won't carry over. To ensure that SQL queries\nusing `ORDER BY` sort their results properly, you might need to take\nadditional steps after importing your data.\n\nWe recommend allowing your new database to use the default locale for\nAlloyDB: `C.UTF-8`, provided by `libc`. Then, associate\n[collations](https://www.postgresql.org/docs/16//collation.html) with any\ncolumns that your application's queries might involve in `ORDER BY`\nclauses, naming an appropriate ICU-based collation for each one. You can\ndo this through [`ALTER TABLE` DDL\nqueries](https://www.postgresql.org/docs/16//sql-altertable.html), such as the following: \n\n ALTER TABLE \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eTABLE_NAME\u003c/span\u003e\u003c/var\u003e\n ALTER COLUMN \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eCOLUMN_NAME\u003c/span\u003e\u003c/var\u003e\n SET DATA TYPE \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCOLUMN_DATA_TYPE\u003c/span\u003e\u003c/var\u003e\n COLLATE \"\u003cvar translate=\"no\"\u003eCOLLATION_NAME\u003c/var\u003e\";\n\nA new AlloyDB cluster defines hundreds of collations\nbased on ICU-provided locales, and you can add more using [the PostgreSQL\n`CREATE COLLATION` facility](https://www.postgresql.org/docs/16//sql-createcollation.html). To\nsee the full list of ICU-based collation names defined on an\nAlloyDB cluster,\nrun the following query on any of its instances: \n\n SELECT collname FROM pg_collation WHERE collprovider = 'i';\n\nIn addition to ICU-based collations, AlloyDB supports the\nPostgreSQL built-in collation named `ucs_basic`. This collation uses\nthe standard order of Unicode code points to enable especially efficient\nsorting. We recommend its use with columns whose appropriate sort order\nmatches that of the Unicode code-point list.\n\nExporting data\n--------------\n\nYou can use command-line utilities to export your AlloyDB\ndata into files stored on a Cloud Storage bucket, in a variety of formats:\n\n- [CSV](/alloydb/docs/export-csv-file), exporting one table per file,\n using `psql`.\n\n- [DMP](/alloydb/docs/export-dmp-file), using `pg_dump` to create a\n portable, binary archive of your whole database.\n\n- [SQL](/alloydb/docs/export-sql-file), using `pg_dump` to create a list\n of DDL and SQL statements to reconstruct your database.\n\nWhat's next\n-----------\n\n- [Migrate data from a vector database to AlloyDB using LangChain](/alloydb/docs/ai/migrate-data-from-langchain-vector-stores-to-alloydb)."]]