Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Oracle 10g Installation/Applying Patches Tips Oracle
  • configUOCIOTTO.ora Oracle
  • oracle_env_10g_CADEV Linux/Unix
  • New Latest Param.sql for finding all hidden parameters also Oracle
  • Oracle 10g for solaris 10 Oracle
  • Zip and unzip with tar Linux/Unix
  • Adding a new disk and mount it automatically. on VMWARE LINUX Linux/Unix
  • Linux CPU info. Linux/Unix
  • How does one SELECT a value from a table into a Unix variable? From SQL to Shell Linux/Unix
  • move_arch_files.ksh Linux/Unix
  • How to find password change date for user Oracle
  • Adding Datafile on Primary Server and Impact on Standby Server Oracle
  • 556976.1 Oracle Clusterware: Components installed Oracle
  • VIvek Encryption Package and Its Usage Oracle
  • fdisk -l explaination about Primary-Logical-Extended Partitions Linux/Unix

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

  • DBMS_JOB all example Oracle
  • pvm_rbs1.sql (to collect rbs info from db) Oracle
  • export import with parameter file. Oracle
  • Looping for remote servers and find its database from oratab file. Linux/Unix
  • This is from Temi Oracle
  • Standby Database File Management in 10g with STANDBY_FILE_MANAGEMENT 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 (388)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (337)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • 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
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • DB Console Mainenance. Oracle
  • How to Decide upto what level you can decrement your datafile size. ( Shrink Datafile) Oracle
  • Rownum with Order by Oracle
  • find_cons.sql Oracle
  • Oracle 10g Installation/Applying Patches Tips Oracle
  • Export With Query Another Example. Oracle
  • normal maintenance for exp-imp and renaming table Oracle
  • Good RAC & Standby Notes Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme