Oracle 簇的使用詳解建站知識
導讀:1建站知識本篇文章是對Oracle中簇的使用進行了詳細的分析介紹,需要的朋友參考下營銷型網站建設企業網站建設。
簇其實就是一組表,由一組共享相同數據塊的多個表組成,將經常一起使用的表組合在一起成簇可以提高處理效率;在一個簇中的表就叫做簇表。建立順序是:簇→簇表→簇索引→數據創建簇的格式CREATE CLUSTER cluster_name(column date_type [,column datatype]...)[PCTUSED 40 | integer] [PCTFREE 10 | integer][SIZE integer][INITRANS 1 | integer] [MAXTRANS 255 | integer][TABLESPACE table網站建設哪家好space][STORAGE storage]SIZE:指定估計平均簇鍵,以及與其相關的行所需的字節數。1、創建簇
復制代碼 代碼如下:
create cluster my_clu (deptno number ) pctused 60 pctfree 10 size 1024 tablespace users storage ( initial 128 k next 128 k minextents 2 maxextents 20 );
2、創建簇表復制代碼 代碼如下:
create table t1_dept( deptno number , dname varchar2 ( 20 ) ) cluster my_clu(deptno); create table t1_emp( empno number , ename varchar2 ( 20 ), birth_date date , deptno number ) cluster my_clu(deptno);
3、為簇創建索引復制代碼 代碼如下:
create index clu_index on cluster my_clu;
注:若不創建簇索引,則在插入數據時報錯:ORA-02032: clustered tables cannot be used before the cluster index is built管理簇使用ALTER修改簇屬網站建設性(必須擁有ALTER ANY CLUSTER的權限)1、修改簇屬性可以修改的簇屬性包括:* PCTFREE、PCTUSED、INITRANS、MAXTRANS、STORAGE* 為了存儲簇鍵值所有行所需空間的平均值SIZE* 默認并行度注:* 不能修改INITIAL和MINEXTENTS的值* PCTFREE、PCTUSED、SIZE參數修改后適用于所有數據塊* INITRANS、MAXTRANS僅適用于以后分配的數據塊* STORAGE參數修改后僅影響以后分配給簇的盤區例:復制代碼 代碼如下:
alter cluster my_clu pctused 40
2、刪除簇復制代碼 代碼如下:
drop cluster my_clu; -- 僅適用于刪除空簇 drop cluster my_clu including tables ; -- 刪除簇和簇表 drop cluster my_clu including tables cascade constraints ;--同時刪除外鍵約束
注:簇表可以像普通表一樣刪除。3、清空簇復制代碼 代碼如下:
truncate cluster my_clu;
注:所有在此簇上的表的數據全部被清空散列聚簇表在簇表中,Oracle使用存儲在索引中的鍵值來定位表中的行,而在散列聚簇表中,使用了散列函數代替了簇索引,先通過內部函數或者自定義的函數進行散列計算,然后再將計算得到的碼值用于定位表中的行。創建散列簇需要用到HASHKEYS子句。1、創建散列簇復制代碼 代碼如下:
create cluster my_clu_two(empno number(10) ) pctused 70 pctfree 10 tablespace users hash is empno hashkeys 150 ;
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-05-24 ,文章Oracle 簇的使用詳解建站知識主要講述詳解,標簽,Oracle 簇的使用詳解建站知識1網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_6661.html