如果你实在是不会写,也可以用向导的。
在oracle studio中,有建立分区表的向导,很简单,可以自己生成sql语句。
分区表建立好以后,数据是oracle自己确定往哪个分区中存放的,你只需要往表中插入数据就可以。
读取数据的时候,只要你的where条件中有分区索引作为条件,oracle也会自动到该分区去找数据,速度就快多了。
以前我用也一个表,里面有2亿数据,就是用的分区表来保存的。
在oracle studio中,有建立分区表的向导,很简单,可以自己生成sql语句。
分区表建立好以后,数据是oracle自己确定往哪个分区中存放的,你只需要往表中插入数据就可以。
读取数据的时候,只要你的where条件中有分区索引作为条件,oracle也会自动到该分区去找数据,速度就快多了。
以前我用也一个表,里面有2亿数据,就是用的分区表来保存的。
解决方案 »
- oracle 基础 Warning: Procedure created with compilation errors
- spool导出表数据时,如何去掉执行的sql语句和Spool off
- xmanage 安装运行报错
- 请教各位一个关于地市统计的问题
- 查询优化
- 散分了,讨论Oracle优化之CPU利用问题.
- 請用pb + oracle 開發的朋友談談臨時表的使用經驗!
- Oracle资料库启动不起来了,怎么办呢?
- 如果過程中有游標參數,怎麼測試呢?我用的是pl/sql developer...
- 有没人用过PostgreSQL这个数据库,以及它的存储过程?求教!
- xP上装Oracle
- 一个超级水的问题--在线等候!
create table test(
no number,
sale_date date not null)
partition by range (TO_CHAR(sale_date,'MM'))
(partition test1 value equals '01' TABLESPACE ts_test1,
partition test2 value equals '02' TABLESPACE ts_test2)
问以下,其中的TO_CHAR(sale_date,'MM'))及用equals可以这样写吗?
有没有其他更好的书写方法?
急!!
create table test(
no number,
sale_date date not null)
partition by range (TO_NUMBER(to_char(sale_date,'MM')))
(partition test1 value less than 2 TABLESPACE ts_test1,
partition test2 value less than 3 TABLESPACE ts_test2)
总是提示说第四行缺少右括号
可实际上根本就不缺少。ERROR 位于第 4 行:
ORA-00907: 缺少右括号
谁能帮帮我呀!!!
help!!!
在线等待!!!
create table partition_test
(
id number(9),
tmpStr varchar2(10)
)
partition by range(id)
(
partition id01 values less than (3000000) tablespace test_tabspc1,
partition id02 values less than (6000000) tablespace test_tabspc2,
partition id03 values less than (9000000) tablespace test_tabspc3,
partition id04 values less than (12000000) tablespace test_tabspc4,
partition id05 values less than (MAXVALUE) tablespace test_tabspc5
)
/1、建立局部分区索引
Create index your_index on caishui.partition_test(id)
local
(
partition id01 tablespace test_tabspc1,
partition id02 tablespace test_tabspc2,
partition id03 tablespace test_tabspc3,
partition id04 tablespace test_tabspc4,
partition id05 tablespace test_tabspc5
)
/2、重建某一个分区的索引
alter index your_index rebuild partition id01 tablespace test_tabspc1
/3、增加分区
alter table caishui.partition_test
add partition id06 values less than (15000000) tablespace test_tabspc6
/
看来是真的不好解决!
现在的问题是我的表中的字段名为date型字段。
而我在建立分区时候要以月份作为分区的标志。而在分区的方法中不能用函数。即
partition by range (TO_NUMBER(to_char(sale_date,'MM')))中用函数是错误的。谢谢各位了!
你可以创建一个冗余列,用来表示月份,然后再创建分区
这样你就可以用 values less than了