【转】How to Deinstall and Reinstall XML Database (XDB) [ID 243554.1]

Applies to:
Oracle Server - Enterprise Edition - Version: 9.2.0.1 to 10.2.0.5 - Release: 9.2 to 10.2
Oracle Server - Personal Edition - Version: 9.2.0.1 to 10.2.0.5   [Release: 9.2 to 10.2]
Oracle Server - Standard Edition - Version: 9.2.0.1 to 10.2.0.5   [Release: 9.2 to 10.2]
Information in this document applies to any platform.
Purpose

This article provides the steps to manually deinstall and install the XML Database feature into a database that is version 9i R2 through 10g release 2.  THIS NOTE IS NOT FOR 11G and above.
WARNING FOR ALL READERS: If the XML DB features are currently being utilized and you have experienced an invalid XML DB repository or installation, point-in-time recovery to a point prior to when the problem occurred is recommended. XDB should not be reinstalled if the feature is being used. Please confirm whether XDB is being used in your environment prior to attempting reinstall.  In addition, the following DB features also use XDB: Oracle Intermedia EXIF metadata, Oracle GEORASTER, EXFSYS, Oracle Locator

If directed to this note for an 11g case by accident please review the following items. Please not this only applies to release 11.1.0.1.0 and above.

Is there anything else I should know about binary XMLType?

When you create a binary XMLType the data is stored is a proprietary format on disk that represents a post parse persistence model. In doing this we have the need to store information about how to transverse the XML data without having to parse it again. The data that we store in order to accomplish this is maintained in dictionary type tables in the XDB user schema, not in the user schema of the user that created the table. What this means is that if you are ever directed to remove and reinstall the XDB feature with the catqnoqm.sql and catqm.sql scripts, that you must verify that you do not have any XMLType tables and/or columns that are stored as binary. The removal scripts drop the XDB user and in turn lose this information. As an additional item this section also applies to schema base XMLType tables and/or columns so the code block will check for those as well.



conn / as sydba
--
-- Check the storage of XMLType tables.
--
SELECT OWNER, TABLE_NAME
FROM DBA_XML_TABLES
where STORAGE_TYPE in('OBJECT-RELATIONAL','BINARY');

-- A default seed database with the example schemas installed
-- will have ones owned by XDB,MDSYS and OE.
--
-- Check the storage of XMLType columns.
--
SELECT OWNER, TABLE_NAME
from DBA_XML_TAB_COLS
where STORAGE_TYPE in('OBJECT-RELATIONAL','BINARY');

-- A default seed database with the example schemas installed
-- will have ones owned by XDB,MDSYS,ORDDATA,APEX_030200 and OE.
-- Please see the following section as it relates to ORDDATA and APEX_030200.

What if the database is using the DICOM and/or Oracle Applications Express(APEX) features?

If the above code block has objects owned by ORDDATA and/or APEX_030200 it means the features are installed in the database. If you are using these items in a production capacity then you can not remove and reinstall the XDB feature because if the aforementioned loss of data that is maintained in the XDB user schema.


Scope and Application

This article is for DBA's that need to remove, install and/or reinstall the XDB feature into an existing Oracle database.
How to Deinstall and Reinstall XML Database (XDB)

XDB Reload Procedures for 10.2 and above.
SQL> conn / as sysdba
SQL> Shutdown Immediate;
SQL> Startup upgrade;
SQL> @?/rdbms/admin/xdbrelod.sql
alternatively xdbpatch.sql can be run both xdbpatch and xdbrelod perform the same actions.SQL> Shutdown Immediate;
SQL> Startup
SQL> @?/rdbms/admin/utlrp.sql

Then check the error conditions that necessitated the steps in the first place. If the error condition is not resolved consider point in time recovery back to before the error state existed. If that is not an option proceed to removal and reinstall if on version 10.2 and below and you have read all the warnings.

XDB SCHEMA REMOVAL STEPS:

WARNING: The steps to remove the XML Database feature (XDB schema) will completely remove the XDB repository including any user defined information contained within it.
Therefore, if there are any registered schemas or XML Database items created, you will be required to recreate all of your user defined structures, data and re-register all schemas previously registered.

If you are running Oracle Applications with iSetup see NOTE:402785.1 linked below.

WARNING: If you are on database release 10.1.x or 10.2.x the XDB Feature is Mandatory in order to use any of the member functions of the XMLTYPE. This is true even if you are not using the repository , or registered schema aspects of the XDB feature.

WARNING: This is not for 11g.

1. Shutdown and restart the database.

2. Connect as sysdba and run the catnoqm.sql script. Maintain a spool of the
script running:

UNIX: $ORACLE_HOME/rdbms/admin subdirectory
WINDOWS: $ORACLE_HOME\rdbms\admin subdirectory

For Example:
SQL> set echo on
SQL> spool xdb_removal.log
SQL> @?/rdbms/admin/catnoqm.sql


3. Modify the init.ora file or spfile to include the following minimums to prepare the DB for reinstalling the XDB schema:

shared_pool_size =150M
java_pool_size =150M

4. Turn on AUTO EXTEND on the XDB tablespace.
If you do not want to do this , make sure you target a tablespace with at
least
.100 MB of free space for non-UTF8 DB
.150 MB of free space for an AL32UTF8 DB

5. Shutdown the database immediate, and startup the database normal

NOTE: Failure to restart the database at this step can cause XDB catqm.sql installation to fail with an internal error similar to the following: ORA-7445 [qmr_hdl_copy()+48]


XDB SCHEMA INSTALL STEPS:


1. Connect as sysdba and run the catqm.sql script. Maintain a spool of the
script running:

UNIX: $ORACLE_HOME/rdbms/admin subdirectory
WINDOWS: $ORACLE_HOME\rdbms\admin subdirectory

The catqm.sql script requires the following parameters be passed to it when
run:
A. XDB user password
B. XDB user default tablespace  (You can use any tablespace other than system undo and temp. This tablespace has to exist prior to running the script.)
C. XDB user temporary tablespace
Therefore the syntax to run catqm.sql will be:
SQL> catqm.sql A B C

For Example:
SQL> set echo on
SQL> spool xdb_install.log
SQL>@?/rdbms/admin/catqm.sql XDB XDB TEMP



The Following Step is for Release 9.2.x ONLY skip to step 3 if running 10.1.x or above

2.Reconnect to SYS again and run the following to load the XDB java library.

SQL>@?/rdbms/admin/catxdbj.sql

NOTE: In order to load the XDB java libraries in catxdbj.sql, you must first have a valid Java Virtual Machine installation in the DB (JVM) and a valid XDK.
Also, make sure that the database is started with Oracle9i Release 2 (9.2.0) compatibility or higher for database version 9.2. This script creates objects that are specific to 9.2 even though the the database requires the JVM in 10.1 and above, the itmes that the script creates are no longer built in java in 10.1 and above.


3. If the following line is not already apart of the database system parameters (init.ora/spfile).
NOTE: PLEASE REPLACE ,instanceid1,2 etc with your actual values

a. Non-RAC
dispatchers="(PROTOCOL=TCP) (SERVICE=<SID>XDB)"
b. RAC
instanceid1.dispatchers="(PROTOCOL=TCP) (SERVICE=<SID>XDB)"
instanceid2.dispatchers="(PROTOCOL=TCP) (SERVICE=<SID>XDB)"
etc ...
c.If you are not using the default Listener ensure you have set LOCAL_LISTENER in the (init.ora/spfile)
as prescribed for RAC/NON-RAC instances or the end points will not register.


4. Check for any invalid XDB owned objects:

SQL> select count(*) from dba_objects
where owner='XDB' and status='INVALID';

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



5. Check DBA_REGISTRY for XDB status:
SQL> select comp_name, status, version from DBA_REGISTRY where comp_name=
'Oracle XML Database'

The results should indicate the correct version and patch in a valid status.

6. Restart database and listener to enable Oracle XML DB protocol access.



NOTE:

If for any reason the catqm.sql script fails you can repeat the steps. However doing so May result in :

ORA-04098: trigger 'SYS.XDB_INSTALLATION_TRIGGER' is invalid and failed re-validation

If this occurs follow the steps in article:

NOTE:331378.1 - Running catqm.sql Leads to ORA-4098 Trigger 'SYS.XDB_INSTALLATION_TRIGGER' is Invalid


你可能感兴趣的:(jvm,oracle,sql,xml,SQL Server)