一、建表
create table myindextest (tid varchar2(50) primary key,
btext blob)
二、建索引及引數
1、中文分詞及分詞屬性設定
begin
ctx_ddl.create_preference('cnlex','chinese_lexer');
ctx_ddl.create_preference('mywordlist','basic_wordlist');
ctx_ddl.set_attribute('mywordlist','prefix_index','true');
ctx_ddl.set_attribute('mywordlist','prefix_min_length',1);
ctx_ddl.set_attribute('mywordlist','prefix_max_length',8);
ctx_ddl.set_attribute('mywordlist','substring_index','yes');
end;
2、設定中文過濾(中文編碼)
begin
ctx_ddl.create_preference('cs_filter','charset_filter');
ctx_ddl.set_attribute('cs_filter','charset','utf8');
end;
3、建立索引
create index idx_myindextest on myindextest(btext)
indextype is ctxsys.context
parameters('datastore ctxsys.direct_datastore
filter cs_filter
lexer cnlex
wordlist mywordlist');
三、查詢
1、檢視分詞情況
select * from dr$idx_myindextest$i
select * from myindextest where contains(btext,'正常')>0
四、同步 優化
begin
ctx_ddl.sync_index('idx_myindextest','2m');
end;
begin
ctx_dll.optimize_index('myidx','full');
end;
五、定時任務執行執行作業進行同步
create or replace procedure sync
is begin
execute immediate
'alter index idx_myindextest rebuild online' ||
' parameters ( ''sync'' )'
execute immediate
'alter index idx_myindextest rebuild online' ||
' parameters ( ''optimize full maxtime unlimited'' )'
end sync;
/ set serveroutput on
declare
v_job number;
begin
dbms_job.submit
( job => v_job,
what => 'sync;',
next_date => sysdate, /* default */
interval => 'sysdate + 1/720' /* = 1 day / ( 24 hrs * 30 min) = 2 mins */
); dbms_job.run ( v_job );
dbms_output.put_line ( 'submitted as job # ' || to_char ( v_job ) );
end;
批量修改資料庫某欄位內容
今天,遇到乙個問題 資料庫某欄位url記錄的為檔案存放的fpt位址,因為調整,ftp位址發生了變化,需要將資料庫中記錄的位址做相應的改動。原欄位url的內容類似於 ftp user 888 www.123.com 周杰倫 簡單愛.現在需要更改為 ftp user 666 www.456.com 周杰...
Oracle資料庫 建庫 建表空間,建使用者
oracle資料庫 建庫 建表空間,建使用者 oracle安裝完後,其中有乙個預設的資料庫,除了這個預設的資料庫外,我們還可以建立自己的資料庫。對於初學者來說,為了避免麻煩,可以用 database configuration assistant 嚮導來建立資料庫。建立完資料庫後,並不能立即在資料庫...
Oracle資料庫 建庫 建表空間,建使用者
oracle安裝完後,其中有乙個預設的資料庫,除了這個預設的資料庫外,我們還可以建立自己的資料庫。對於初學者來說,為了避免麻煩,可以用 database configuration assistant 嚮導來建立資料庫。建立完資料庫後,並不能立即在資料庫中建表,必須先建立該資料庫的使用者,並且為該使...