/oracle-to-postgres-migration-expert:migrating-oracle-to-postgres-data-access-codefrom oracle-to-postgres-migration-expert
Migrates .NET/C# data access code from Oracle.ManagedDataAccess or Oracle.EntityFrameworkCore to PostgreSQL with Npgsql. Replaces OracleConnection, OracleCommand, OracleDbType mappings, stored procedure calls, connection strings, and EF Core provider configuration.
Ships in oracle-to-postgres-migration-expert. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Migrates the C# data access layer of a .Postgres project copy from Oracle providers to Npgsql while preserving behavior, using the migration reports as the source of truth, and validating with a build and Oracle-specific searches.
.Postgres project copy; never modify the original Oracle-targeting project.Reports/{ProjectName}/MigrationChecklist.md exists and is the source of truth for work items.Reports/{ProjectName}/OracleRiskAnalysis.md exists for behavioral differences..csproj.using directives.OracleDbType mappings to NpgsqlDbType or remove unnecessary explicit typing.Reports/{ProjectName}/MigrationChecklist.md.| Oracle dependency or setting | PostgreSQL replacement |
|---|---|
Oracle.ManagedDataAccess.Core | Npgsql for ADO.NET. |
Oracle.EntityFrameworkCore | Npgsql.EntityFrameworkCore.PostgreSQL for EF Core. |
Oracle.* packages | Remove unless another non-data-access feature still requires them. |
Oracle connection strings in appsettings.json, appsettings.{env}.json, web.config, app.config, or environment variable configuration | Npgsql string such as Host=localhost;Port=5432;Database=mydb;Username=myuser;Password=.... |
OracleConnection key names | Keep the same key unless Oracle-specific naming forces a change. |
IConfiguration or secrets manager | Continue using the existing mechanism; do not hardcode credentials. |
If IDbConnection or IDbCommand abstractions are registered through DI, update the DI registration and connection string first; consuming code may need fewer changes.
| Oracle type | Npgsql replacement |
|---|---|
OracleConnection | NpgsqlConnection |
OracleCommand | NpgsqlCommand |
OracleDataReader | NpgsqlDataReader |
OracleDataAdapter | NpgsqlDataAdapter |
OracleParameter | NpgsqlParameter |
OracleTransaction | NpgsqlTransaction |
OracleException | NpgsqlException |
OracleDbType | NpgsqlDbType from the NpgsqlTypes namespace |
using Oracle.ManagedDataAccess.Client | using Npgsql |
OracleRefCursor | Remove cursor wrapping and use PostgreSQL refcursor or set-returning function handling. |
| Oracle construct | PostgreSQL or Npgsql replacement |
|---|---|
OracleDbType.Varchar2 | NpgsqlDbType.Varchar or omit and let Npgsql infer. |
OracleDbType.Clob | NpgsqlDbType.Text. |
OracleDbType.Number | NpgsqlDbType.Numeric or NpgsqlDbType.Integer depending on precision. |
OracleDbType.Date | NpgsqlDbType.Date for date only or NpgsqlDbType.Timestamp when time is used. |
OracleDbType.TimeStamp | NpgsqlDbType.Timestamp. |
OracleDbType.RefCursor | NpgsqlDbType.Refcursor; call inside a transaction and FETCH ALL IN "<cursor_name>". |
OracleDbType.Char | NpgsqlDbType.Char. |
ROWNUM <= n | LIMIT n. |
ROWNUM = 1 | LIMIT 1. |
NVL(x, y) | COALESCE(x, y). |
DECODE(expr, v1, r1, ...) | CASE WHEN expr = v1 THEN r1 ... END. |
SYSDATE / SYSTIMESTAMP | NOW() or CURRENT_TIMESTAMP. |
TO_CHAR(date, fmt) | Mostly compatible; verify format strings. |
TO_DATE(str, fmt) | Verify format strings. |
TO_NUMBER(str) | CAST(str AS NUMERIC) or str::NUMERIC. |
| ` | |
SELECT {SEQUENCE}.NEXTVAL FROM DUAL | SELECT nextval('{sequence_name}'); remove FROM DUAL. |
CONNECT BY hierarchy | Rewrite with recursive CTEs using WITH RECURSIVE. |
MERGE INTO | Rewrite as INSERT ... ON CONFLICT DO UPDATE. |
Empty string '' as NULL | PostgreSQL does not treat '' as NULL; review comparisons and IS NULL guards. |
VARCHAR2 | VARCHAR or TEXT. |
Oracle named parameter :param_name | Npgsql named parameter @param_name. |
| Area | Rule |
|---|---|
CommandType.StoredProcedure | Retain for function calls when supported by target Npgsql version. |
Procedures with OUT parameters | PostgreSQL may require CommandType.Text with CALL proc_name(...); verify against the target Npgsql version. |
RETURNS TABLE / RETURNS SETOF | Use ExecuteReader() directly; no cursor parameter needed. |
RETURNS refcursor | Open a transaction, execute function, read cursor name, then FETCH ALL IN "<cursor_name>". |
OUT / INOUT | Verify ParameterDirection matches the migrated signature. |
| EF Core provider | Replace .UseOracle(...) with .UseNpgsql(...). |
| EF Core builder | Remove OracleDbContextOptionsBuilder references. |
OnModelCreating | Review Oracle-specific HasColumnType("NUMBER") and use HasColumnType("numeric") or PostgreSQL type names. |
| Sequences | modelBuilder.HasSequence<int>("seq_name").StartsAt(1).IncrementsBy(1) is compatible; verify column defaults. |
| EF migrations | Do not run EF Core migrations; schema is managed externally via DDL scripts from Phase 4. |
dotnet build
grep -R "Oracle.ManagedDataAccess\|OracleConnection\|OracleCommand\|OracleDataReader\|OracleDbType\|OracleRefCursor" <PostgresProject>
grep -R ":[A-Za-z_][A-Za-z0-9_]*" <PostgresProject>
Fix compilation errors, then mark completed items in Reports/{ProjectName}/MigrationChecklist.md.
.Postgres copy: the Oracle project must remain available for comparison.OUT, INOUT, and set-returning functions require different patterns.'' as NULL; PostgreSQL does not.Check System.Data abstractions such as IDbConnection and IDbCommand before broad rewrites; project-wide, surface-level changes may be enough. In DbContext configuration, replace Oracle provider setup. Search for combined patterns such as OracleConnection/OracleCommand/OracleDataReader, :param, and cursor-wrapping code. Use Reports/{ProjectName}/OracleRiskAnalysis.md for cross-referencing; SELECT expr replaces Oracle's dummy table pattern. Use Npgsql ADO.NET and/or EF Core packages as needed.
### Oracle to PostgreSQL data access migration result
**Status:** migrated | partially migrated | blocked
**Project:** `<.Postgres project>`
**Checklist:** `Reports/{ProjectName}/MigrationChecklist.md`
| Step | Files changed | Notes |
| --- | --- | --- |
| NuGet packages | `<.csproj>` | <removed Oracle packages and added Npgsql packages> |
| Connection strings | `<config file>` | <key and secret handling> |
| ADO.NET types | `<files>` | <type replacements> |
| DbType mappings | `<files>` | <mapping decisions> |
| Stored procedures | `<files>` | <CALL/refcursor/returns handling> |
| SQL syntax | `<files>` | <Oracle constructs replaced> |
**Validation**
- `dotnet build`: pass | fail
- Oracle namespace/type search: pass | fail
- `Reports/{ProjectName}/MigrationChecklist.md` updated: yes | no
.Postgres copy was modified.Reports/{ProjectName}/MigrationChecklist.md drove the work and was updated.Oracle.ManagedDataAccess, OracleConnection, OracleCommand, OracleDataReader, OracleDbType, and OracleRefCursor no longer remain unless justified.OUT, INOUT, sequence, and :param_name patterns were reviewed.dotnet build passes or every failure is reported with evidence.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
C#, .NET, PostgreSQL, Oracle
8 skills in this plugin
/creating-oracle-to-postgres-master-migration-planDiscover .NET solution projects, classify Oracle-to-PostgreSQL migration eligibility, detect Oracle dependencies, and write .github/oracle-to-postgres-migration/Reports/MasterMigrationPlan.md. Use when starting a multi-project Oracle-to-PostgreSQL migration, inventorying .NET projects, or assessing Oracle dependency scope./creating-oracle-to-postgres-migration-bug-reportCreate structured bug reports for Oracle-to-PostgreSQL migration defects with source-of-truth Oracle behavior, PostgreSQL divergence, severity, root cause, remediation, validation, and filename convention. Use when documenting behavioral differences, failed migration tests, or data-layer defects during an Oracle-to-PostgreSQL migration./creating-oracle-to-postgres-migration-integration-testsCreate Phase 3 Oracle integration tests for .NET data access artifacts before Oracle-to-PostgreSQL migration, capturing Oracle behavior as the golden baseline while keeping assertions portable for Phase 6. Use when the user asks to add integration tests for repositories, DAOs, stored procedure callers, query builders, seed data, or lookup constants before PostgreSQL migration begins./migrating-oracle-to-postgres-stored-proceduresMigrate Oracle PL/SQL stored procedures and functions to PostgreSQL PL/pgSQL while preserving behavior, signatures, type-anchored inputs, exception handling, rollback logic, collation semantics, and orafce compatibility. Use when converting Oracle Procedures and Functions into PostgreSQL equivalents during an Oracle-to-PostgreSQL migration./planning-oracle-to-postgres-migration-integration-testingCreate an integration testing plan for one .NET project during Oracle-to-PostgreSQL migration. Use when planning coverage for repositories, DAOs, stored procedure callers, CRUD service layers, Oracle-specific behavior, seed data, or migration validation cases before writing integration tests./reviewing-oracle-to-postgres-migrationReview Oracle-to-PostgreSQL migration plans or completed artifacts for behavioral risks: empty strings, exceptions, refcursors, type coercion, sorting and collations, UNION ALL planner changes, materialized-view refresh, timestamps, sequences, ROWNUM, NVL/DECODE, and concurrent transactions. Use when planning or validating database migrations and integration tests.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin oracle-to-postgres-migration-expertOther plugins' skills for the same job