Friday, October 9, 2026
  • About Us
  • Contact
DBAInsight
  • Guides
    • 23ai
    • RMAN
    • 26ai
    • Patch Update
    • RMAN
    • MySQL
    • Oracle GoldenGate
  • Cloud Technology
  • Case Studies
  • Troubleshooting
  • Training & Certification
NEWSLETTER
No Result
View All Result
DBAInsight
Home Guides

Migrating to Oracle Database 23ai: Step-by-Step with SQL Performance Analyzer

January 14, 2026
in Guides
0
Migrating to Oracle 23ai Using SQL Performance Analyzer
0
SHARES
138
VIEWS

Upgrading an Oracle database is never just a technical exercise—it’s a risk management exercise. For most DBAs, the biggest fear during a major upgrade isn’t downtime or syntax changes. It’s performance regression.

Oracle Database 23ai introduces powerful new features, modern SQL enhancements, and AI-driven capabilities. But before going live, every DBA must answer one critical question:

Table of Contents

Toggle
    • Related posts
    • How to Transition from IT Support to Oracle Database Administration
    • Oracle 19c Time Zone Upgrade: DSTv32 to DSTv44
  • Why Performance Validation Is Critical When Moving to Oracle 23ai
  • Overview: Tools Used in This Migration
    • 🔹 SQL Performance Analyzer (SPA)
    • 🔹 OCI SQL Performance Watch (Optional)
  • Step 1: Prepare Your Oracle 19c Source Database
    • Recommended Pre-Checks
  • Step 2: Capture SQL Workload Using SQL Performance Analyzer
    • Create a SQL Tuning Set (STS)
    • Load SQL from AWR
  • Step 3: Export the SQL Tuning Set
  • Step 4: Upgrade or Migrate to Oracle Database 23ai
  • Step 5: Import SQL Workload into Oracle 23ai
  • Step 6: Execute SQL Performance Analyzer Trial
    • Create SPA Task
    • Execute Before and After Comparison
  • Step 7: Analyze SQL Performance Analyzer Report
    • What DBAs Should Focus On
  • Step 8: Fix Regressed SQL Before Go-Live
    • ✅ SQL Plan Baselines
    • ✅ Optimizer Parameters (Session Level)
    • ✅ Statistics Refresh
    • ✅ Minor SQL Rewrite
  • Step 9: Using OCI SQL Performance Watch (Optional but Powerful)
  • Final Pre-Production Checklist for DBAs
  • Final Thoughts: Upgrade with Confidence
  • Related Articles

Related posts

How to Transition from IT Support to Oracle Database Administration

How to Transition from IT Support to Oracle Database Administration

October 5, 2026
timezone

Oracle 19c Time Zone Upgrade: DSTv32 to DSTv44

October 1, 2026

👉 Will my existing SQL run the same—or better—after the upgrade?

This is where SQL Performance Analyzer (SPA) and OCI SQL Performance Watch become your best friends.

In this blog, we’ll walk through a practical, step-by-step approach to migrating from Oracle 19c to Oracle Database 23ai, while detecting, analyzing, and fixing SQL regressions before production cutover.


Why Performance Validation Is Critical When Moving to Oracle 23ai

Oracle Database 23ai comes with:

  • Optimizer enhancements
  • New SQL parsing behavior
  • Improved execution strategies
  • AI-assisted optimizations

While Oracle guarantees backward compatibility, execution plans can still change—sometimes for the better, sometimes not.

Without proper testing, DBAs risk:

  • Slow reports after upgrade
  • Batch jobs exceeding SLA
  • Application timeouts
  • Unexpected CPU or I/O spikes

That’s why Oracle strongly recommends SQL Performance Analyzer as part of every major upgrade.


Overview: Tools Used in This Migration

🔹 SQL Performance Analyzer (SPA)

A built-in Oracle tool that:

  • Captures real SQL workloads
  • Replays them on the upgraded database
  • Compares execution plans and performance
  • Highlights improved, unchanged, and regressed SQL

🔹 OCI SQL Performance Watch (Optional)

A cloud-based service that:

  • Monitors SQL behavior during upgrades
  • Predicts SQL regressions
  • Integrates with OCI Database Management
  • Reduces manual analysis effort

Both tools complement each other, especially in OCI or hybrid environments.


Step 1: Prepare Your Oracle 19c Source Database

Before capturing any workload, make sure:

  • The system represents real production behavior
  • Statistics are up to date
  • SQL plan baselines are stable

Recommended Pre-Checks

EXEC DBMS_STATS.GATHER_DATABASE_STATS;

Ensure:

  • No major tuning activities are ongoing
  • AWR snapshots are enabled
  • System load reflects normal usage

Step 2: Capture SQL Workload Using SQL Performance Analyzer

The goal here is to capture actual SQL statements executed by the application, not synthetic test queries.

Create a SQL Tuning Set (STS)

BEGIN
  DBMS_SQLTUNE.CREATE_SQLSET(
    sqlset_name => 'PRE_23AI_STS',
    description => 'Workload before Oracle 23ai upgrade'
  );
END;
/

Load SQL from AWR

BEGIN
  DBMS_SQLTUNE.LOAD_SQLSET(
    sqlset_name => 'PRE_23AI_STS',
    populate_cursor => DBMS_SQLTUNE.SELECT_WORKLOAD_REPOSITORY(
      begin_snap => 100,
      end_snap   => 110
    )
  );
END;
/

📌 Tip for DBAs:
Capture workloads during peak business hours for realistic results.


Step 3: Export the SQL Tuning Set

You’ll need the same workload available in Oracle 23ai.

EXEC DBMS_SQLTUNE.PACK_STGTAB_SQLSET(
  sqlset_name => 'PRE_23AI_STS',
  staging_table_name => 'STS_STAGE'
);

Export the staging table using Data Pump.


Step 4: Upgrade or Migrate to Oracle Database 23ai

At this stage:

  • Perform your 19c → 23ai upgrade (DBUA, manual, or OCI tools)
  • Apply latest RU
  • Gather optimizer statistics
EXEC DBMS_STATS.GATHER_DATABASE_STATS;

Do not tune anything yet—we want a clean comparison.


Step 5: Import SQL Workload into Oracle 23ai

Import the staging table and unpack the SQL set:

EXEC DBMS_SQLTUNE.UNPACK_STGTAB_SQLSET(
  sqlset_name => 'PRE_23AI_STS',
  staging_table_name => 'STS_STAGE'
);

Now Oracle 23ai has the exact same SQL workload as 19c.


Step 6: Execute SQL Performance Analyzer Trial

Create SPA Task

DECLARE
  l_task VARCHAR2(100);
BEGIN
  l_task := DBMS_SQLPA.CREATE_ANALYSIS_TASK(
    sqlset_name => 'PRE_23AI_STS',
    task_name   => 'SPA_19C_VS_23AI'
  );
END;
/

Execute Before and After Comparison

EXEC DBMS_SQLPA.EXECUTE_ANALYSIS_TASK(
  task_name => 'SPA_19C_VS_23AI',
  execution_type => 'COMPARE PERFORMANCE'
);

Oracle now:

  • Executes SQL in 23ai
  • Compares response time, CPU, buffer gets
  • Identifies regressions and improvements

Step 7: Analyze SQL Performance Analyzer Report

Generate the report:

SELECT DBMS_SQLPA.REPORT_ANALYSIS_TASK(
  task_name => 'SPA_19C_VS_23AI',
  type => 'HTML'
) FROM dual;

What DBAs Should Focus On

  • SQL with performance regression
  • Change in execution plans
  • Increased I/O or CPU usage
  • Missing indexes or cardinality shifts

Typically, you’ll see:

  • 80–90% unchanged or improved
  • Small percentage regressed (these need attention)

Step 8: Fix Regressed SQL Before Go-Live

Common DBA fixes include:

✅ SQL Plan Baselines

EXEC DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE;

✅ Optimizer Parameters (Session Level)

Test changes safely without global impact.

✅ Statistics Refresh

Some regressions are simply stale stats.

✅ Minor SQL Rewrite

In rare cases, small query adjustments help the optimizer.

📌 Golden Rule:
Fix issues before production, not after complaints start.


Step 9: Using OCI SQL Performance Watch (Optional but Powerful)

If your database runs on OCI, SQL Performance Watch:

  • Continuously tracks SQL behavior
  • Flags regressions automatically
  • Integrates with Database Management dashboards
  • Reduces manual SPA analysis

This is especially useful for:

  • Large environments
  • Multiple PDBs
  • Continuous upgrade testing

Final Pre-Production Checklist for DBAs

Before switching users to Oracle 23ai:
✔ SPA report reviewed
✔ Regressed SQL addressed
✔ Plan baselines validated
✔ Application testing completed
✔ Rollback strategy ready


Final Thoughts: Upgrade with Confidence

Migrating to Oracle Database 23ai doesn’t have to be stressful.

By using SQL Performance Analyzer and OCI SQL Performance Watch, DBAs can:

  • Predict performance issues
  • Eliminate surprises
  • Go live with confidence
  • Deliver a smooth upgrade experience

In 2026 and beyond, performance-aware upgrades are no longer optional—they’re a DBA best practice.


Related Articles

  • Why Upgrade to Oracle Database 23ai? Business Value & New Feature ROI
  • Oracle AI Vector Search – The Future of Semantic Intelligence in Oracle Database 23ai
Tags: 23aiMigrating to Oracle Database 23ai
Previous Post

Oracle ASM Components Explained: A Complete Guide for DBAs

Next Post

ORA-12547 in Oracle 23ai: TNS Lost Contact Caused by Incorrect ORACLE_HOME (Trailing Slash Issue)

Next Post
Ora-12547

ORA-12547 in Oracle 23ai: TNS Lost Contact Caused by Incorrect ORACLE_HOME (Trailing Slash Issue)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

POPULAR NEWS

  • Oracle Patch 38632161: Step-by-Step Guide to Upgrade Oracle 19c to Release Update 19.30

    Oracle Patch 38632161: Step-by-Step Guide to Upgrade Oracle 19c to Release Update 19.30

    0 shares
    Share 0 Tweet 0
  • How To Download And Install The Latest OPatch

    0 shares
    Share 0 Tweet 0
  • Oracle Database 19.32 Release Update (RU) Patching Guide – Patch 39472050

    0 shares
    Share 0 Tweet 0
  • How to Install Oracle 19c Database on Red Hat Enterprise Linux 9

    0 shares
    Share 0 Tweet 0
  • Installing Oracle Database 26AI on Red Hat Enterprise Linux 9

    0 shares
    Share 0 Tweet 0
  • About Us
  • Contact

© 2026 DBAInsight - Smarter Databases. Sharper Insights. DBAInsight.

No Result
View All Result
  • Home
  • Cloud & Modern DBs
  • Guides
  • Cloud Technology
  • Case Studies
  • Troubleshooting
  • Training & Certification

© 2026 DBAInsight - Smarter Databases. Sharper Insights. DBAInsight.

Add as a preferred source on Google
Add as preferred source on Google