Friday, 5 January 2018

WRI$_OPTSTAT_HISTHEAD_HISTORY and SM/OPTSTAT in SYSAUX Tablespace. Why is getting full and how to reorg it.

The SYSAUX Tablespace can become full for various reasons. In my case, it was due to SM/OPSTATS segments (WRI$_OPTSTAT_HISTHEAD_HISTORY and their indexes) occupying most of the space. How can we fix this issue and avoid continually adding more space to the tablespace?

This post will identify the root cause and provide solutions based on real production data from a 30TB data warehouse running on Exadata X4-2. The database version is 11.2.0.4 BP20.

Let's start with a standard query to check the "occupants" in the SYSAUX tablespace:


set linesize 120
set pagesize 100
COLUMN "Item" FORMAT A25
COLUMN "Space Used (GB)" FORMAT 999.99
COLUMN "Schema" FORMAT A25
COLUMN "Move Procedure" FORMAT A40
SELECT  occupant_name "Item",
    space_usage_kbytes/1048576 "Space Used (GB)",
    schema_name "Schema",
    move_procedure "Move Procedure"
FROM v$sysaux_occupants
ORDER BY 2 desc
/

Item                      Space Used (GB) Schema                    Move Procedure
------------------------- --------------- ------------------ ----------------------------------------
SM/OPTSTAT                         132.57 SYS
SM/AWR                              47.35 SYS
JOB_SCHEDULER                        7.79 SYS
SM/ADVISOR                           2.47 SYS
XDB                                   .06 XDB                XDB.DBMS_XDB.MOVEXDB_TABLESPACE
...
...
AUDIT_TABLES                          .00 SYS                DBMS_AUDIT_MGMT.move_dbaudit_tables
ORDIM                                 .00 ORDSYS             ordsys.ord_admin.move_ordim_tblspc

Almost 132GB is occupied by SM/OPSTATS and WRI$_OPTSTAT_HISTHEAD_HISTORY table with two indexes on it:

select segment_name,segment_type,trunc(bytes/1024/1024/1024) gb from dba_segments where segment_name in ('WRI$_OPTSTAT_HISTHEAD_HISTORY','I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST','I_WRI$_OPTSTAT_HH_ST');

SEGMENT_NAME                     SEGMENT_TYPE               GB
-------------------------------- ------------------ ----------
WRI$_OPTSTAT_HISTHEAD_HISTORY    TABLE                      57
I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST    INDEX                      37
I_WRI$_OPTSTAT_HH_ST             INDEX                      27

Next we check the retention of statistic history, how long should they be stored in the database(default is 1 month):

select dbms_stats.get_stats_history_retention from dual;
GET_STATS_HISTORY_RETENTION
---------------------------
                         31


So we have here default value of 1 month but in my database we have history of one year:

SQL> select /*+full(t) parallel(8)*/ trunc(sysdate)-trunc(min(savtime)) from sys.WRI$_OPTSTAT_HISTHEAD_HISTORY t;
TRUNC(SYSDATE)-TRUNC(MIN(SAVTIME))
----------------------------------
                               350

Why? The default job which purge this table is limited to 5 minutes. And if it could not finish on time, then you would not get any information in alertlog about aborted job and the space consumption in SYSAUX will grow.

In internal table wri$_optstat_opr which store the information about gathering/restoring/purging stats, we don's see anything:

select count(*) from sys.wri$_optstat_opr where operation='purge_stats';

  COUNT(*)
----------
         0

Bare in mind that WRI$_OPTSTAT_HISTHEAD_HISTORY table stores history information about column statistics per table/partition/subpartitions, so for example for partitioned table with 100 partition with 15 columns one run of gather_table_stats will generate = 100 x 15 +1x15 = 1515 rows!

I've checked this with simple test on in my VirtaulBox lab:

SQL> exec dbms_stats.purge_stats(sysdate);
PL/SQL procedure successfully completed.

SQL> select count(*) from sys.WRI$_OPTSTAT_HISTHEAD_HISTORY t;


  COUNT(*)
----------
         0


SQL> create table table_purge partition by hash(object_id) partitions 100 as select * from dba_objects;
Table created.

SQL> select count(*) from dba_tab_columns where table_name='TABLE_PURGE';
  COUNT(*)
----------
        15


SQL> exec dbms_stats.gather_table_stats('SYS','TABLE_PURGE');
PL/SQL procedure successfully completed.

SQL> select count(*) from sys.WRI$_OPTSTAT_HISTHEAD_HISTORY t;
  COUNT(*)
----------
      1515

Imagine that is pretty common(like in my production datawarehouse) that after some application release+bunch of batch loading jobs database gets some new columns and thousands of partition/subpartition. After it, lets gather the statistics for all your tables and you have problem:) Purge job will not finish within the limit to "DELETE FROM".

So what is the next step? We use a simple loop to remove old entries. This step can take lot of time as under the hood a simple delete from ... is running.

begin
for i in reverse 31..360
loop
dbms_application_info.set_action(sysdate-i);
dbms_stats.purge_stats(sysdate-i);
end loop;
end;
/

Once it finish, you can check how many empty block the table has:

set serveroutput on
exec dbms_output.enable(1000000);

declare
   unf number;
   unfb number;
   fs1 number;
   fs1b number;
   fs2 number;
   fs2b number;
   fs3 number;
   fs3b number;
   fs4 number;
   fs4b number;
   full number;
   fullb number;

   own dba_tables.owner%type;
   tab dba_tables.table_name%type;

   yesno varchar2(3);

   type parts is table of dba_tab_partitions%rowtype;
   partlist parts;

   type cursor_ref is ref cursor;
   c_cur cursor_ref;

begin

   own:=upper('&owner');
   tab:=upper('&table_name');
   dbms_output.put_line('--------------------------------------------------------------------------------');

   open c_cur for select partitioned from dba_tables
 where owner=own and table_name=tab;
   fetch c_cur into yesno;
   close c_cur;

   dbms_output.put_line('Owner:     '||own);
   dbms_output.put_line('Table:     '||tab);

   dbms_output.put_line('------------------------------------------------');

   if yesno='NO'
   then
     dbms_space.space_usage(own,tab,'TABLE',unf,unfb,fs1,fs1b,fs2,fs2b,fs3,fs3b,fs4,fs4b,full,fullb);
     dbms_output.put_line('unf: '||unf||' fs1: '||fs1||' fs2: '||fs2||' fs3: '||fs3||' fs4: '||fs4||' full: '||full);

   else
     open c_cur for select * from dba_tab_partitions
       where table_owner=own and table_name=tab;
     fetch c_cur bulk collect into partlist;
     close c_cur;
    
     for i in partlist.first .. partlist.last
     loop
       dbms_space.space_usage(partlist(i).table_owner,partlist(i).table_name,'TABLE PARTITION',unf,unfb,fs1,fs1b,fs2,fs2b,fs3,fs3b,fs4,fs4b,full,fullb,partlist(i).partition_name);
       dbms_output.put_line('Partition: '||partlist(i).partition_name);
       dbms_output.put_line('unf: '||unf||' fs1: '||fs1||' fs2: '||fs2||' fs3: '||fs3||' fs4: '||fs4||' full: '||full);
     end loop;

   end if;
   dbms_output.put_line('--------------------------------------------------------------------------------');

end;
/
--------------------------------------------------------------------------------
Owner:     SYS
Table:     WRI$_OPTSTAT_HISTHEAD_HISTORY
------------------------------------------------
unf: 17204 fs1: 109 fs2: 152 fs3: 180 fs4: 6830726 full: 708823
--------------------------------------------------------------------------------

fs4 means empty blocks. We have 6830726 of them after purging.
As the most of space is empty lets reorganize the table and rebuild Function-Based Indexes:

alter index "SYS"."I_WRI$_OPTSTAT_HH_ST" unusable;
alter index "SYS"."I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST" unusable;
alter table "SYS"."WRI$_OPTSTAT_HISTHEAD_HISTORY" move parallel 8;
alter index "SYS"."I_WRI$_OPTSTAT_HH_ST" rebuild online parallel 8;
alter index "SYS"."I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST" rebuild online parallel 8;
alter index "SYS"."I_WRI$_OPTSTAT_HH_ST" noparallel;
alter index "SYS"."I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST" noparallel;

At the end we can check the size of this 3 segments(table+2 indexes) and check the block allocation from WRI$_OPTSTAT_HISTHEAD_HISTORY table:

select segment_name,segment_type,trunc(bytes/1024/1024/1024) gb from dba_segments where segment_name in ('WRI$_OPTSTAT_HISTHEAD_HISTORY','I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST','I_WRI$_OPTSTAT_HH_ST');

SEGMENT_NAME                    SEGMENT_TYPE               GB
------------------------------- ------------------ ----------
WRI$_OPTSTAT_HISTHEAD_HISTORY   TABLE                       5
I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST   INDEX                       2
I_WRI$_OPTSTAT_HH_ST            INDEX                       1


--------------------------------------------------------------------------------
Owner:     SYS
Table:     WRI$_OPTSTAT_HISTHEAD_HISTORY
------------------------------------------------
unf: 0 fs1: 0 fs2: 0 fs3: 0 fs4: 0 full: 712575

--------------------------------------------------------------------------------
Before 132GB and after 8GB. Not bad.


Item                      Space Used (GB) Schema                    Move Procedure
------------------------- --------------- ------------------------- ----------------------------------------
SM/AWR                              47.93 SYS
SM/OPTSTAT                          19.62 SYS
JOB_SCHEDULER                        7.79 SYS
SM/ADVISOR                           2.49 SYS
...
...
AUDIT_TABLES                          .00 SYS                       DBMS_AUDIT_MGMT.move_dbaudit_tables
ORDIM                                 .00 ORDSYS                    ordsys.ord_admin.move_ordim_tblspc













Wednesday, 24 May 2017

Failed login attempts



Number of failed login attempts exceeds threshold value message comes from OEM.
How to check what user is causing this? DBA_AUDIT_SESSION can help to identifiy the username,userhost, etc:
SQL> desc DBA_AUDIT_SESSION
 Name              
 -------------------
 OS_USERNAME       
 USERNAME          
 USERHOST          
 TERMINAL          
 TIMESTAMP         
 ACTION_NAME       
 LOGOFF_TIME       
 LOGOFF_LREAD      
 LOGOFF_PREAD      
 LOGOFF_LWRITE     
 LOGOFF_DLOCK      
 SESSIONID         
 RETURNCODE        
 CLIENT_ID         
 SESSION_CPU       
 EXTENDED_TIMESTAMP
 PROXY_SESSIONID   
 GLOBAL_UID        
 INSTANCE_NUMBER   
 OS_PROCESS
 


Lets check the errors within last day:


SELECT
  TO_CHAR(TIMESTAMP,'YYYY/MM/DD HH24:MI') TIMESTAMP,
  SUBSTR(OS_USERNAME,1,20) OS_USERNAME,
  SUBSTR(USERNAME,1,20) USERNAME,
  SUBSTR(TERMINAL,1,20) TERMINAL,
  ACTION_NAME,
  RETURNCODE
FROM
SYS.DBA_AUDIT_SESSION
WHERE TIMESTAMP BETWEEN SYSDATE-1 AND SYSDATE
and RETURNCODE>0
ORDER BY TIMESTAMP;
TIMESTAMP        OS_USERNAM USERNAME              TERMINAL          ACTION_NAME   RETURNCODE
---------------- ---------- --------------------- ----------------- ------------- ----------
2017/05/24 12:56 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017
2017/05/24 12:56 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017
2017/05/24 12:56 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017
2017/05/24 12:56 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017
2017/05/24 12:56 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017
2017/05/24 12:56 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017
2017/05/24 12:57 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017
2017/05/24 12:57 SYSTEM     DBP_007_GENEOS_USER   LONGCASU0014      LOGON               1017

SELECT  SUBSTR(OS_USERNAME,1,20) OS_USERNAME,
SUBSTR(USERNAME,1,20) USERNAME,
SUBSTR(TERMINAL,1,20) TERMINAL,
ACTION_NAME,
RETURNCODE,count(*)
FROM
SYS.DBA_AUDIT_SESSION
WHERE TIMESTAMP BETWEEN SYSDATE-1 AND SYSDATE
and RETURNCODE>0
group by SUBSTR(OS_USERNAME,1,20),
SUBSTR(USERNAME,1,20),
SUBSTR(TERMINAL,1,20),
ACTION_NAME,RETURNCODE
order by count(*);
OS_USERNAM USERNAME                 TERMINAL         ACTION_NAME  RETURNCODE   COUNT(*)
---------- ------------------------ ---------------- ------------ ---------- ----------
umesnag    DBP_107_ETL_USER         unknown          LOGON              1017          1
singtaja   DBP_TOOLS_USER           unknown          LOGON              1017          1
singtaja   DBP_007_ACCESS_OWNER     unknown          LOGON             28000          1
rohivai    DBP_TOOLS_USER           unknown          LOGON              1017          1
dubeamib   DUBEAMIB                 unknown          LOGON             28001          1
kumshar    PRASAVV                  unknown          LOGON             28001          1
nunepab    DBP_011_STAGING_USER     unknown          LOGON              1017          1
singhash   DBP_TOOLS_USER           unknown          LOGON              1017          1
umalaks    URJA_DBP_107_RAP_OWN     unknown          LOGON              1017          1
umalaks    DBP_107_RAP_OWNER        unknown          LOGON              1017          1
kumakun    DBP_TOOLS_USER           unknown          LOGON              1017          5
panitan    DBP_014_APP_USER         unknown          LOGON              1017         10
dubeamib   DBP_107_ETL_USER         unknown          LOGON              1017         12
infarun    DBP_007_ETL_USER                          LOGON             28000         36
SYSTEM     DBP_007_GENEOS_USER      LONGCASU0014     LOGON              1017        121
SYSTEM     DBP_007_GENEOS_USER      LONGCASU0014     LOGON             28000       6920



RETURNCODE column is simply Oracle Error Code


SQL> !oerr ora 28000
28000, 00000, "the account is locked"
// *Cause:   The user has entered wrong password consequently for maximum
//           number of times specified by the user's profile parameter
//           FAILED_LOGIN_ATTEMPTS, or the DBA has locked the account
// *Action:  Wait for PASSWORD_LOCK_TIME or contact DBA
SQL> !oerr ora 1017
01017, 00000, "invalid username/password; logon denied"
// *Cause:
// *Action:

Monday, 28 September 2015

How to list all databases with old COMPATIBLE or OPTIMIZER_FEATURES_ENABLE according to OH software release version

With end of 2015 will Oracle Database 11g out of normal support so lot of customers make an upgrade campaign in data centers. Every DBA go(should go at least) through a list of manual step to upgrade database (Complete Checklist for Manual Upgrades to Oracle Database 12c Release 1 (12.1) (Doc ID 1503653.1)).

This note state that after upgrade we have to set new value for COMPATIBLE parameter. I will recommend as well to look on another instance parameter related with database release software version - OPTIMIZER_FEATURES_ENABLE. This parameter is responsible for enabling a series of optimizer features based on an Oracle release number.

Sometimes after few months or years:) after upgrade you realize that some of your 1000 databases have wrong parameters which you had simply forgot to change...

Bearing that in my mind I use Configuration Search feature of Enterprise Manager to report all database configuration issue due differences between oracle home release version and instance compatible and optimizer_features_enable parameters. (More about Configuration Search you can find in nice post from Dave Wolf https://blogs.oracle.com/oem/entry/harness_the_power_of_configuration).

So here is the script:

set lines 300
set pages 100
col hostname format a30
col instance format a20
col parameter format a20
col value format a20
col dbversion format a20
  SELECT s5.target_name hostname,
         s2.target_name instance,
         s4.NAME parameter,
         s4.VALUE,
         s3.DBVERSION
    FROM CM$MGMT_DB_INIT_PARAMS_ECM s4,
         CM$MGMT_DB_DBNINSTANCEINFO_ECM s3,
         MGMT$TARGET s5,
         GC$ASSOC_INST_WITH_INVERSE s5a1,
         MGMT$ECM_CURRENT_SNAPSHOTS s2gen1,
         MGMT$TARGET s2
   WHERE     s2gen1.TARGET_GUID = s2.TARGET_GUID
         AND s2gen1.ECM_SNAPSHOT_ID = s3.ECM_SNAPSHOT_ID(+)
         AND s3.ECM_SNAPSHOT_ID = s4.ECM_SNAPSHOT_ID
         AND (NLS_UPPER (s4.NAME) LIKE NLS_UPPER ('compatible'))
         AND s5a1.SOURCE_ME_GUID = s2.TARGET_GUID
         AND s5a1.DEST_ME_GUID = s5.TARGET_GUID
         AND s5.TARGET_TYPE = 'host'
         AND s5a1.ASSOC_TYPE = 'hosted_by'
         AND s2.TARGET_TYPE = 'oracle_database'
         AND s2gen1.SNAPSHOT_TYPE = 'oracle_dbconfig'
         AND SUBSTR (s3.DBVERSION, 1, 4) != SUBSTR (s4.VALUE, 1, 4)
ORDER BY 2, 3


and output:

HOSTNAME                            INSTANCE             PARAMETER            VALUE                DBVERSION          
----------------------------------  -------------------- -------------------- -------------------- --------------------
adux0444.us01.ny02.example.com      ADB03XXI             compatible           11.1.0.7.0           11.2.0.4.0         
adux0165.us01.ny02.example.com      ADUXAB1E             compatible           10.2.0.4             11.2.0.4.0         
adux0165.us01.ny02.example.com      ADUXAB1K             compatible           10.2.0.4             11.2.0.4.0         
adux0302.us01.ny02.example.com      ADUXATDE             compatible           11.1.0.7             11.2.0.4.0         
adux0350.us01.ny02.example.com      ADUXAX2K             compatible           11.1.0.0.0           11.2.0.4.0         
adux0318.us01.ny02.example.com      ADUXAX2P             compatible           11.1.0.0.0           11.2.0.3.0         
adux0037.us01.ny02.example.com      ADUXBO2P             compatible           11.1.0.7             11.2.0.4.0         
adux0096.us01.ny02.example.com      ADUXCL1E             compatible           10.2.0.3             11.2.0.4.0         
adux0444.us01.ny02.example.com      ADUXCL1I             compatible           10.2.0.4             11.2.0.4.0         
adux0096.us01.ny02.example.com      ADUXCL1K             compatible           10.2.0.4             11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXCL1P             compatible           10.2.0.4.0           11.2.0.4.0         
adux0066.us01.ny02.example.com      ADUXCL1Q             compatible           10.2.0.4.0           11.2.0.3.0         
adux0179.us01.ny02.example.com      ADUXCL2Q             compatible           10.2.0.4             11.2.0.3.0         
aduc0219.us01.ny02.example.com      ADUXCR6K_CR6K1       compatible           10.2.0.4             11.2.0.3.0         
aduc0220.us01.ny02.example.com      ADUXCR6K_CR6K2       compatible           10.2.0.4             11.2.0.3.0         
aduc0546.us01.ny02.example.com      ADUXCR6K_CR6K3       compatible           10.2.0.4             11.2.0.3.0         
adux0249.us01.ny02.example.com      ADUXCT1E             compatible           10.2.0.4.0           11.2.0.4.0         
adux0249.us01.ny02.example.com      ADUXCT1K             compatible           10.2.0.2.0           11.2.0.4.0         
adux0044.us01.ny02.example.com      ADUXCT1P             compatible           10.2.0.2.0           11.2.0.4.0         
adux0249.us01.ny02.example.com      ADUXCT1T             compatible           10.2.0.2.0           11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXCZ2E             compatible           10.2.0.3             11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXCZ2K             compatible           10.2.0.4             11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXCZ2P             compatible           10.2.0.4             11.2.0.4.0         
adux0066.us01.ny02.example.com      ADUXCZ2Q             compatible           10.2.0.4             11.2.0.4.0         
aduc0233.us01.ny02.example.com      ADUXEH3E             compatible           10.2.0.4.0           11.2.0.2.0         
adux0044.us01.ny02.example.com      ADUXEH3P             compatible           11.1.0.7.0           11.2.0.3.0         
adux0249.us01.ny02.example.com      ADUXEV3K             compatible           11.1.0.7.0           11.2.0.4.0         
adux0037.us01.ny02.example.com      ADUXEV3P             compatible           10.2.0.4.0           11.2.0.4.0         
adux0157.us01.ny02.example.com      ADUXEV4P             compatible           10.2.0.4.0           11.2.0.4.0         
adux0445.us01.ny02.example.com      ADUXFI1I             compatible           10.2.0.3             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXFI1K             compatible           10.2.0.3             11.2.0.4.0         
adux0037.us01.ny02.example.com      ADUXFI1P             compatible           10.2.0.3             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXFI2E             compatible           10.2.0.3             11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXFK3E             compatible           11.1.0.0             11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXFK3K             compatible           11.1.0.0             11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXFK3P             compatible           10.2.0.4             11.2.0.4.0         
adux0096.us01.ny02.example.com      ADUXFR4E             compatible           10.2.0.3             11.2.0.1.0         
adux0280.us01.ny02.example.com      ADUXGV8K             compatible           10.2.0.4             11.2.0.2.0         
adux0350.us01.ny02.example.com      ADUXIB3I             compatible           11.1.0.7.0           11.2.0.4.0         
adux0350.us01.ny02.example.com      ADUXIB3K             compatible           11.1.0.7.0           11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXIB3P             compatible           11.1.0.7.0           11.2.0.4.0         
adux0350.us01.ny02.example.com      ADUXIB3S             compatible           11.1.0.7.0           11.2.0.4.0         
adux0350.us01.ny02.example.com      ADUXIB4I             compatible           11.1.0.7.0           11.2.0.4.0         
adux0350.us01.ny02.example.com      ADUXIB7K             compatible           11.1.0.7.0           11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXIC1E             compatible           10.2.0.4             11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXIC2E             compatible           10.2.0.4             11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXIC2I             compatible           10.2.0.4             11.2.0.4.0         
adux0248.us01.ny02.example.com      ADUXIC2K             compatible           10.2.0.4             11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXIC2P             compatible           10.2.0.4             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXKM1K             compatible           10.2.0.2.0           11.2.0.2.0         
adux0037.us01.ny02.example.com      ADUXKM1P             compatible           10.2.0.2.0           11.2.0.2.0         
adux0249.us01.ny02.example.com      ADUXMM1K             compatible           10.2.0.4             11.2.0.4.0         
adux0037.us01.ny02.example.com      ADUXMM1P             compatible           10.2.0.4             11.2.0.4.0         
adux0319.us01.ny02.example.com      ADUXOA1K             compatible           11.1.0.7.0           11.2.0.4.0         
adux0318.us01.ny02.example.com      ADUXOA1P             compatible           11.1.0.7.0           11.2.0.4.0         
adux0096.us01.ny02.example.com      ADUXOC1E             compatible           10.2.0.4             11.2.0.4.0         
adux0096.us01.ny02.example.com      ADUXOC1I             compatible           10.2.0.4             11.2.0.4.0         
adux0096.us01.ny02.example.com      ADUXOC1K             compatible           10.2.0.4             11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXOC1P             compatible           10.2.0.4             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXPC1K             compatible           10.2.0.4             11.2.0.4.0         
adux0037.us01.ny02.example.com      ADUXPC1P             compatible           10.2.0.4             11.2.0.4.0         
adux0249.us01.ny02.example.com      ADUXSB5K             compatible           11.1.0.7.0           11.2.0.4.0         
adux0044.us01.ny02.example.com      ADUXSB5P             compatible           11.1.0.7.0           11.2.0.4.0         
adux0043.us01.ny02.example.com      ADUXSB5Q             compatible           11.1.0.7.0           11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXSM5P             compatible           11.1.0.7.0           11.2.0.4.0         
adux0066.us01.ny02.example.com      ADUXSM5Q             compatible           11.1.0.7.0           11.2.0.2.0         
adux0065.us01.ny02.example.com      ADUXSM6P             compatible           11.1.0.7.0           11.2.0.3.0         
adux0445.us01.ny02.example.com      ADUXSO1I             compatible           10.2.0.4.0           11.2.0.4.0         
adux0249.us01.ny02.example.com      ADUXSO1K             compatible           10.2.0.4.0           11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXSP1K             compatible           10.2.0.2.0           11.2.0.4.0         
adux0445.us01.ny02.example.com      ADUXTC1I             compatible           10.2.0.2             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXTM1K             compatible           11.1.0.7.0           11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXTM2K             compatible           11.1.0.7.0           11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXUA6E             compatible           10.1.0.0.0           10.2.0.5.0         
adux0165.us01.ny02.example.com      ADUXUK8E             compatible           10.2.0.3.0           11.2.0.4.0         
adux0165.us01.ny02.example.com      ADUXUK8K             compatible           10.2.0.3.0           11.2.0.4.0         
adux0112.us01.ny02.example.com      ADUXUK8P             compatible           11.1.0.7.0           11.2.0.4.0         
adux0249.us01.ny02.example.com      ADUXVA1K             compatible           10.2.0.3.0           11.2.0.2.0         
adux0094.us01.ny02.example.com      ADUXVT2K             compatible           11.1.0.7             11.2.0.4.0         
adux0037.us01.ny02.example.com      ADUXVT2P             compatible           11.1.0.7.2           11.2.0.3.0         
adux0096.us01.ny02.example.com      ADUXWQ1E             compatible           11.1.0.0             11.2.0.4.0         
adux0445.us01.ny02.example.com      ADUXWQ1I             compatible           10.2.0.4             11.2.0.4.0         
adux0096.us01.ny02.example.com      ADUXWQ1K             compatible           10.2.0.4             11.2.0.4.0         
adux0065.us01.ny02.example.com      ADUXWQ1P             compatible           10.2.0.4             11.2.0.4.0         

84 rows selected.


Change this line to get list of optimizer parameters across your enviroment 


from

AND (NLS_UPPER (s4.NAME) LIKE NLS_UPPER ('compatible'))
to 
AND (NLS_UPPER (s4.NAME) LIKE NLS_UPPER ('optimizer_features_enable'))


Output:

HOSTNAME                       INSTANCE             PARAMETER                    VALUE                DBVERSION          
------------------------------ -------------------- ---------------------------- -------------------- --------------------
adux0065.us01.ny02.example.com      ADUXBB1P             optimizer_features_enable    10.2.0.4             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXBO2E             optimizer_features_enable    11.1.0.7             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXBO2K             optimizer_features_enable    11.1.0.7             11.2.0.4.0         
adux0037.us01.ny02.example.com      ADUXBO2P             optimizer_features_enable    11.1.0.7             11.2.0.4.0         
adux0094.us01.ny02.example.com      ADUXBO2T             optimizer_features_enable    11.1.0.7             11.2.0.4.0         
aduc0219.us01.ny02.example.com      ADUXCR6K_CR6K1       optimizer_features_enable    10.2.0.4             11.2.0.3.0         
aduc0220.us01.ny02.example.com      ADUXCR6K_CR6K2       optimizer_features_enable    10.2.0.4             11.2.0.3.0         
aduc0546.us01.ny02.example.com      ADUXCR6K_CR6K3       optimizer_features_enable    10.2.0.4             11.2.0.3.0         
adux0044.us01.ny02.example.com      ADUXEH3P             optimizer_features_enable    10.2.0.4             11.2.0.3.0         
adux0249.us01.ny02.example.com      ADUXIR1K             optimizer_features_enable    11.1.0.7             11.2.0.4.0         
adux0157.us01.ny02.example.com      ADUXIR1P             optimizer_features_enable    11.1.0.7             11.2.0.4.0         
adux0037.us01.ny02.example.com      ADUXKM1P             optimizer_features_enable    10.2.0.5             11.2.0.2.0         
adux0113.us01.ny02.example.com      ADUXUK3P             optimizer_features_enable    10.2.0.4             11.2.0.4.0         
adux0113.us01.ny02.example.com      ADUXUK4P             optimizer_features_enable    10.2.0.4             11.2.0.4.0         
adux0165.us01.ny02.example.com      ADUXUK5K             optimizer_features_enable    10.2.0.4             11.2.0.4.0         
adux0112.us01.ny02.example.com      ADUXUK5P             optimizer_features_enable    10.2.0.4             11.2.0.4.0         
adux0112.us01.ny02.example.com      ADUXUK6P             optimizer_features_enable    10.2.0.4             11.2.0.4.0         
adux0165.us01.ny02.example.com      ADUXUK7K             optimizer_features_enable    10.2.0.4             11.2.0.4.0         
adux0165.us01.ny02.example.com      ADUXUK9K             optimizer_features_enable    10.2.0.4             11.2.0.4.0         

19 rows selected.




PS. Using emcli you can easily export your reports from dev environment to production

emcli export_report -title="Report_Diff_Ora" -owner="SYSMAN" -output_file=/l/ora/reports/Report_Diff_Ora.xml