Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Check_recovery.sh program to run sqlplus and return its values remotely. Linux/Unix
  • Standby Database File Management in 10g with STANDBY_FILE_MANAGEMENT Oracle
  • to see when crontab is changed. Linux/Unix
  • Oracle 11g Environment Setup Oracle
  • create a folder in multiple places Linux/Unix
  • How to analyze statspack or AWR report. Oracle
  • Standby Database Behavior when a Datafile is Resized on the Primary Database Note:123883.1 Oracle
  • normal maintenance for exp-imp and renaming table Oracle
  • How to choose Driver table in SQL statement Oracle
  • runsql_once.ksh Linux/Unix
  • findinfo.sql (SQL for getting CPU and Active session info) Oracle
  • Kill a session dynanically using execute immediate Oracle
  • Difference between SYNC and AFFIRM Oracle
  • rm_backup_arch_file.ksh Linux/Unix
  • move_arch_files.ksh 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

  • Physical Standby switchover with session active Oracle
  • refre.sql Oracle
  • Check_recovery.sh program to run sqlplus and return its values remotely. Linux/Unix
  • FGA Part-I Oracle
  • Find sort details from Db find_sort.sql Oracle
  • send attachment from unix-shell script Linux/Unix

Leave a Reply Cancel reply

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

Categories

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

Recent Posts

  • tracksqltime.sql05-Mar-2026
  • Complete Git Tutorial for Beginners25-Dec-2025
  • Postgres DB user and OS user.25-Dec-2025
  • 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

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Specify the Rollback segment to use in Transaction Oracle
  • Standby Database Behavior when a Datafile is Resized on the Primary Database Note:123883.1 Oracle
  • SQL Server: How to see historical transactions SQL Server
  • Unix command for system configuration Linux/Unix
  • Complete Git Tutorial for Beginners GIT
  • Default User Profile Oracle
  • In Addition to previous note, following grants needed on PERFSTAT user. Oracle
  • cur_sql.sql Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme