1.创建分区表
sec@ora10g> create table t_partition_range (id number,name varchar2(50))
2 partition by range(id)(
3 partition t_range_p1 values less than (10) tablespace tbs_part01,
4 partition t_range_p2 values less than (20) tablespace tbs_part02,
5 partition t_range_p3 values less than (30) tablespace tbs_part03,
6 partition t_range_pmax values less than (maxvalue) tablespace tbs_part04
7 );
Table created.
2.模拟插入数据
sec@ora10g> insert into t_partition_range values (5,'Andy1');
1 row created.
sec@ora10g> insert into t_partition_range values (15,'Andy2');
1 row created.
sec@ora10g> insert into t_partition_range values (25,'Andy3');
1 row created.
sec@ora10g> insert into t_partition_range values (35,'Andy4');
1 row created.
sec@ora10g> insert into t_partition_range values (45,'Andy5');
1 row created.
sec@ora10g> commit;
Commit complete.
3.查询每一个分区中包含的数据
sec@ora10g> select * from t_partition_range partition(t_range_p1);
ID NAME
---------- --------------------------------------------------
5 Andy1
sec@ora10g> select * from t_partition_range partition(t_range_p2);
ID NAME
---------- --------------------------------------------------
15 Andy2
sec@ora10g> select * from t_partition_range partition(t_range_p3);
ID NAME
---------- --------------------------------------------------
25 Andy3
sec@ora10g> select * from t_partition_range partition(t_range_pmax);
ID NAME
---------- --------------------------------------------------
35 Andy4
45 Andy5
4.exp导出分区表数据
4.1.导出一个分区演示
ora10g@testdb /exp$ exp sec/sec file=sec.dmp tables=t_partition_range:t_range_p1
Export: Release 10.2.0.1.0 - Production on Fri Jul 10 16:08:31 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table T_PARTITION_RANGE
. . exporting partition T_RANGE_P1 1 rows exported
Export terminated successfully without warnings.
4.2.导出两个分区演示
ora10g@testdb /exp$ exp sec/sec file=sec.dmp tables=t_partition_range:t_range_p1,t_partition_range:t_range_p2
Export: Release 10.2.0.1.0 - Production on Fri Jul 10 16:08:01 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table T_PARTITION_RANGE
. . exporting partition T_RANGE_P1 1 rows exported
. . exporting partition T_RANGE_P2 1 rows exported
Export terminated successfully without warnings.
4.3.全部导出效果
ora10g@testdb /exp$ exp sec/sec file=sec.dmp tables=t_partition_range
Export: Release 10.2.0.1.0 - Production on Fri Jul 10 16:16:08 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table T_PARTITION_RANGE
. . exporting partition T_RANGE_P1 1 rows exported
. . exporting partition T_RANGE_P2 1 rows exported
. . exporting partition T_RANGE_P3 1 rows exported
. . exporting partition T_RANGE_PMAX 2 rows exported
Export terminated successfully without warnings.
-- The End --
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/519536/viewspace-608844/
,如需转载,请注明出处,否则将追究法律责任。