Skip Headers

Oracle® Text Application Developer's Guide
10g Release 1 (10.1)

Part Number B10729-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

11 Migrating Applications from Earlier Releases

This chapter covers issues relating to migrating your applications from previous releases of Oracle Text. It also contains a note on migrating back from the current release.

11.1 Security Improvements in Oracle Text

In previous versions of Oracle Text, CTXSYS had DBA privileges. To tighten security and protect the database in the case of unauthorized access, CTXSYS now has only CONNECT and RESOURCE roles, and only limited, necessary direct grants on some system views and packages. Some applications using Oracle Text may therefore require minor changes in order to work properly with this security change. Here are the major effects of the security improvements, their possible effects on Oracle Text applications, and the steps needed to ensure proper operation in Oracle Database 10g.

11.1.1 CTXSYS No Longer Has DBA Permissions

CTXSYS no longer has DBA permissions. This may affect indexes using USER_DATASTORE, PROCEDURE_FILTER, or USER_LEXER objects. For example, suppose that you have an index using a USER_DATASTORE whose procedure is CTXSYS.PROC, and that that procedure refers to other schemas' objects:

create procedure proc(r in rowid, d in out nocopy clob)
is
begin
  select text into l_data from scott.example ...

Previously, this user datastore would have worked properly because CTXSYS was able to select from any table—namely, SCOTT.EXAMPLE. However, in Oracle Database 10g, CTXSYS does not have DBA privileges and is not allowed to select from SCOTT.EXAMPLE. This makes the procedure PROC invalid, which leads to errors when indexing or sync is done for this index.

To resolve this problem, Oracle recommends migrating all user datastores, procedure filters, and user lexers from CTXSYS-owned procedures to index-owner-owned procedures (see "Migrating CTXSYS-Owned Procedures").

11.1.2 Migrating CTXSYS-Owned Procedures

Here are the steps to migrate an index using a CTXSYS-owned procedure to use an index-owner-owned procedure:

  1. Create a procedure owned by the index owner that is equivalent to the CTXSYS-owned procedure. If your application's CTXSYS-owned procedure simply calls another procedure owned by the index owner, use that procedure for step 2. Otherwise, copy the code from the CTXSYS-owned procedure into a new procedure owned by the index owner, making any needed changes for the change in schema.

  2. Create a new user datastore, procedure filter, or user lexer preference that uses the index-owner-owned procedure. Alternatively, you can modify the existing preference using CTX_DDL.SET_ATTRIBUTE, if the preference used to create the index still exists.

  3. Replace the existing datastore or filter or lexer with the new, updated preference using the new REPLACE METADATA command. For instance, to replace a user datastore:

    alter index <myindex> rebuild parameters ('replace metadata datastore <new_datastore_preference>');
    
    

    REPLACE METADATA does not rebuild the index, so this command will not affect existing index data.

11.1.3 Effective User During Indexing

In previous versions of Oracle Text, the effective user during indexing or sync was CTXSYS. As a result, CTXSYS required execute permission on all BFILE directories, execute permission on any procedures called from user datastores, procedure filters, or user lexers, and the CTXSYS user's TEMP tablespace was used during indexing. In Oracle Database 10g, the effective user during indexing is the index owner, which eliminates these caveats.

11.1.4 Procedures Do Not Need to Be Owned by CTXSYS

Previously, procedures used in user datastores, procedure filters, and user lexers had to be owned by CTXSYS. In Oracle Database 10g, these procedures can be owned by any schema, so long as the index owner has execute privileges on them.

This principally affects creation of preferences. In previous releases of Oracle Text, a user datastore created with:

beginctx_ddl.create_preference('example','user_datastore');ctx_ddl.set_attribute('example','procedure','proc');end;

would have used the procedure CTXSYS.PROC. However, in Oracle Database 10g, standard Oracle Database rules are applied to the input "PROC," and this resolves to USER.PROC. Any application code that creates user datastores, procedure filters, or user lexers should either create the preferences as the owner of the procedure, or prepend the correct owner name to the procedure name. For example:

ctx_ddl.set_attribute('example','procedure','user.proc');

11.1.5 Synching and Optimizing of Other Users' Indexes

In previous versions of Oracle Text, only the owner of the index and CTXSYS were allowed to sync or optimize an index through CTX_DDL.SYNC_INDEX and CTX_DDL.OPTIMIZE_INDEX. In Oracle Database 10g, any user with the ALTER ANY INDEX system privilege is also allowed to sync or optimize any index.

11.1.6 CTX Packages and Invoker's Rights

Most public CTX packages, such as CTX_DDL, CTX_QUERY, and CTX_REPORT, are now invoker's rights packages.

11.1.7 CREATE TABLE Permissions

In Oracle Database 10g, if a text index is created by one user for another user, or if the create index statement is issued from a PL/SQL block, the index owner must be granted the CREATE TABLE privilege in order for the indexing to succeed. Even if the index owner has the RESOURCE role, CREATE TABLE must be specifically granted.

11.2 Migrating Back to Previous Releases

During the upgrade to Oracle Database 10g, Oracle Text drops a number of procedures belonging to CTXSYS. (These procedures are invalid under Oracle Database 10g and have the name format DR$indexid$U.) If you migrate back to a pre-10g release of Oracle Database, you must re-create these procedures in order for DML to work. To do this, after the backward migration—once all the pre-10g packages have been reinstalled—rename each CTXCAT index; the rename code will re-create that procedure. (You can rename the procedures back if you want to retain the original names).