Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • pvm_rbs1.sql (to collect rbs info from db) Oracle
  • Histogram Overview Oracle
  • shr1.sql for MTS or Shared server configuration Oracle
  • Important Script Method for tuning Oracle
  • Free conference number from http://www.freeconference.com Oracle
  • How to specify 2 arch location to avoid any kind of DB hanging. Oracle
  • Oracle 10g Installation/Applying Patches Tips Oracle
  • Oracle Support Metalink ID 161818.1 Oracle
  • How to know Number of CPUs on Sun Box Linux/Unix
  • find_err.sql for finding errors from dba_errors. Oracle
  • Jai Shree Ram Linux/Unix
  • True Session Wait Activity in Oracle 10g Verygood Oracle
  • Ports used by Oracle Software Oracle
  • runsql_once.ksh Linux/Unix
  • Giving Grant on v$DATABASE Oracle

Transfer SQL Profiles from One database to other database.

Posted on 05-Sep-2024 By Admin No Comments on Transfer SQL Profiles from One database to other database.

In this guide, I’ll walk you through moving SQL profiles using a staging table. SQL profiles help databases optimize query execution plans.

Step#1 Create the Staging Table

First, create a staging table to hold SQL profiles that need to be transferred.

SQL> exec DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF(table_name => 'SQL_STG_TAB', schema_name => 'SYS');

This will create a table SQL_STG_TAB that holds SQL profiles. Its structure matches the DBA_SQL_PROFILES table

Step#2 Find the Profile Name to Move

To pack a particular SQL profile, identify its name by querying the DBA_SQL_PROFILES table.

SQL> select name from DBA_SQL_PROFILES where SQL_TEXT like '%SELECT%EMPLOYEE%NAME%';
NAME
---------------------
SYS_SQLPROF_014b

Step#3 Pack the Custom Profile to Staging Table

To pack a specific profile into the staging table:

SQL> EXEC DBMS_SQLTUNE.PACK_STGTAB_SQLPROF(staging_table_name => 'SQL_STG_TAB', profile_name => 'SYS_SQLPROF_014b');

To pack all profiles under the DEFAULT category:

SQL> EXEC DBMS_SQLTUNE.PACK_STGTAB_SQLPROF(staging_table_name => 'SQL_STG_TAB');

Step#4 Export the Staging Table

Now, export the staging table using exp:

$ exp "'/ as sysdba'" tables=SQL_STG_TAB file=SQL_STG_TAB.dmp

Step#5 Import the Staging Table

Copy the dump file to the target database instance and use imp to import it:

$ imp "'/ as sysdba'" file=SQL_STG_TAB.dmp full=y

Step#6 Unpack the Profile

SQL> EXEC DBMS_SQLTUNE.UNPACK_STGTAB_SQLPROF(replace => TRUE, staging_table_name => 'SQL_STG_TAB');

By following these steps, you’ll successfully move SQL profiles between databases.

Oracle, shell, SQL scripts

Post navigation

Previous Post: Load testing on Oracle 19C RAC with HammerDB
Next Post: Python class import from different folders

Related Posts

  • perf_today.sql Oracle
  • Sequence Resetting Oracle
  • Useful Solaris Commands on 28-SEP-2005 Linux/Unix
  • replace alphabets using sed Linux/Unix
  • Remove DOS CR/LFs (^M) Linux/Unix
  • Error Handling in Proc Oracle

Leave a Reply Cancel reply

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

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • To seee semaphores and shared memory segments in Solaris Linux/Unix
  • How to Modify the statistics collection by MMON for AWR repository Oracle
  • Debugging Shell FIles Linux/Unix
  • Renaming Global Name GLOBAL_NAME Oracle
  • oracle tips… from http://www.bijoos.com/oracle/douknow.htm Oracle
  • Goldengate Tutorial Oracle
  • Monitor Long Running Job Oracle
  • Removing Ctrl-M from end of line using vi Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme