create table users( username varchar2(20) not null, passwd varchar2(10) not null, name varchar2(20) not null, groupname varchar(20) not null, chinaid number(8) not null, http varchar2(30) not null, post varchar2(30) not null, descript varchar2(200) not null , constraint PK_USERS primary key (username) ) partition by range(to_number(username,'99999999')) ( partition users01 values less than (100000) tablespace us1, partition users02 values less than (200000) tablespace us2, partition users03 values less than (300000) tablespace us3, partition users04 values less than (400000) tablespace us4, partition users05 values less than (5000000) tablespace us5, partition users06 values less than (MAXVALUE) tablespace us6 );
先看一看: create table users( userid number not null, username varchar2(20) not null, passwd varchar2(10) not null, name varchar2(20) not null, groupname varchar(20) not null, chinaid number(8) not null, http varchar2(30) not null, post varchar2(30) not null, descript varchar2(200) not null , constraint PK_USERid primary key (userid) )
详细说一说你的需求和使用下面语句的理由, partition by range(to_number(username,'99999999')) ( partition users01 values less than (100000) tablespace us1, partition users02 values less than (200000) tablespace us2, partition users03 values less than (300000) tablespace us3, partition users04 values less than (400000) tablespace us4, partition users05 values less than (5000000) tablespace us5, partition users06 values less than (MAXVALUE) tablespace us6 );
create table users( username varchar2(20) not null, passwd varchar2(10) not null, name varchar2(20) not null, groupname varchar(20) not null, chinaid number(8) not null, http varchar2(30) not null, post varchar2(30) not null, descript varchar2(200) not null , constraint PK_USERS primary key (username) ) partition by range(username) ( partition users01 values less than ('100000') tablespace us1, partition users02 values less than ('200000') tablespace us2, partition users03 values less than ('300000') tablespace us3, partition users04 values less than ('400000') tablespace us4, partition users05 values less than ('500000') tablespace us5, partition users06 values less than (MAXVALUE) tablespace us6 );
username varchar2(20) not null,
passwd varchar2(10) not null,
name varchar2(20) not null,
groupname varchar(20) not null,
chinaid number(8) not null,
http varchar2(30) not null,
post varchar2(30) not null,
descript varchar2(200) not null ,
constraint PK_USERS primary key (username)
)
partition by range(to_number(username,'99999999'))
(
partition users01 values less than (100000) tablespace us1,
partition users02 values less than (200000) tablespace us2,
partition users03 values less than (300000) tablespace us3,
partition users04 values less than (400000) tablespace us4,
partition users05 values less than (5000000) tablespace us5,
partition users06 values less than (MAXVALUE) tablespace us6
);
create table users(
userid number not null,
username varchar2(20) not null,
passwd varchar2(10) not null,
name varchar2(20) not null,
groupname varchar(20) not null,
chinaid number(8) not null,
http varchar2(30) not null,
post varchar2(30) not null,
descript varchar2(200) not null ,
constraint PK_USERid primary key (userid)
)
partition by range(to_number(username,'99999999'))
(
partition users01 values less than (100000) tablespace us1,
partition users02 values less than (200000) tablespace us2,
partition users03 values less than (300000) tablespace us3,
partition users04 values less than (400000) tablespace us4,
partition users05 values less than (5000000) tablespace us5,
partition users06 values less than (MAXVALUE) tablespace us6
);
要分区,记录在1000万以上才有比较明显的优势你也可以采用hash分区
username varchar2(20) not null,
passwd varchar2(10) not null,
name varchar2(20) not null,
groupname varchar(20) not null,
chinaid number(8) not null,
http varchar2(30) not null,
post varchar2(30) not null,
descript varchar2(200) not null ,
constraint PK_USERS primary key (username)
)
partition by range(username)
(
partition users01 values less than ('100000') tablespace us1,
partition users02 values less than ('200000') tablespace us2,
partition users03 values less than ('300000') tablespace us3,
partition users04 values less than ('400000') tablespace us4,
partition users05 values less than ('500000') tablespace us5,
partition users06 values less than (MAXVALUE) tablespace us6
);
您好:
上面的用法可行吗?
不知您是否试过!
等您回音!
[email protected]
1 create table users_1(
2 username varchar2(20) not null,
3 passwd varchar2(10) not null,
4 name varchar2(20) not null,
5 groupname varchar(20) not null,
6 chinaid number(8) not null,
7 http varchar2(30) not null,
8 post varchar2(30) not null,
9 descript varchar2(200) not null ,
10 constraint PK_USERS primary key (username)
11 )
12 partition by range(username)
13 (
14 partition users01 values less than ('100000') tablespace users,
15 partition users02 values less than ('200000') tablespace users,
16 partition users03 values less than ('300000') tablespace users,
17 partition users04 values less than ('400000') tablespace users,
18 partition users05 values less than ('500000') tablespace users,
19 partition users06 values less than (MAXVALUE) tablespace users
20* )
SQL> /表已建立.SQL> drop table users_1;表已删除.