How to move SQL Profiles from one Database to another Database
1- Create the staging table
SQL> SYS@DB1
SQL> BEGIN
DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF (
table_name => ‘SQL_PROFILES’,
schema_name=>’SCOTT’);
END;
/
PL/SQL procedure successfully completed.
2- Packed all the existing SQL profiles in the staging table
SQL>
SQL> BEGIN
DBMS_SQLTUNE.PACK_STGTAB_SQLPROF (
profile_category => ‘%’,
staging_table_name => ‘SQL_PROFILES’,
staging_schema_owner=>’SCOTT’);
END;
/
PL/SQL procedure successfully completed.
3- Count the staging table
SQL> select count(*) from SCOTT.sql_profiles;
COUNT(*)
———-
5
4- Export the staging table at source
expdp system/***** dumpfile=expdp_sql_profiles.dmp TABLES=SCOTT.SQL_PROFILES DIRECTORY=DPUMP
5- Restore the database to a backup taken before All 5 SQL profiles were generated###
6- import the staging table at target
impdp system/***** dumpfile=expdp_sql_profiles.dmp TABLES=SCOTT.SQL_PROFILES DIRECTORY=DPUMP TABLE_EXISTS_ACTION=REPLACE
7- Unpack the SQL profiles from the staging table
SQL> BEGIN
DBMS_SQLTUNE.UNPACK_STGTAB_SQLPROF(
staging_table_name => ‘SQL_PROFILES’,
staging_schema_owner=>’SCOTT’,
replace=>FALSE);
END;
/
PL/SQL procedure successfully completed.