SQL Profiles in the Data Dictionary

In the paper SQL Profiles (page 22) I described the data dictionary tables where the hints belonging to SQL profiles are stored. For example, with the following query it is possible to display the hints associated to the SQL profile named opt_estimate.

   SELECT attr_val
   FROM sys.sqlprof$ p, sys.sqlprof$attr a
   WHERE p.sp_name = 'opt_estimate'
   AND p.signature = a.signature
   AND p.category = a.category;

ATTR_VAL
---------------------------------------------------------------------------------
OPT_ESTIMATE(@"SEL$1", JOIN, ("T"@"SEL$1", "CH"@"SEL$1"), SCALE_ROWS=276.7754079)
OPT_ESTIMATE(@"SEL$1", TABLE, "CH"@"SEL$1", SCALE_ROWS=40.15499105)

As of Oracle Database 11g the previous query can no longer be used. In fact, the data dictionary has been changed. The tables SQLPROF$ and SQLPROF$ATTR no longer exist. As of Oracle Database 11g the information is stored in the tables SQLOBJ$ and SQLOBJ$DATA. The following query shows how to query the new tables. Note that since hints are stored in XML format, a conversion is necessary to have a readable output.

    SELECT extractValue(value(h),'.') AS hint
    FROM sys.sqlobj$data od, sys.sqlobj$ so,
    table(xmlsequence(extract(xmltype(od.comp_data),'/outline_data/hint'))) h
    WHERE so.name = 'opt_estimate'
    AND so.signature = od.signature
    AND so.category = od.category
    AND so.obj_type = od.obj_type
    AND so.plan_id = od.plan_id;

HINT
---------------------------------------------------------------------------------
OPT_ESTIMATE(@"SEL$1", TABLE, "CH"@"SEL$1", SCALE_ROWS=39.20843548)
OPT_ESTIMATE(@"SEL$1", JOIN, ("T"@"SEL$1", "CH"@"SEL$1"), SCALE_ROWS=281.2054138)
OPTIMIZER_FEATURES_ENABLE(default)

credit: https://antognini.ch/2008/08/sql-profiles-in-data-dictionary/