Best practices for Oracle to Azure PostgreSQL schema conversion

This article provides best practices for Oracle to Azure PostgreSQL schema conversion in Visual Studio Code with Microsoft Foundry. You can use Azure Database for PostgreSQL flexible server or Azure HorizonDB for schema validation and deployment. Use the tutorial prerequisites as the requirements checklist; this article adds planning, capacity, and validation guidance.

Plan the schema conversion

A successful conversion starts with planning. Decide what to convert and whether to use Azure Database for PostgreSQL flexible server or Azure HorizonDB before running the tool.

Scope the source schemas

Specify which Oracle application schemas you want to convert. The extraction workflow automatically excludes Oracle system and built-in schemas, such as SYS, SYSTEM, XDB, MDSYS, CTXSYS, and WMSYS.

Align the target PostgreSQL major version

Use the same Azure PostgreSQL major version on the schema validation database as on your deployment destination. The conversion tool emits DDL that targets a specific Azure PostgreSQL major version. Converting against one major version and deploying to another can surface syntax or feature differences during deployment. Verify extension and feature availability for the selected Azure service as well.

Scan for unsupported objects in advance

Review the Oracle to Azure PostgreSQL schema conversion limitations before you start. For each unsupported object, decide in advance whether to recreate the functionality on your Azure PostgreSQL destination, replatform it to an appropriate Azure service, or exclude it from the conversion scope.

Plan remediation for unsupported objects

For each unsupported object identified in the previous step, record the chosen remediation path before you run the conversion. Track:

  • The Oracle object name and type.
  • The chosen path: recreate, replatform, or drop.
  • The target Azure service or PostgreSQL pattern, if you're replatforming.

For objects available in Conversion Object Explorer, use Ask to understand the recorded limitation and Fix for assisted corrections. Review and compile changes before using Resolve, when needed, and Refresh. Objects excluded from extraction can require separate source review and manual implementation. See Address conversion issues with GitHub Copilot.

Choose where to run the conversion

Choose a workstation or an Azure virtual machine with suitable connectivity and resources. For a long conversion, an Azure virtual machine can reduce dependence on a laptop's power and network connection.

A large conversion runs for a long time and makes sustained calls to your Oracle source, the schema validation database, and Microsoft Foundry. Running from an Azure virtual machine gives you:

  • Network proximity: A location near your schema validation database can reduce database round-trip latency. Foundry processing location also depends on the model deployment type, not just the resource's region.
  • Long-running sessions: You can manage power, maintenance, and network settings for the conversion rather than relying on a laptop session.
  • Private connectivity: You can place the virtual machine in the same virtual network as your target server and Microsoft Foundry private endpoint, so traffic doesn't traverse the public internet.
  • Predictable resources: You can size CPU, memory, and disk for the conversion workload, and keep artifacts on a managed disk that you back up.

Give the selected machine network access to the Oracle source, schema validation database, and model endpoint. Keep the session running and retain the project after an interruption. If you use thick client mode, install Oracle Instant Client on that machine. See Oracle client configuration and conversion failure guidance.

Prepare the source Oracle environment

Before you run a conversion, prepare the source Oracle environment. Grant the conversion tool the privileges it needs to read schema metadata, and verify that concurrent session capacity is sufficient so the tool can extract a complete and accurate schema.

Required Oracle privileges

Prepare the privileges listed in Source Oracle privileges in the tutorial. Review the Discovery permission results before extracting definitions.

Use least-privilege access according to organizational policy. The tool reads schema metadata from DBA_* catalog views. The user doesn't need privileges on any application table or to read row-level data.

Set the Oracle sessions parameter

Make sure the Oracle sessions parameter is greater than 10 so the tool can open enough concurrent metadata reads. Check the current value with:

SELECT name, value
FROM v$parameter
WHERE name = 'sessions';

This configured limit doesn't show how many sessions are currently available. Review current utilization as well:

SELECT resource_name, current_utilization, limit_value
FROM v$resource_limit
WHERE resource_name IN ('sessions', 'processes');

Work with your Oracle database administrator to allow for existing workloads and account-level session limits. A server limit greater than 10 alone doesn't guarantee connection capacity for extraction.

Prepare the schema validation database

The schema conversion tool uses a schema validation database on Azure Database for PostgreSQL flexible server or Azure HorizonDB to validate converted objects. Provision and configure the server or cluster before you start a conversion so validation behavior matches the deployment destination. For Azure HorizonDB, use the cluster's read-write endpoint.

Warning

If schemas corresponding to the Oracle schemas you select already exist in the selected schema validation database, the tool drops them with DROP SCHEMA ... CASCADE and then recreates them. This action deletes their existing objects and data and can remove dependent objects in other schemas. Use an empty schema validation database or a dedicated, unused schema validation database that contains no objects or data you need to preserve.

Required PostgreSQL privileges

The PostgreSQL connection user needs permission to recreate the matching schemas and validate objects in the schema validation database:

  • CONNECT privilege on the schema validation database.
  • CREATE privilege on the schema validation database to create validation schemas.
  • Permission to drop existing matching schemas. Coordinate schema ownership with your database administrator; CREATE and USAGE privileges alone don't permit dropping another role's schema.
  • Permission to create objects in the validation schemas.

Have an administrator with the appropriate extension-installation permissions prepare the required extensions. The conversion account doesn't need to install extensions that an administrator already installed in the selected database.

Choose an appropriate schema validation database size

The conversion tool uses the schema validation database to validate DDL; it doesn't test application behavior. Use a compute tier that provides stable connection capacity for conversion and validation activity. Size the selected server or cluster for the workloads you intend to run.

Allow and install required extensions

The schema conversion tool uses PostgreSQL extensions for Oracle built-in packages, spatial types, partitioning, full-text search, and schema validation. Before your first conversion run, verify that your selected service supports the extensions your converted schema needs, allow them, and install them in the schema validation database.

The following table lists commonly used extensions for Oracle to Azure PostgreSQL schema conversion, not a guarantee of availability on every target. Include the ones that apply to the source schema and are supported by your destination, and add any others the workload requires.

Treat extensions according to their purpose:

  • Dependencies of generated SQL must be available wherever you compile or run that SQL, or you must change the implementation.
  • Additional validation tools, such as plpgsql_check, provide checks beyond routine creation.
  • Workload and operational extensions apply only when your converted schema or operating practices use them.

A missing-recommended-extensions warning isn't a requirement to install every extension in the following table. Review the affected objects and their notes. Missing dependencies can prevent individual objects from compiling or running even when the wizard allows you to continue.

Extension Purpose
orafce Oracle built-in package compatibility (DBMS_*, PLV*, UTL_FILE, and common functions)
uuid-ossp UUID generation, equivalent to Oracle SYS_GUID
pgcrypto Cryptographic and hashing functions, equivalent to Oracle DBMS_CRYPTO
pg_trgm Trigram indexes for LIKE/ILIKE and fuzzy text search
tablefunc Table-returning functions, including crosstab for pivot tables
fuzzystrmatch String similarity and edit-distance functions
postgis Spatial types and operators (replaces Oracle Spatial)
postgis_topology Topology model for PostGIS
postgis_tiger_geocoder Geocoder bundled with PostGIS
pg_partman Time- and range-based partition management
pg_stat_statements Per-query performance telemetry
plpgsql_check Additional static checks of converted PL/pgSQL routine bodies on the schema validation database
dblink Separate connections used by converted autonomous-transaction logic

Where supported, allow plpgsql_check, configure its required preload library, and install it in the selected schema validation database to make its additional static checks available. These checks supplement compilation; they don't prove equivalent business logic or production readiness. A Converted status doesn't establish that every routine passed these checks.

If the generated code uses dblink, install it in the destination database as well as the schema validation database.

Check extension availability for the PostgreSQL version and service you use: Azure Database for PostgreSQL or Azure HorizonDB.

Step 1: Add extensions to the allow list

For Azure Database for PostgreSQL flexible server, open the server in the Azure portal. Select Server parameters, search for azure.extensions, and select each required, supported extension from the list. Save your changes.

For Azure HorizonDB, configure azure.extensions in a parameter group and assign the group to the intended compute pool. See Allow extensions in Azure HorizonDB.

Configure shared_preload_libraries only for libraries required by supported extensions and features you use. For example, pg_stat_statements and plpgsql_check require their corresponding libraries. For pg_partman background maintenance, the library is pg_partman_bgw, not pg_partman. Preserve existing entries and follow the selected service's restart procedure: Load libraries in Azure Database for PostgreSQL or Load libraries in Azure HorizonDB. For flexible server partition maintenance, see Configure pg_partman.

For Azure HorizonDB, saving a changed shared_preload_libraries value in an assigned parameter group immediately restarts each assigned compute pool that requires it. Creating or assigning a group doesn't trigger this automatic restart. The user verifies the effective setting and uses the compute pool's Restart operation when required to apply pending assignment changes.

Step 2: Install the extensions in the schema validation database

Connect to the selected schema validation database as a member of the azure_pg_admin role. The following example includes commonly used extensions; run only the statements for extensions that apply to your conversion and are supported by your selected service. For Azure HorizonDB installation requirements, see Create extensions.

CREATE EXTENSION IF NOT EXISTS orafce;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS tablefunc;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
CREATE EXTENSION IF NOT EXISTS pg_partman;
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
CREATE EXTENSION IF NOT EXISTS plpgsql_check;
CREATE EXTENSION IF NOT EXISTS dblink;

Step 3: Configure search_path for Oracle compatibility

orafce installs Oracle-compatible packages in dedicated schemas (oracle, dbms_*, plv*, utl_file). Set search_path at the database level so those schemas, along with the PostGIS (topology, tiger) schemas, are available to every connection. A database-level setting also covers objects that can't qualify a reference themselves, such as views, CHECK constraints, column defaults, and generated columns.

ALTER DATABASE <database_name> SET search_path = public, oracle, topology, tiger,
    dbms_random, dbms_alert, dbms_assert, dbms_output, dbms_pipe,
    dbms_sql, dbms_utility, plvchr, plvdate, plvlex, plvstr,
    plvsubst, plunit, utl_file;

Include only the schemas for the extensions that you installed. Reconnect after you run this statement, because the new value applies to sessions that start after the change. To scope the setting to a single role instead, use ALTER ROLE <role_name> SET search_path = ....

Important

When pg_catalog isn't explicitly listed in search_path, PostgreSQL searches it before the listed schemas. For functions that also have built-in versions, check overload resolution and qualify calls such as oracle.to_char(...) when you need the Oracle-compatible implementation.

Configure Microsoft Foundry capacity

Microsoft Foundry capacity affects conversion throughput and throttling. The guidance here is a capacity recommendation. Model and connection requirements are listed in the tutorial.

Provision sufficient tokens per minute

  • For conversion throughput, plan for a deployment quota greater than 1,000,000 tokens per minute (TPM). Large or complex definitions and other callers using the same deployment affect capacity needs.
  • Monitor token consumption, rate limits, and throttling. Increasing quota can help, but a successful connection test or a particular TPM allocation doesn't guarantee an uninterrupted conversion.

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

Run one project at a time

Run a single schema conversion project at a time. Concurrent projects compete for the same Microsoft Foundry quota and can cause throttling, partial conversions, and unexpected token costs. Process projects sequentially to keep behavior predictable and easier to debug.

Secure the conversion workflow

Automated conversion runs from the Visual Studio Code environment and connects to the Oracle source, the Foundry deployment, and the schema validation database. Ask and Fix also use GitHub Copilot. Apply your organization's access and data-handling policies to both AI workflows. See the data-handling FAQ.

Confirm network connectivity from Visual Studio Code

Verify that the machine running Visual Studio Code can reach the Foundry endpoint, Oracle source, selected PostgreSQL service, and Copilot services used for assisted review. Check corporate firewall, VPN, and network security group rules before starting.

Use private endpoints or firewall rules for the target

Restrict network access to the selected server or cluster. For Azure Database for PostgreSQL flexible server, use private endpoints for VNet-integrated workstations or configure firewall rules that allow only the IP ranges your team uses. For Azure HorizonDB, follow its networking and private endpoint guidance.

Configure database authentication

Connect to Azure Database for PostgreSQL flexible server with Microsoft Entra authentication instead of password authentication. Microsoft Entra authentication centralizes access control, supports conditional access policies, and produces auditable sign-in events.

For Azure HorizonDB, follow the service's identity and access management guidance to configure database authentication and least-privilege roles.

Manage credentials safely

Don't embed source or target database credentials in SQL files or commit them to source control. Store them in Azure Key Vault or your organization's secret manager. Retrieve them through your approved process when configuring connections; don't assume that generated files or logs are safe to share without inspection.

Validate the converted schema

Automated schema conversion reduces manual rewriting, but independent validation is essential to catch semantic differences, platform-specific behaviors, and edge cases that AI or tooling might miss. Use Conversion Object Explorer to review and verify both converted and not-converted objects. Compare the Oracle and Azure PostgreSQL definitions where available, and read the conversion notes.

For more information, see Review converted objects in Conversion Object Explorer.

Validate complex code objects

Use representative data and application calls to validate these areas. A successful compilation is only a starting point.

Area What to validate
Procedures and functions Parameter modes, return types, null handling, business rules, and caller expectations.
Package state and constants Initialization and persistence across calls, transactions, and sessions. For generated constant getters, verify values, types, and volatility.
Collections, cursors, and type methods Array or collection bounds, indexing, empty values, cursor lifetime, member implementations, and dependent callers. Inspect any mappings to arrays, domains, jsonb, or refcursor.
Exceptions Oracle error mappings, PostgreSQL SQLSTATE values, matching handlers, and error propagation.
Hierarchical queries Roots, parent-child joins, depth, paths, sibling ordering, and cycle handling in generated recursive queries.
Transaction control Commits, rollbacks, savepoints, and autonomous-transaction behavior. When generated code uses dblink, also test connection identity, session context, data visibility, and failure handling.
Triggers The event, firing order, scope, permissions, and behavior expected by the application. Review Oracle database-event and cross-edition triggers explicitly.

Inspect placeholders and missing implementations separately. Tests of other objects don't establish that a placeholder implements its Oracle source; see Placeholder output.

Validation workflow

  1. Review and verify both converted and not-converted objects in Conversion Object Explorer. Use Fix for Copilot-assisted corrections to objects and their dependent objects, and review the compilation results. Corrected dependent objects are resolved automatically after successful compilation.
  2. After verifying manual corrections, use Resolve for any object that needs a status update to Converted. Select Refresh to update the conversion reports.
  3. Review every complex object converted by AI, even when its conversion status indicates success.
  4. Save the tested corrections in the tool-generated files in postgres_ddl. Setup reads their latest saved contents and ignores files added manually to that directory. Use the Setup Experience to review deployment scope and deploy to a database you choose on the selected Azure service. Resolve reported deployment issues.
  5. Run procedures, functions, and application workloads with representative test data in the database you choose for testing.
  6. Confirm that business logic and result sets match the Oracle source before you promote the schema to production.

Retain conversion artifacts

Save the generated postgres_ddl folder along with the refreshed reports and the complete schema conversion project. These artifacts are useful for:

  • Compliance and audit reviews.
  • Knowledge transfer to operations or application teams.

Review the artifacts for credentials and sensitive schema details before storing them in your team's approved source-control or document-management system. Apply your organization's access and retention policies.