Oracle创建表空间/表分区

来源:互联网 发布:js 刷新本页 编辑:程序博客网 时间:2024/06/10 05:55

---创建表分区

Create TableSpace ts_demo

datafile '+Oracle2/oracle/datafile/xltsdemo.dbf'

size 500m --初始大小

autoextend on --可以自动扩展

next 50m --一次扩展50m

maxsize unlimited --扩展没有限制

----创建数据库表

Create table table_demo

(

    stuId number not null,

    stuName varchar(20) not null,

    stuAddress varchar(20) not null,

    stuAge number(10) not null,

    stuCollege varchar(20) null

) partition  by range(stuId)---按照stuId 分区

(

  --创建表分区:使用partition关键字

  partition part_01 values  less than (100) tablespace ts_demo,

  partition part_02 values  less than (200) tablespace ts_demo,

  partition part_03 values  less  than (300) tablespace ts_demo,

  partition part_04 values  less  than (400) tablespace ts_demo,

  partition part_05 values  less  than  (500) tablespace ts_demo,

  partition part_06 values  less  than  (600)  tablespace ts_demo,

  partition part_07 values  less  than (maxvlue)  tablespace ts_demo

);

 

----删除白空间,包括空间下的表盒表分区

drop tablespace ts_demo inclued content;

----把数据导入到表空间中

load data

infile 'D:txtfile.txt'--要导入的文件

into table table_demo  --指定要装入的表

insert  fileds tempindata by '|'

Trailing  nullcols --表的字段没有对应的值时为空 

(

   stuId,stuName,stuAddress,stuAge

)

原创粉丝点击