Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Ruang kerja konversi lama adalah jenis ruang kerja konversi yang lebih lama dan lebih terbatas. Ruang kerja konversi lama tidak mendukung fitur konversi yang ditingkatkan Gemini atau editor SQL interaktif. Anda hanya dapat menggunakannya untuk mengonversi skema sumber dengan alat migrasi Ora2Pg.
Sebaiknya jangan gunakan jenis ruang kerja konversi lama untuk migrasi Anda karena jenis ruang kerja ini memiliki beberapa batasan lain pada alur kerja konversi:
Ruang kerja konversi interaktif
Ruang kerja konversi lama
Konversi objek skema dan kode terjadi di Database Migration Service.
Anda melakukan konversi skema dan objek kode di luar
Database Migration Service menggunakan alat migrasi Ora2Pg.
Anda dapat menerapkan sumber yang dikonversi ke database tujuan secara langsung
di Database Migration Service.
Anda bertanggung jawab untuk menerapkan skema yang dikonversi ke database tujuan di cluster tujuan AlloyDB for PostgreSQL.
Anda dapat menguji draf skema dan kode secara langsung di Database Migration Service
untuk memastikan keduanya dapat berhasil diterapkan ke cluster tujuan Anda.
Anda tidak dapat menguji skema dan kode draf tanpa memengaruhi
cluster tujuan.
Menambahkan kolom rowid yang tidak ada secara otomatis untuk tabel yang
tidak memiliki kunci utama dan batasan unik.
Anda harus menambahkan kunci utama yang tidak ada ke tabel tujuan setelah Anda
menerapkan skema.
Tabel 1: Perbandingan fitur ruang kerja konversi
Menggunakan ruang kerja konversi lama
Jika skenario Anda memerlukan penggunaan ruang kerja konversi lama,
ubah proses migrasi dengan tindakan berikut:
Tulis file konfigurasi Ora2Pg.
Baca
dokumentasi Ora2Pg untuk mendapatkan panduan tentang cara menggunakan
alat konversi Ora2Pg. Luaskan bagian berikut untuk melihat daftar lengkap
direktif yang didukung di Database Migration Service.
Konfigurasi Ora2Pg yang didukung di Database Migration Service
Database Migration Service menggunakan konfigurasi berikut yang didukung untuk file Ora2Pg:
BOOLEAN_VALUES
DATA_TYPE
DEFAULT_NUMERIC
ENABLE_MICROSECOND
EXPORT_SCHEMA
MODIFY_STRUCT
MODIFY_TYPE
PG_INTEGER_TYPE
PG_NUMERIC_TYPE
PG_SCHEMA
PRESERVE_CASE
REPLACE_AS_BOOLEAN
REPLACE_COLS
REPLACE_TABLES
REPLACE_ZERO_DATE
SCHEMA
Database Migration Service menggunakan profil koneksi untuk menentukan detail konektivitas, sehingga Anda tidak perlu menentukan informasi berikut dalam file konfigurasi Or2Pg:
ORACLE_DSN
ORACLE_HOME
ORACLE_PWD
ORACLE_USER
PG_DSN
PG_PWD
PG_USER
Selain itu, Database Migration Service tidak menggunakan direktif konfigurasi WHERE
untuk membatasi data yang akan dimigrasikan.
Menerapkan skema yang dikonversi ke database tujuan secara manual.
Setelah membuat konfigurasi Ora2Pg dan membuat ruang kerja,
Anda harus menerapkan kode yang dihasilkan sendiri secara langsung di database
tujuan.
Migrasikan tabel tanpa kunci utama.
Database Migration Service hanya memigrasikan tabel yang memiliki kunci utama.
Jika database sumber Anda menyertakan tabel yang tidak memiliki kunci utama,
Anda harus membuat kunci utama atau batasan unik secara manual di
tabel yang dikonversi dalam database tujuan setelah Anda
menerapkan skema yang dikonversi. Luaskan bagian berikut untuk mengetahui detail selengkapnya.
Menambahkan kunci utama atau batasan unik di database tujuan
Untuk memigrasikan tabel Oracle tanpa kunci utama, lakukan langkah-langkah berikut:
Buat batasan kunci utama yang tidak ada untuk tabel Anda. Untuk mengetahui informasi selengkapnya tentang kunci primer, lihat
Kunci Primer dalam dokumentasi PostgreSQL.
Anda juga dapat meluaskan bagian berikut untuk melihat contoh perintah SQL:
Membuat kunci utama menggunakan kolom yang ada
Tabel Anda mungkin sudah memiliki kunci utama logis berdasarkan
kolom atau kombinasi kolom. Misalnya, mungkin ada
kolom dengan batasan atau indeks unik yang dikonfigurasi. Gunakan kolom ini untuk membuat kunci utama baru bagi tabel di database sumber. Contoh:
ALTERTABLETABLE_NAMEADDPRIMARYKEY(COLUMN_NAME);
Membuat kunci utama menggunakan semua kolom
Jika Anda tidak memiliki batasan yang sudah ada yang dapat berfungsi sebagai
kunci utama, buat kunci utama menggunakan semua kolom tabel. Pastikan
Anda tidak melebihi panjang maksimum kunci utama yang
diizinkan oleh cluster PostgreSQL Anda. Contoh:
Saat membuat kunci primer komposit seperti ini, Anda harus
mencantumkan semua nama kolom yang ingin digunakan secara eksplisit. Pernyataan tidak dapat digunakan untuk mengambil semua nama kolom untuk tujuan ini.
Membuat batasan unik dengan pseudokolom ROWID
Database Oracle menggunakan
ROWID pseudocolumn untuk menyimpan
lokasi setiap baris dalam tabel. Untuk memigrasikan tabel Oracle
yang tidak memiliki kunci utama, Anda dapat menambahkan kolom ROWID
di database PostgreSQL tujuan. Database Migration Service
mengisi kolom dengan nilai numerik yang sesuai dari
kolom semu ROWID Oracle sumber.
Untuk menambahkan kolom dan menetapkannya sebagai kunci utama, jalankan perintah berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-05 UTC."],[],[],null,["# About legacy conversion workspaces\n\nLegacy conversion workspaces are an older, more limited type of conversion\nworkspaces. Legacy conversion workspaces don't support Gemini-enhanced\nconversion features or the interactive SQL editor. You can only use them to convert your\nsource schema with the Ora2Pg migration tool.\n| **Important:** Database Migration Service supports Ora2Pg versions `21.1` - `23.2`.\n\nWe don't recommend using the legacy type of conversion workspaces for your\nmigrations as they present multiple other limitations to the conversion\nworkflow:\n\nUse legacy conversion workspaces\n--------------------------------\n\nIf your scenario requires the use of legacy conversion workspaces,\nmodify the migration process with the following actions:\n\n1. Write an Ora2Pg configuration file.\n\n Refer to the\n [Ora2Pg documentation](https://ora2pg.darold.net/documentation.html#CONFIGURATION) for guidance on how to use\n the Ora2Pg conversion tool. Expand the following sections for the full\n list of directives supported in Database Migration Service. \n\n #### Ora2Pg configuration supported in Database Migration Service\n\n Database Migration Service uses supported the following configuration for Ora2Pg files:\n - `BOOLEAN_VALUES`\n - `DATA_TYPE`\n - `DEFAULT_NUMERIC`\n - `ENABLE_MICROSECOND`\n - `EXPORT_SCHEMA`\n - `MODIFY_STRUCT`\n - `MODIFY_TYPE`\n - `PG_INTEGER_TYPE`\n - `PG_NUMERIC_TYPE`\n - `PG_SCHEMA`\n - `PRESERVE_CASE`\n - `REPLACE_AS_BOOLEAN`\n - `REPLACE_COLS`\n - `REPLACE_TABLES`\n - `REPLACE_ZERO_DATE`\n - `SCHEMA`\n\n Database Migration Service uses connection profiles to define\n connectivity details, so you don't need to define the following information\n in your Or2Pg configuration file:\n - `ORACLE_DSN`\n - `ORACLE_HOME`\n - `ORACLE_PWD`\n - `ORACLE_USER`\n - `PG_DSN`\n - `PG_PWD`\n - `PG_USER`\n\n Additionally, Database Migration Service doesn't use the `WHERE`\n configuration directive to limit the records to migrate.\n2. [Create a legacy conversion workspace and convert schema](/database-migration/docs/oracle-to-alloydb/create-conversion-workspace#legacy-ws).\n3. Manually apply converted schema to the destination database.\n\n\n After you create the Ora2Pg configuration and create the workspace,\n you must apply the generated code by yourself directly on the destination\n database.\n | **Important:** With legacy conversion workspaces, you can't test the schema before you migrate. If you encounter any issues when you apply the converted schema, you need to clear the faulty schema from the destination database, adjust your Ora2Pg file, and re-create the legacy conversion workspace with the Ora2Pg file.\n4. Migrate tables without primary keys.\n\n\n Database Migration Service migrates only tables that have primary keys.\n If your source database includes tables that don't have primary keys,\n you need to manually create primary keys or unique constraints in the\n converted tables in the destination database after you\n apply the converted schema. Expand the following section for more details. \n\n #### Add primary keys or unique\n constraints in the destination database\n\n To migrate Oracle tables without primary keys, do the following:\n 1. [Connect to your AlloyDB for PostgreSQL cluster with the `psql` client](/alloydb/docs/connect-psql).\n 2. Create the missing primary key constraints for your tables. For more information about primary keys, see [Primary Keys](https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-PRIMARY-KEYS) in the PostgreSQL documentation.\n\n You can also expand the following sections to see sample SQL commands: \n\n #### Create primary keys using existing columns\n\n Your table might already have a logical primary key based on a\n column or a combination of columns. For example, there might be\n columns with a unique constraint or index configured. Use these\n columns to generate a new primary key for tables in your source\n database. For example: \n\n ```sql\n ALTER TABLE TABLE_NAME\n ADD PRIMARY KEY (COLUMN_NAME);\n ```\n\n \u003cbr /\u003e\n\n #### Create a primary key using all columns\n\n If you don't have a pre-existing constraint that could serve as a\n primary key, create primary keys using all columns of the table. Make\n sure that you don't exceed the maximum length of the primary key\n allowed by your PostgreSQL cluster. For example: \n\n ```sql\n ALTER TABLE TABLE_NAME\n ADD PRIMARY KEY (COLUMN_NAME_1, COLUMN_NAME_2, COLUMN_NAME_3, ...);\n ```\n\n When creating a composite primary key like this, you need to explicitly\n list all column names you want to use. It's not possible to use a statement\n to retrieve all column names for this purpose.\n\n \u003cbr /\u003e\n\n #### Create a unique constraint with the `ROWID` pseudocolumn\n\n Oracle databases use the\n [`ROWID` pseudocolumn](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ROWID-Pseudocolumn.html) to store\n the location of each row in a table. To migrate Oracle tables\n that don't have primary keys, you can add a `ROWID`\n column in the destination PostgreSQL database. Database Migration Service\n populates the column with the corresponding numeric values from\n the source Oracle `ROWID` pseudocolumn.\n\n To add the column and to set it as the primary key, run the following: \n\n ```sql\n ALTER TABLE TABLE_NAME ADD COLUMN rowid numeric(33,0) NOT NULL;\n CREATE SEQUENCE TABLE_NAME_rowid_seq INCREMENT BY -1 START WITH -1 OWNED BY TABLE_NAME.rowid;\n ALTER TABLE TABLE_NAME ALTER COLUMN rowid SET DEFAULT nextval('\u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e_rowid_seq');\n ALTER TABLE TABLE_NAME ADD CONSTRAINT CONSTRAINT_DISPLAY_NAME PRIMARY KEY (rowid);\n ```\n\nWhat's next\n-----------\n\nAfter you perform the conversion workflow with the legacy workspace,\nyou can proceed with the standard migration procedures. See\n[Create a migration job](/database-migration/docs/oracle-to-alloydb/create-migration-job)."]]