搜尋
首頁資料庫mysql教程演示一个带有全文索引表的分区交换例子

一、实验说明: 操作系统:rhel 5.4 x86 数据库:Oracle 11g R2 实验说明:该实验参照了谭老师的《让Oracle跑的

一、实验说明:

      操作系统:rhel 5.4 x86

      数据库:Oracle 11g R2

      实验说明:该实验参照了谭老师的《让Oracle跑的更快2》中的一个案例。

二、在数据库中创建带加载数据的分区表及索引

----------创建一个包含3个分区的分区表,分区的字段是一个时间字段,分别存放2011年、2012年和之后的数据。-----
SQL> create table jack_test(id int,name varchar2(60),created date)
  2  partition by range(created)
  3  (
  4  partition p2011 values less than(to_date('2012-01-01','yyyy-mm-dd')),
  5  partition p2012 values less than(to_date('2013-01-01','yyyy-mm-dd')),
  6  partition pmax values less than (maxvalue)
  7  );

Table created.
 ----------创建全文索引----------------------------------------------------------------------

SQL> create index jack_test_ind on jack_test(name) indextype is ctxsys.context local;

Index created.

三、在数据库中创建临时表

----------创建一个和jack_test表结构完全相同的临时表jack_test,只是它不是分区表,临时表上暂时不需要创建索引-------jack_temp
3 Table created.

四、由程序将待加载的数据写成固定格式的文件

---------下面是sqlldr的一个控制文件-------------------------
[oracle@node2 jack]$ vi jack_test_2011.ctl

OPTIONS (DIRECT=TRUE)
LOAD DATA
INFILE '/home/oracle/jack/jack_test_2011.dat'
BADFILE '/home/oracle/jack/jack_test_2011.bad'
DISCARDFILE '/home/oracle/jack/jack_test_2011.dsc'
APPEND INTO TABLE jack_temp
(id TERMINATED BY WHITESPACE,
 name TERMINATED BY WHITESPACE,
 created DATE "YYYY-MM-DD HH24:MI:SS" TERMINATED BY WHITESPACE)

 ----------下面是需要加载的格式文件中的部分数据--------------------------
[oracle@node2 jack]$ more jack_test_2011.dat
13628    index    2011-6-8
13629    index    2011-6-8
13630    index    2011-6-8
13631    index    2011-6-8
13632    index    2011-6-8
13633    index    2011-6-8
13634    index    2011-6-8
13635    index    2011-6-8
13636    index    2011-6-8
13637    index    2011-6-8
13638    index    2011-6-8
13639    index    2011-6-8
13640    index    2011-6-8
13641    index    2011-6-8
13642    index    2011-6-8
13643    index    2011-6-8

五、使用SQL*Loader将文件装载入临时文件中

-------------开始加载数据---------------------------------------------------
[oracle@node2 jack]$ sqlldr jack/jack control=jack_test_2011.ctl

SQL*Loader: Release 11.2.0.1.0 - Production on Tue Dec 25 14:59:25 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


Load completed - logical record count 27381.

 ---------------验证是否加载成功-----------------------------
SQL> set linesize 150;
SQL> set pagesize 100;
SQL> select * from jack_test where rownum

no rows selected

SQL> select * from jack_temp where rownum

    ID NAME                            CREATED
---------- ------------------------------------------------------------ ---------
    13628 index                            08-JUN-11
    13629 index                            08-JUN-11
    13630 index                            08-JUN-11
    13631 index                            08-JUN-11
    13632 index                            08-JUN-11
    13633 index                            08-JUN-11
    13634 index                            08-JUN-11
    13635 index                            08-JUN-11
    13636 index                            08-JUN-11

9 rows selected.

SQL> select count(*) from jack_temp;

  COUNT(*)
----------
    27378

SQL> select count(*) from jack_test partition (p2011);

  COUNT(*)
----------
    0

SQL> select count(*) from jack_test;

  COUNT(*)
----------
    0

六、在临时表中创建全文索引和其他需要的索引

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
在MySQL中使用視圖的局限性是什麼?在MySQL中使用視圖的局限性是什麼?May 14, 2025 am 12:10 AM

mysqlviewshavelimitations:1)他們不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinsOrsubqueries.2)他們canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

確保您的MySQL數據庫:添加用戶並授予特權確保您的MySQL數據庫:添加用戶並授予特權May 14, 2025 am 12:09 AM

porthusermanagementinmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

哪些因素會影響我可以在MySQL中使用的觸發器數量?哪些因素會影響我可以在MySQL中使用的觸發器數量?May 14, 2025 am 12:08 AM

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)複雜的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

mysql:存儲斑點安全嗎?mysql:存儲斑點安全嗎?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

mySQL:通過PHP Web界面添加用戶mySQL:通過PHP Web界面添加用戶May 14, 2025 am 12:04 AM

通過PHP網頁界面添加MySQL用戶可以使用MySQLi擴展。步驟如下:1.連接MySQL數據庫,使用MySQLi擴展。 2.創建用戶,使用CREATEUSER語句,並使用PASSWORD()函數加密密碼。 3.防止SQL注入,使用mysqli_real_escape_string()函數處理用戶輸入。 4.為新用戶分配權限,使用GRANT語句。

mysql:blob和其他無-SQL存儲,有什麼區別?mysql:blob和其他無-SQL存儲,有什麼區別?May 13, 2025 am 12:14 AM

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而ilenosqloptionslikemongodb,redis和calablesolutionsolutionsolutionsoluntionsoluntionsolundortionsolunsonstructureddata.blobobobissimplobisslowdeperformberbutslowderformandperformancewithlararengedata;

mySQL添加用戶:語法,選項和安全性最佳實踐mySQL添加用戶:語法,選項和安全性最佳實踐May 13, 2025 am 12:12 AM

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

MySQL:如何避免字符串數據類型常見錯誤?MySQL:如何避免字符串數據類型常見錯誤?May 13, 2025 am 12:09 AM

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollat​​ionsEttingSefectery.1)usecharforfixed lengengtrings,varchar forvariable-varchar forbariaible length,andtext/blobforlargerdataa.2 seterters seterters seterters

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

EditPlus 中文破解版

EditPlus 中文破解版

體積小,語法高亮,不支援程式碼提示功能

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

Atom編輯器mac版下載

Atom編輯器mac版下載

最受歡迎的的開源編輯器