立即注册 登录
炼数成金 返回首页

雷子的个人空间 http://f.dataguru.cn/?29740 [收藏] [复制] [分享] [RSS]

日志

创建全文索引

已有 5272 次阅读2013-6-1 08:27 |个人分类:oracle| oracle, 索引

SQL> create index ind_t2 on t2(object_id) indextype is ctxsys.context;
create index ind_t2 on t2(object_id) indextype is ctxsys.context
                                                         *
ERROR at line 1:
ORA-29833: indextype does not exist


1、创建表空间、用户信息及角色
SQL> create tablespace ctxsys
  2  logging
  3  datafile 'E:\ORACLE\ORADATA\LSL\ctxsys01.dbf'
  4  size 32M
  5  autoextend on
  6  next 32M maxsize 2048M
  7  extent management local;

Tablespace created.
SQL> create user ctxsys identified by ctxsys default tablespace ctxsys;

User created.

SQL> create role CTXAPP;

Role created.

SQL> conn sys/oracle as  sysdba
Connected.
SQL> grant dba to ctxsys;

Grant succeeded.

2,初始化全文索引功能
SQL> start ?\ctx\admin\catctx.sql
...........
......
SQL> start ?\ctx\admin\defaults\drdefus.sql
Creating lexer preference...

PL/SQL procedure successfully completed.

Creating wordlist preference...

PL/SQL procedure successfully completed.

Creating stoplist...

PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.

Creating default policy...

PL/SQL procedure successfully completed.

3、创建全文索引
SQL> create index ind_t2 on t2(object_id) indextype is ctxsys.context;
create index ind_t2 on t2(object_id) indextype is ctxsys.context
*
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-10509: invalid text column: OBJECT_ID
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 366


SQL> show parameter O7_DICTIONARY_ACCESSIBILITY;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
O7_DICTIONARY_ACCESSIBILITY          boolean     FALSE
SQL> alter system set O7_DICTIONARY_ACCESSIBILITY=true scope =spfile;

System altered.

SQL> show user;
USER is "TEST"
SQL> conn sys/oracle as sysdba
Connected.
SQL> alter system set O7_DICTIONARY_ACCESSIBILITY=true scope =spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  313159680 bytes
Fixed Size                  2175328 bytes
Variable Size             188747424 bytes
Database Buffers          117440512 bytes
Redo Buffers                4796416 bytes
Database mounted.
Database opened.
SQL> create index ind_t2 on t2(object_id) indextype is ctxsys.context;
create index ind_t2 on t2(object_id) indextype is ctxsys.context
*
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-10509: invalid text column: OBJECT_ID
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 366


SQL> show parameter O7_DICTIONARY_ACCESSIBILITY;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
O7_DICTIONARY_ACCESSIBILITY          boolean     TRUE
SQL>
-----
全文索引的思想就是语言的分词,数字肯定不适合的。因此会报invalid text column: OBJECT_ID
------------------
4、同步全文索引

exec ctx_ddl.sync_index('索引名', '20M');


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

 

GMT+8, 2019-5-24 23:30 , Processed in 0.080110 second(s), 20 queries .