Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • scripts to take listener.log backup Linux/Unix
  • Getting started with notebook Python/PySpark
  • Export With Query Another Example. Oracle
  • Disbaling DBA_SCHEDULER_JOBS Oracle
  • Physical Standby switchover with session active Oracle
  • Deleting first line and lastline of a file using sed Linux/Unix
  • good note for shared pool tunnig Oracle
  • MYSQL and Oracle Comparison for Oracle DBA MYSQL
  • Oracle Data Direct to TAPE Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • ORACLE_SID in sqlplus Oracle
  • Backup and Recovery Scenarios Oracle
  • rm_backup_arch_file.ksh Linux/Unix
  • Oracle 11g RAC on OEL 5 and Vmware 2 Oracle
  • copying/removing directory with all its subdirectory 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

  • SQL_PROFILE – I explaination Oracle
  • before_trunc.sql Before Truncate table needs to execute following: Oracle
  • Benefits and Usage of RMAN with Standby Databases Oracle
  • Very Good Oralce Internal Tuning Book Oracle
  • move_arch_files.ksh Linux/Unix
  • sid_wise_sql.sql Further explaination Oracle

Leave a Reply Cancel reply

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

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • This is im telling Kishore Oracle
  • Gather Stats manually using DBMS_STATS after disabling DBMS_SCHEDULER jobs as previous entry Oracle
  • Logic to chech # of parameters command line parameters Linux/Unix
  • move_arch_files.ksh Linux/Unix
  • newupload.html PHP/MYSQL/Wordpress
  • Flowers Resize datafiles Oracle
  • Facts about SCN and Rollback Segment Oracle
  • JSON/XML Types in Oracle Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme