Tuesday, June 17, 2014

Oracle Text errors when your DB installed manually. ORA-04063: package body "CTXSYS.DRIXMD" has errors. ORA-06508: PL/SQL: ORA-06512:

In default installed Oracle Database, there will be Oracle Text by default.
If you have tried to run something like the following and you got an error, 

SQL>execute ctxsys.ctx_adm.set_parameter('file_access_role','some_access_role');
BEGIN ctxsys.ctx_adm.set_parameter('file_access_role','some_access_role'); END;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'CTXSYS.CTX_ADM' must be declared
ORA-06550: line 1, column 7:

PL/SQL: Statement ignored

that means the most likely you don't have Oracle Text installed in your database. Usually it happens when your database is installed and configured manually.

You need to check the status of CTXSYS schema and its objects:
1. sqlplus / as sysdba
2. select status from dba_registry where comp_id='CONTEXT' and schema='CTXSYS';

3.select object_name, object_type, status from dba_objects where owner='CTXSYS' and status != 'VALID' order by object_name;

4.select comp_name, status, substr(version,1,10) as version from dba_registry where comp_id = 'CONTEXT';

You may see INVALID statuses.

If you don't have CTXSYS schema, you need to install Oracle Text as following:

1. Sqlplus / as sysdba
2. @$ORACLE_HOME/ctx/admin/catctx.sql password sysaux temp NOLOCK
3. connect CTXSYS/password
4. @$ORACLE_HOME/ctx/admin/default/drdefus.sql

If you got an error as:
begin
*
ERROR at line 1:
ORA-04063: package body "CTXSYS.DRIXMD" has errors
ORA-06508: PL/SQL: could not find program unit being called: "CTXSYS.DRIXMD"
ORA-06512: at "CTXSYS.CTX_DDL", line 52
ORA-06512: at line 13
....
.....
begin
*
ERROR at line 1:
ORA-04063: package body "CTXSYS.DRIXMD" has errors
ORA-06508: PL/SQL: could not find program unit being called: "CTXSYS.DRIXMD"
ORA-06512: at "CTXSYS.DRUE", line 145
ORA-06512: at "CTXSYS.CTX_DDL", line 1143
ORA-04063: package body "CTXSYS.DRIXMD" has errors
ORA-06508: PL/SQL: could not find program unit being called: "CTXSYS.DRIXMD"
ORA-06512: at line 2

that would mean problem with right privileges.

The exact problem is that PUBLIC does not have execute on some DBMS_..packages and those are required by Oracle Text.

To fix it, do followings:
 1. Sqlplus / as sysdba
2. grant execute on DBMS_SCHEDULER to PUBLIC;
3. grant execute on DBMS_JOB to PUBLIC;
4. grant execute on UTL_FILE to PUBLIC;
5. grant execute on UTL_HTTP to PUBLIC;

Now deinstall/install Oracle Text and if you try to execute the packages related to Oracle Text, it should ok:
1. conn / as sysdba
2. @ORACLE_HOME/ctx/admin/catnoctx.sql
(it will remove Oracle Text)
3. drop procedure sys.validate_context;
4. $ORACLE_HOME/ctx/admin/catctx.sql password sysaux temp NOLOCK
(installing it again. You can choose any password. Here, I put just 'password')
5. connect CTXSYS/password
6. @$ORACLE_HOME/ctx/admin/default/drdefus.sql
7. conn / as sysdba
8. alter user CTXSYS account lock;

Happy no problem environment!

No comments:

Post a Comment