Thursday, January 19, 2012

2012 January PSU and the growth in the System Change Number (SCN) bug.

With 2012 January PSU/CPU Oracle has patched the SCN growth bug, the case when a database is having a high rate change for SCN. Computer world has an comprehensive article about this issue.

Following metalink notes provides means to test if the database is affected by this bug.
Information on the System Change Number (SCN) and how it is used in the Oracle Database [ID 1376995.1]
Installing, Executing and Interpreting output from the "scnhealthcheck.sql" script [ID 1393363.1]
Evidence to collect when reporting "high SCN rate" issues to Oracle Support [ID 1388639.1]

scnhealthcheck.sql mentioned in 1393363.1 could be used to verify if the database is affected.
SQL> @scnhealthcheck.sql
--------------------------------------------------------------
ScnHealthCheck
--------------------------------------------------------------
Current Date: 2012/01/19 10:39:57
Current SCN:  4165911
Version:      11.2.0.3.0
--------------------------------------------------------------
Result: A - SCN Headroom is good
Apply the latest recommended patches
based on your maintenance schedule
For further information review MOS document id 1393363.1
--------------------------------------------------------------
Recommendations are if the output is Result: A - SCN Headroom is good then system SCN health is good apply the recommended patches (756671.1) during the normal maintenance schedule.

If the output is Result: B - SCN Headroom is low then apply the recommended patches immediately outside the normal maintenance schedule and continue to monitor the SCN health. Once patched headroom will increase overtime (could take days or weeks) to script to report Result: A - SCN Headroom is good.

If the output is Result: C - SCN Headroom is low then apply the recommended patches immediately and collect required information listed on 1388639.1 and raise a SR so additional advice could be given.

With this PSU a new hidden parameter called "_external_scn_rejection_threshold_hours" has been introduced in connection with this bug. Once the patch is applied Oracle recommend setting this to 24 on 10g and 11gR1 systems. Value of _external_scn_rejection_threshold_hours after patched applied on 11gR1 (11.1.0.7)
To set the value to 24
alter system set "_external_scn_rejection_threshold_hours" = 24 
   comment='Set threshold on dd/mon/yyyy - See MOS Document 1393363.1' 
   scope=spfile ;
On 11gR2 systems this set to 24 by default once the patch is applied.
Apart from the the test cases mentioned in 1376995.1 IOUG newsletter mentioned another "way to test is to look at the backups with a restore process to validate SCN values and recoverability which is part of a best practice for database administrators. With these tests and test plans for applying the Patch Set Updates (PSU) or traditional Critical Patch Update patches, the vulnerabilities can be validated with appropriate fixes of the environment."

More clarifications on the issue from computer world

Wednesday, January 18, 2012

dbms_cube_exp.schema_info_imp_beg error while importing with impdp

Following error came up when doing a schema import from a 11gR1 standard edition database to another 11gR1 standard edition database.Beginning of import
ORA-39083: Object type PROCACT_SCHEMA failed to create with error:
ORA-12663: Services required by client not available on the server
ORA-36961: Oracle OLAP is not available.
Failing sql is:
BEGIN 
dbms_cube_exp.schema_info_imp_beg(0, '11.01.00.00.00');
dbms_cube_exp.schema_info_imp_end(0, '11.01.00.00.00');COMMIT; END;
and at the end
ORA-39083: Object type PROCACT_SCHEMA failed to create with error:
ORA-12663: Services required by client not available on the server
ORA-36961: Oracle OLAP is not available.
Failing sql is:
BEGIN 
dbms_cube_exp.schema_info_imp_beg(1, '11.01.00.00.00');
dbms_cube_exp.schema_info_imp_loop(1, '11.01.00.00.00', '<?xml version="1.0" encoding="UTF-16"?>
<Metadata
Version="1.1"
CreateOnly="True">
</Metadata>');
dbms_cube_exp.schema_info_imp_end(1, '11.01.00.00.00');COMMIT; END; 
The import completed without any further errors and schema objects were available on the imported database. Metalink note DataPump Import (IMPDP) Receives The Errors ORA-39083 PLS-201 identifier DBMS_CUBE_EXP.SCHEMA_INFO_IMP_BEG [ID 789549.1] mentions that this is a ignorable error.

OLAP is not an option available with standard edition database but it gets added in an invalid state when a database is created using one of the provided database templates (transaction processing database) with oracle. Although option get installed it remains in a invalid state.
Metalink note "How To Find Out If OLAP Is Being Used And How To Remove OLAP [Doc ID 739032.1]" could be used to verify if olap is installed and used. (being used in a standard edition system is unlikely). The remove steps listed in this metalink note cannot be run on standard edition as those files are not installed with standard edition.

There's another metalink that list "How to Remove OLAP From the Standard Edition database. [ID 1362752.1]" which is by dropping the OLAPSYS  user and running utlrp afterwards. This will remove the OLAP Catalog option from the database but OLAP Analytic Workspace and Oracle OLAP API will remain in an invalid state.
SQL> select comp_id, comp_name, version, status
  2         from dba_registry
  3         where comp_name like '%OLAP%';

COMP_ COMP_NAME                 VERSION    STATUS
----- ------------------------- ---------- --------
APS   OLAP Analytic Workspace   11.1.0.7.0 INVALID
XOQ   Oracle OLAP API           11.1.0.7.0 INVALID
Metalink note Remove Invalid OLAP Objects From SYS And OLAPSYS Schemas [ID 565773.1] could be used to resolve any invalid objects issues after the removal of olap catalog.

SR has been raised to find out ways to remove these options from a standard edition database.

Useful metalink notes
How To Remove or De-activate OLAP After Migrating From 9i To 10g or 11g [ID 467643.1]
ORA-39127 SYS.DBMS_CUBE_EXP.INSTANCE_EXTENDED_INFO_EXP ORA-44002 On Expdp After Upgrade To 11.2.0.2 [ID 1353491.1]
How To Find Out If OLAP Is Being Used And How To Remove OLAP [Doc ID 739032.1]
How to Remove OLAP From the Standard Edition database. [ID 1362752.1]
Remove Invalid OLAP Objects From SYS And OLAPSYS Schemas [ID 565773.1]
How To Remove Or To Reinstall The OLAP Option To 10g And 11g [ID 332351.1]
DataPump Import(IMPDP) Receives The Errors ORA-39083 PLS-201 identifier DBMS_CUBE_EXP.SCHEMA_INFO_IMP_BEG [ID 789549.1]

Workaround
First of all it must be strenuously stressed that this workaround is not an official oracle supported one (yet! maybe!).

Copied the olap folder ($ORACLE_HOME/olap) from a enterprise installation into standard edition home and ran the remove scripts mentioned in Doc ID 739032.1.
@?/olap/admin/catnoamd.sql
@?/olap/admin/olapidrp.plb
@?/olap/admin/catnoaps.sql
@?/olap/admin/catnoxoq.sql
Afterwards ran @?/rdbms/admin/utlrp and execution didn't show any errors. But three sys object related OLAP came as invalid
SQL> select object_name,object_type from dba_objects where owner='SYS' and status <> 'VALID';

OBJECT_NAME              OBJECT_TYPE
------------             -------------
INTERACTIONEXECUTE        FUNCTION
XOQ_VALIDATE              PROCEDURE
CWM2_OLAP_INSTALLER       PACKAGE BODY
Dropped them and ran utlrp again still no errors. The OLAP option that remained invalid in the dba_registry is now shown as removed.
SQL> select comp_id, comp_name, version, status
  2         from dba_registry
  3         where comp_name like '%OLAP%';

COMP_ COMP_NAME                 VERSION    STATUS
----- ------------------------- ---------- --------
APS   OLAP Analytic Workspace   11.1.0.7.0 REMOVED
XOQ   Oracle OLAP API           11.1.0.7.0 REMOVED

Update 02 February 2012
Outcome from the SR was these options were never intended to be in SE (Standard Edition) but could get in through imp and using the template that has some EE (Enterprise Edition) components (was the case here). So there's no "official" way to remove these components from SE and require a custom approach since the script provided to remove these components from EE are not even installed on SE. Therefore it wouldn't be a issue if those scripts are copied from EE to SE to remove the unsupported components.

Related post : ORA-39127: unexpected error from call to export_string :=SYS.DBMS_CUBE_EXP.SCHEMA_INFO_EXP while Exporting

Running Opatch throws up org.xml.sax.SAXParseException: : XML-20108: (Fatal Error) Start of root element expected

The server was hosting multiple Oracle homes from 10gR2, 11gR1 and 11gR2. Primarily used for testing PSU patch before applying to production system. There hasn't been any new installation of Oracle homes and inventory has been without any errors.

Trying to apply the PSU Jan threw up the following error.
Oracle Interim Patch Installer version 11.2.0.1.9
Copyright (c) 2011, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/app/oracle/product/11.2.0/ent11.2.0.3
Central Inventory : /opt/app/oraInventory
   from           : /opt/app/oracle/product/11.2.0/ent11.2.0.3/oraInst.loc
OPatch version    : 11.2.0.1.9
OUI version       : 11.2.0.3.0
Log file location : /opt/app/oracle/product/11.2.0/ent11.2.0.3/cfgtoollogs/opatch/opatch2012-01-18_12-16-37PM.log

org.xml.sax.SAXParseException: : XML-20108: (Fatal Error) Start of root element expected.
        at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:415)
        at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:284)
        at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:331)
        at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:293)
        at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:209)
        at oracle.sysman.oii.oiii.OiiiOracleHomeInfoXMLReader.updateHomeProperties(OiiiOracleHomeInfoXMLReader.java:86)
        at oracle.sysman.oii.oiii.OiiiInstallInventory.updateOracleHomesProperties(OiiiInstallInventory.java:803)
        at oracle.sysman.oii.oiii.OiiiInstallInventory.updateOracleHomesProperties(OiiiInstallInventory.java:781)
        at oracle.sysman.oii.oiii.OiiiInstallInventory.readHomes(OiiiInstallInventory.java:737)
        at oracle.sysman.oii.oiii.OiiiInstallAreaControl.loadPartialInstallInv(OiiiInstallAreaControl.java:776)
        at oracle.sysman.oii.oiii.OiiiInstallAreaControl.initInstallInv(OiiiInstallAreaControl.java:821)
        at oracle.sysman.oii.oiii.OiiiInstallAreaControl.loadInstallInventory(OiiiInstallAreaControl.java:592)
        at oracle.sysman.oii.oiii.OiiiInstallAreaControl.initAreaControl(OiiiInstallAreaControl.java:1977)
        at oracle.sysman.oii.oiii.OiiiInstallAreaControl.initAreaControl(OiiiInstallAreaControl.java:1930)
        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:301)
        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:240)
        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:189)
        at oracle.opatch.OUIInventorySession.initSession(OUIInventorySession.java:63)
        at oracle.opatch.OUISessionManager.setupSession(OUISessionManager.java:150)
        at oracle.opatch.OUISessionManager.lockCentralInventory(OUISessionManager.java:267)
        at oracle.opatch.OUISessionManager.instantiate(OUISessionManager.java:87)
        at oracle.opatch.OUISessionManager.updateOPatchEnvironment(OUISessionManager.java:661)
        at oracle.opatch.InventorySessionManager.updateOPatchEnvironment(InventorySessionManager.java:91)
        at oracle.opatch.OPatchSession.main(OPatchSession.java:1661)
        at oracle.opatch.OPatch.main(OPatch.java:653)
No matter which Oracle home was choosen the same error came up.

Two metalink notes related to the issue are
OPatch Is Failing With "org.xml.sax.SAXParseException" XML-20108: (Fatal Error) [ID 1365569.1]
Opatch command throws warning:org.xml.sax.SAXParseException: : XML-20108: (Fatal Error) Start of root element expected. [ID 1344580.1]

Issue mentioned in the first metalink note isn't the case here as the opatch version matches the oracle home version.
The second one mentions if $ORACLE_HOME/inventory/ContentsXML/oraclehomeproperties.xml file is 0 bytes then this error is shown. But the size of this file in the oracle home wasn't 0 bytes
ls -l $ORACLE_HOME/inventory/ContentsXML/oraclehomeproperties.xml
-rw-rw---- 1 oracle oinstall 526 Nov 16 14:20 /opt/app/oracle/product/11.2.0/ent11.2.0.3/inventory/ContentsXML/oraclehomeproperties.xml
It seemed the cause mentioned in the second metalink note is also not the case. But checking all the homes in the server it was found that there was one oracle home (home running 11gR1) which had this file with 0 bytes. There was a cloned copy of this home on which the file wasn't 0 bytes. Copying it into the this oracle home's inventory/ContentsXML resolved this issue.

Therefore when there are multiple oracle homes in a server and if inventory/ContentsXML/oraclehomeproperties.xml file gets corrupted in at least one of them the opatch will throw the above mentioned XML parse error.