Instalando Oracle TEXT

Existem certos aplicativos que precisam do Oracle TEXT funcionando para a criação de alguns índices específicos.

Para obter mais informações sobre o Oracle TEXT sugiro ler a documentação da Oracle sobre isto, aqui.

Caso seu banco de dados não tenha esta função do Oracle ativada o seguinte erro ocorrerá no seu ambiente:

ORA-29833: indextype does not exist

Vamos efetuar a instalação desta função do Oracle e registrar, para que todos consigam resolver na próxima vez.
Como o Oracle TEXT é uma função especifica do Oracle, podemos instalar ele a parte com alguns pacotes do próprio Oracle, conforme abaixo:

Entre no “@ORACLE_HOMS/ctx/admin” e procure o arquivo “catctx.sql”

[root@oracle ~]# su - oracle
[oracle@oracle ~]$ cd $ORACLE_HOME/ctx/admin
[oracle@oracle admin]$ ls -lrt catctx.sql
-rw-r--r-- 1 oracle dba 5372 Oct 11 2004 catctx.sql
[oracle@oracle admin]$

Executando este sql o Oracle compila vários pacotes para funcionar o “Oracle Text”.

Logue no sqlplus e execute o “catctx.sql”

SQL> @catctx.sql
Enter value for 1: ctxsys
Enter value for 2: SYSTEM
Enter value for 3: TEMP
Enter value for 4: NOLOCK

Ao executar o comando ele irá pedir quatro valores.

Valor 1: Senha do usuário CTXSYS
Valor 2: Tablespace default do usuário — Tablespace Padrão é a SYSAUX
Valor 3: Tablespace Temporária default. — Tablespace padrão já é a TEMP
Valor 4: “NOLOCK” — Padrão para não aguardar locks
Depois deste passo, sugiro executar o UTLRP para recompilar os objetos do sys.

SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

...

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2015-02-13 14:51:34

PL/SQL procedure successfully completed.

DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
0

DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
0

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

SQL>

E depois efetuar grants para os usuários que irão utilizar o Oracle TEXT.

GRANT EXECUTE ON CTXSYS.CTX_DDL TO <usuário>;
GRANT CTXAPP TO <usuário>;

SQL> GRANT EXECUTE ON CTXSYS.CTX_DDL TO vetorh;

Grant succeeded.

SQL> GRANT CTXAPP TO vetorh;

Grant succeeded.

SQL>

Após isto você pode criar o índice normalmente.

SQL> create index test_text on test(COL1) indextype is ctxsys.CONTEXT;

Index created.

Foi testado na versão 10.x e 11.x Ainda não testado na versão 12.

%name Instalando Oracle TEXT

Autor: Leandro Lana

Trabalho com banco de dados Oracle desde 2006, já trabalhei com as plataformas 9i, 10G, 11G, 12C, 18C, 19C e 21(ainda em testes).

Trabalhando atualmente como consultor Oracle na MigraTI Soluções em TI como administrador de banco de dados Oracle, SQL-Server, MySQL e Postgresql.

Contato: leandro.lana@migrati.com.br

Fone: (47) 9191-6052 / (47) 3328 0996

Certificações:

OCA 10G.

OCP 10G.

OCE Linux.

OCE RAC/Cluster.

MCP SQL-Server 2008.

MCITP SQL-Server 2008.

DB2 Fundamentals.