Tutorial: Convert Oracle schemas to Azure PostgreSQL

This tutorial guides you through converting Oracle database schemas to Azure Database for PostgreSQL flexible server or Azure HorizonDB by using the Visual Studio Code PostgreSQL extension with Microsoft Foundry to generate and review PostgreSQL definitions.

It covers connecting to your Oracle source and a schema validation database on the selected Azure PostgreSQL service, configuring Microsoft Foundry, running the schema conversion workflow, and reviewing generated PostgreSQL artifacts. Both Azure services support schema validation and deployment. Before you begin, ensure that you have network access and credentials for the Oracle source and schema validation database, and a Microsoft Foundry deployment.

Here's what you can expect during the conversion:

  • Schema discovery: The tool analyzes your Oracle schema objects.
  • AI processing: Microsoft Foundry processes and converts compatible objects.
  • Schema validation: The tool attempts compilation and available static checks. Functional, data, and application validation remain separate.
  • Object review: Use Conversion Object Explorer to inspect results and refine generated PostgreSQL definitions.
  • Output generation: Converted PostgreSQL object files are saved in postgres_ddl for review and deployment with the Setup Experience.

Prerequisites

Use these prerequisites for the schema-conversion workflow. Install an extension version that meets the following requirements before starting a project.

System requirements

Category Details
Visual Studio Code version 1.95.2 or later
PostgreSQL extension version Latest stable release
GitHub Copilot subscription Pro+, Business, or Enterprise. Sign in before using Ask and Fix.

Operating system support

The following requirements apply to Schema Conversion. For general extension support, see the PostgreSQL extension's supported operating systems.

Operating system Schema conversion requirements
Windows x64 or Arm64 architecture. Arm64 requires Windows 11.
Linux x64 or Arm64 architecture, with glibc 2.35 or later.
macOS macOS 13 or later.

Schema validation database requirements

Choose one of the following Azure services to host the schema validation database:

Azure service Service-specific requirements
Azure Database for PostgreSQL flexible server PostgreSQL version 15 or later.
Azure HorizonDB A supported PostgreSQL version and access to the cluster's read-write endpoint.

Use an empty or dedicated, unused database on the service you choose.

Use the same PostgreSQL major version for the schema validation database and the deployment destination. Verify extension availability for the selected service before starting conversion.

AI model requirements

Configure the following model for automated schema conversion. GitHub Copilot sign-in for assisted review is separate from the Foundry model connection.

AI component Model
Microsoft Foundry GPT-5.2 deployment

Microsoft Foundry deployment configuration

Have an administrator with model-deployment permissions create a Microsoft Foundry deployment that uses the gpt-5.2 model and arrange your resource access. Foundry User provides usage access, not permission to manage model deployments or assign roles. See Role-based access control for Microsoft Foundry.

Use the deployment name assigned during creation; it doesn't have to match the model name.

Copy the resource endpoint for your model deployment from Microsoft Foundry, for example, https://<resource>.openai.azure.com/. Use the endpoint supplied for that resource rather than constructing an alternative hostname. Don't enter a project URL or append an inference route or API-version query to the resource endpoint.

For more information about endpoint formats and inference routes, see Endpoints for Microsoft Foundry Models.

For capacity planning, follow the Foundry capacity recommendations. The TPM recommendation is sizing guidance, not a model-version requirement.

If you route Foundry traffic through Azure API Management, use the configured gateway endpoint and test it from the wizard. See Configure AI Gateway in your Foundry resources.

Required database privileges

Before you run schema conversion, verify source metadata access and schema validation database permissions with your database administrators. The Oracle account needs access to schema metadata and dictionary views, not application row data. The PostgreSQL account must be able to drop and recreate matching schemas and create objects for validation. Use a dedicated account where possible, and follow the principle of least privilege.

Source Oracle privileges

Use a supported Oracle version. The following privileges are required on the source Oracle database:

Privilege Purpose
CONNECT Basic database connection
SELECT_CATALOG_ROLE Access to data dictionary views
SELECT ANY DICTIONARY Read system metadata and dictionary objects
SELECT SYS.ARGUMENT$ Access to procedure and function argument information
SELECT SYS.V_$RESOURCE_LIMIT Access to session and process utilization and limits through V$RESOURCE_LIMIT

Schema validation database privileges

Arrange the following access on the selected schema validation database. Database-level CREATE doesn't grant permission to drop a schema owned by another role.

Access Purpose
CONNECT on the database Connect for conversion and validation.
CREATE on the database Create validation schemas.
Ownership of matching schemas, or an appropriately authorized role Drop the matching schemas before recreating them.
Permission to create objects in the validation schemas Create and compile converted definitions.
Extension-installation permissions, or administrator assistance Install the extensions required for conversion and validation.

Network requirements

  • Outbound connectivity: Microsoft Foundry endpoints.
  • Database connectivity: Source Oracle and the selected Azure Database for PostgreSQL flexible server or Azure HorizonDB cluster.
  • HTTPS access: Visual Studio Code Extensions Marketplace and GitHub Copilot services.
  • GitHub repository access: https://github.com/microsoft/pgsql-tools/.

Oracle Instant Client (for thick client mode)

The extension uses thick mode when it detects Oracle Client libraries that it can load, and thin mode when no client is detected. A detected client that can't load is a configuration error, not a successful fallback. Restart Visual Studio Code if a mode change requires a new process. See the PostgreSQL extension release notes.

Thin mode doesn't require Oracle Client libraries. Connections that require Oracle native network encryption or checksumming need thick mode. Review the source server's policy with your Oracle database administrator and configure the client on the machine that runs Visual Studio Code.

Policy Source server setting Client setting
Native network encryption SQLNET.ENCRYPTION_SERVER SQLNET.ENCRYPTION_CLIENT
Data integrity checksumming SQLNET.CRYPTO_CHECKSUM_SERVER SQLNET.CRYPTO_CHECKSUM_CLIENT

In sqlnet.ora, REQUIRED rejects a connection that can't meet the policy; REQUESTED negotiates the service with the other endpoint. The settings aren't interchangeable. Don't weaken a server policy to work around a client configuration error. See Oracle network encryption and data integrity.

To prepare thick mode:

  1. Install the Oracle Instant Client Basic or Basic Light package for the conversion machine's operating system and architecture from Oracle Instant Client downloads.
  2. Follow Oracle's platform-specific installation instructions for dependencies, library search paths, and network configuration files.
  3. Restart Visual Studio Code and test the Oracle connection before proceeding.

Microsoft Foundry authentication

Configure one of the following authentication methods for Microsoft Foundry:

Authentication method Requirements
API key Resource endpoint and an API key from the same Foundry resource, with key-based authentication allowed by your organization. The key isn't specific to one deployment.
Microsoft Entra ID An identity with the Foundry User role (formerly Azure AI User) on the resource that hosts the deployment. Select the account and tenant in the wizard and complete sign-in when prompted.

For role and authentication details, see Authentication and authorization in Microsoft Foundry. Keep resource keys out of source files and shared reports.

Schema conversion process

This section walks through the conversion workflow. You install the extension, initialize a project, connect to Oracle, review Discovery, and configure the schema validation database and Microsoft Foundry. Conversion attempts compilation and available static checks in the schema validation database. You then review and refine the output, deploy it to the database you choose, and independently validate its behavior.

The extension's UI uses labels such as Migrations, Create Migration Project, and Migrate for this workflow. These labels don't mean that Schema Conversion moves row data.

The following screenshots show examples from different migration runs. Project names and object counts can differ between images.

Step 1: Install the PostgreSQL Visual Studio Code extension

  1. Open Visual Studio Code.

  2. Go to the Extensions view (Ctrl+Shift+X).

  3. Search for PostgreSQL and open the details for the PostgreSQL extension published by Microsoft.

  4. Install or update the extension to the latest stable release.

    Screenshot of installing the PostgreSQL extension in Visual Studio Code.

  5. Sign in to GitHub Copilot with the account associated with your subscription. Open Copilot Chat and confirm that your organization's policies allow the assisted review features. See Set up GitHub Copilot in Visual Studio Code.

Copilot sign-in doesn't configure the Foundry resource, and a Foundry API key doesn't sign you in to Copilot. Review the cost and data-handling FAQ before sending schema definitions to either service.

Step 2: Create a schema validation database connection

Use this connection for schema validation. Use an empty or dedicated, unused database that contains nothing you need to preserve. You choose the deployment destination when you run setup.

  1. In the PostgreSQL extension panel, create a connection to the Azure Database for PostgreSQL flexible server or Azure HorizonDB cluster that hosts the schema validation database. For Azure HorizonDB, use the cluster's read-write endpoint.

  2. Enter the connection details (host, database, username, password).

  3. Test and save the connection. For connection options, including Browse Azure, see Connections and identity.

    Screenshot of adding new Azure Database for PostgreSQL connection.

Step 3: Open a new workspace

  1. Create a new folder on your local machine for the schema conversion project.

  2. Open the folder as a new workspace in Visual Studio Code.

    Screenshot of adding a new workspace in Visual Studio Code.

Step 4: Create a schema conversion project

  1. Open the PostgreSQL extension.

  2. Go to the Migrations panel.

  3. Select Create Migration Project.

    Screenshot of creating a new migration project.

Step 5: Configure project settings

  1. In the Migration Wizard, enter your project name.

  2. Select Next to continue.

    Screenshot of project name.

    The prerequisite list in this screenshot applies to API-key authentication. You can also use Microsoft Entra ID authentication.

Step 6: Configure the Oracle connection

  1. Enter your Oracle connection details:

    Field Description
    Oracle Hostname Hostname or IP address of the source server.
    Oracle Port Listener port, normally 1521.
    Oracle SID or Service Name SID or service name for the source database.
    Oracle Username User with the required metadata privileges.
    Oracle Password Password for the source user.

    Prepare Oracle client configuration on the machine running Visual Studio Code before connecting. Client detection selects the mode; this page doesn't provide a manual thin/thick selector.

  2. Select Load Schemas. The tool tests the Oracle connection, reads schema names from Oracle's ALL_USERS view, and excludes system schemas from the selection list.

  3. Select one or more application schemas to convert to Azure PostgreSQL.

  4. Select Next: Discovery.

    Screenshot of the Oracle connection with selected schemas and the Next: Discovery button. Connection values are redacted.

Step 7: Review Discovery results

Discovery shows the source inventory and planned extraction scope. No DDL is extracted at this stage. For an explanation of the summary counts and scope, see Discovery in the schema conversion overview.

  1. Wait for Discovery to finish.

  2. Under Source permissions, review each check, its purpose, and its result. Review unsuccessful checks with your Oracle database administrator. After resolving permission issues, select Refresh Discovery and review the updated results. For the required permissions, see Source Oracle privileges.

  3. Review the Discovered, To be extracted, Excluded, and Invalid objects summary counts.

  4. Expand Supported object types to review the To be extracted, Excluded, and Invalid objects counts by type. A supported type can still have excluded objects; these counts aren't conversion results.

  5. Expand Not supported object types to review unsupported categories found on the source. For support details and PostgreSQL alternatives, see Schema conversion limitations.

  6. Under Dependent schemas, review referenced schemas that you didn't select. Select Show diagram to view the references. The numbers on the connections represent dependency references, not counts of objects to extract or convert. Include a referenced application schema in your selection if you intend to convert it in this project. Otherwise, plan how to supply or replace the required definitions in Azure PostgreSQL. A dependency shown in the diagram isn't automatically a selected schema.

  7. Review the separate notice about referenced Oracle system schemas that aren't converted. Don't treat these references as additional application schemas selected for conversion.

  8. If you need to change the schema selection, select Previous to return to Connect to Oracle, update Schemas, and select Next: Discovery again. Review the updated scope before continuing.

  9. Select I have reviewed the objects, exclusions and dependent schemas.

  10. Select Next: PostgreSQL Connection.

    Screenshot of Discovery with permission checks, object counts, dependencies, scope acknowledgement, and Next: PostgreSQL Connection. Connection details are redacted.

Step 8: Configure a schema validation database

Use an empty or dedicated, unused schema validation database on Azure Database for PostgreSQL flexible server or Azure HorizonDB, with no objects or data you need to preserve. For preparation guidance, see Prepare the schema validation database.

Warning

Conversion drops matching schemas with DROP SCHEMA ... CASCADE and recreates them. This action deletes their existing objects and data and can remove dependent objects in other schemas. Verify the selected connection and database before acknowledging this operation.

  1. Select the destination platform, Azure HorizonDB or Azure Database for PostgreSQL flexible server.

  2. In PostgreSQL Connection, select the connection that you defined for that service.

  3. In PostgreSQL Database, select the schema validation database.

  4. Review the automatic results in Database checks, including server compatibility and extensions. Resolve blocking errors before continuing. For missing extensions, use the service-specific preparation guidance to allow and install those your converted schema needs, then select Check again. Missing dependencies can prevent individual objects from compiling even when a warning doesn't block continuation.

    Screenshot of the schema validation database page in dark mode, with Azure HorizonDB selected, database checks passed, and schema recreation acknowledged.

  5. Select the checkbox acknowledging that schemas in the schema validation database that match the selected Oracle schemas are dropped and recreated during conversion, deleting their existing objects and data.

  6. Select Next: Microsoft Foundry Model Configuration.

Step 9: Configure the Microsoft Foundry language model

For conversion throughput, the recommended deployment capacity is greater than 1,000,000 tokens per minute (TPM). Size capacity for your schema and other workloads sharing the deployment, and monitor throttling. See Configure Microsoft Foundry capacity. The example shows 2.3 million TPM; its available quota is specific to that environment.

Screenshot of Microsoft Foundry deployment details with the Tokens per Minute Rate Limit set to 2.3 million.

Return to the wizard in Visual Studio Code to configure the model connection:

  1. Enter the model connection details:

    Field Value
    Model Name gpt-5.2.
    Microsoft Foundry Endpoint The resource endpoint for your deployment.
    Deployment Name The name you assigned to the deployment; it can differ from the model name.
  2. Select the authentication method:

    • API key: Enter an API key from the Foundry resource that hosts the deployment.
    • Microsoft Entra ID: Select your Azure Account and Tenant, and complete sign-in when prompted. Use the identity with the resource access described in Microsoft Foundry authentication.
  3. Select Test Microsoft Foundry Connection to verify the configuration.

  4. After the connection succeeds, select Create Migration Project.

A successful connection test doesn't establish that enough capacity is available for a sustained conversion workload.

Step 10: Run the schema conversion

  1. The system navigates to the main Migration Wizard.

  2. Select Migrate to start the schema conversion process.

  3. Monitor the conversion progress in the Visual Studio Code interface.

  4. When conversion finishes, the project shows Schema conversion is complete and the Review conversion summary action.

    Screenshot of completed schema conversion with extraction and conversion progress and Review conversion summary.

If the run fails or is interrupted, preserve the project and follow conversion failure guidance. Don't treat an incomplete run as a completed conversion.

Step 11: Review the schema conversion report

  1. After schema conversion finishes, the HTML conversion report opens automatically.
  2. Review the discovery, extraction, and conversion results and object-level notes.
  3. For guidance on interpreting the report, see View the HTML report for Oracle schema conversion.

Step 12: Review and refine converted objects

  1. From the completed schema conversion project, select Review conversion summary.

  2. On the Conversion summary page, select Conversion object explorer.

    Screenshot of Conversion Object Explorer with filters, statuses, Ask, Fix, Resolve, and the Refresh icon.

  3. Select an object to open its diff view, compare its Oracle and PostgreSQL definitions, and read its conversion notes.

    Screenshot of Oracle and PostgreSQL definitions side by side with conversion notes.

  4. Use Ask to explain the conversion and its dependencies, or Fix for Copilot-assisted corrections to the object and its dependent objects. Corrected dependent objects are resolved automatically after successful compilation.

    When multiple connections are configured in the PostgreSQL extension, executing SQL through Fix opens a connection-selection prompt. Select the schema validation connection, then select the database containing the converted schema in the database-selection popup.

  5. For manual corrections, edit and save the matching tool-generated PostgreSQL file in postgres_ddl. Review every statement on the PostgreSQL side of the object's diff view.

    Before selecting play, verify the active connection and database. Switch to the schema validation destination if needed. The diff view can reuse a previous connection and database without prompting.

    For an existing table, CREATE TABLE IF NOT EXISTS doesn't update its definition. Apply reviewed ALTER TABLE statements separately in the query editor against the same schema validation database. Keep the corrected creation definition in the matching tool-generated file in postgres_ddl.

    Select the play button in the object's diff view to execute all SQL on the PostgreSQL side. Selecting text doesn't limit execution. If prompted, select the schema validation connection, then the database containing the converted schema.

  6. Review the edits and compilation results, including changes to dependent objects. Verify that the correction was applied in the selected database. Save any manual edits or Fix corrections in the corresponding tool-generated files in postgres_ddl, and review Setup inputs and deployment scope.

  7. If an object needs a manual status update after correction, select Resolve to mark it as Converted.

  8. Select Refresh in Conversion Object Explorer to update the conversion reports with the revised statuses.

The following Conversion summary example shows the updated counts after object corrections. The Conversion Object Explorer screenshot above shows the state before those corrections.

Screenshot of Conversion summary after corrections, with updated conversion counts and some objects still not converted.

For filtering, dependency correction, status updates, and manual compilation steps, see Review converted objects in Conversion Object Explorer. A Converted status doesn't replace independent validation.

Step 13: Prepare deployment with the Setup Experience

The conversion workflow automatically generates setup files when it finishes. When deployment runs, Setup reads the latest saved contents of the tool-generated object files in postgres_ddl, including corrections made after setup files were generated. Files added manually to postgres_ddl are ignored by Setup. Opening the setup instructions doesn't start a deployment.

  1. From the completed schema conversion project, select Review conversion summary.
  2. On the Conversion summary page, select Setup instruction. This action becomes available when the setup files are ready.
  3. Review the generated setup_instructions.md file, which opens in the editor. Visual Studio Code also reveals the setup folder in Explorer.
  4. Follow Deploy converted schemas with the Setup Experience to prepare your chosen destination database on Azure Database for PostgreSQL flexible server or Azure HorizonDB, run readiness checks, deploy the converted schemas, and review deployment results.

Step 14: Validate the deployed schema before production use

Choose the database for functional, data, and application testing. Confirm that it contains the converted schema you intend to validate.

For manual edits to an existing table, CREATE TABLE IF NOT EXISTS doesn't update the table. Apply reviewed ALTER TABLE statements separately in the query editor, and save the corrected creation definition in the matching tool-generated file in postgres_ddl.

The play button in the diff view executes all SQL on the PostgreSQL side. Selecting text doesn't limit execution. The diff view can reuse a previous connection and database without prompting.

For manual corrections to an object after deployment:

  1. In Conversion Object Explorer, select the object to open its diff view.
  2. Make the correction and save the matching tool-generated file in postgres_ddl. Review the updated PostgreSQL definition on the right side of the diff view.
  3. Review the schema references and every statement on the PostgreSQL side of the diff view.
  4. Before selecting play, verify the active connection and database, and change them if needed. For corrections in the schema validation database, use the connection and database selected earlier for schema validation. For a schema deployed elsewhere, use its connection and database.
  5. Select the play button in the diff view. If prompted, select the intended connection, then the database containing the deployed schema.
  6. Review the execution output and resolve errors before continuing. Verify the updated object definition in the selected database.
  7. Save the corrected object definition in its tool-generated file under postgres_ddl so future deployments use the tested correction. Editing a file doesn't by itself apply the change to a deployed database.
  8. If needed, use Resolve in Conversion Object Explorer to update the corrected object's status, and then select Refresh to update the conversion reports.

Independently validate the deployed schema with representative test data and application workloads. Verify dependencies, constraints, business logic, and result sets against the Oracle source, and retest after corrections. Review any objects that weren't converted or deployed, rather than testing only successful conversions.

Important

Foundry generates the initial conversion, and Copilot assists with review and corrections. Neither AI output nor successful compilation establishes equivalent application behavior. Independently validate converted objects, manual corrections, and security controls before production deployment.

For more information about the Visual Studio Code extension, visit PostgreSQL extension for Visual Studio Code and Cursor.