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 tablespace]
[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

原文地址:https://www.cnblogs.com/feiyun126/p/3161098.html