Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2896270
  • 博文数量: 599
  • 博客积分: 16398
  • 博客等级: 上将
  • 技术积分: 6875
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-30 12:04
个人简介

WINDOWS下的程序员出身,偶尔也写一些linux平台下小程序, 后转行数据库行业,专注于ORACLE和DB2的运维和优化。 同时也是ios移动开发者。欢迎志同道合的朋友一起研究技术。 数据库技术交流群:58308065,23618606

文章分类

全部博文(599)

文章存档

2014年(12)

2013年(56)

2012年(199)

2011年(105)

2010年(128)

2009年(99)

分类: Oracle

2012-03-13 11:00:45

在看11G联机文档的PARTITION EXTENDED NAME限制的时候,测试发现与书上描述不符。
 
Restrictions on Extended Names Currently, the use of partition-extended and subpartition-extended table names has the following restrictions:
  • No remote tables: A partition-extended or subpartition-extended table name cannot contain a database link (dblink) or a synonym that translates to a table with a dblink. To use remote partitions and subpartitions, create a view at the remote site that uses the extended table name syntax and then refer to the remote view.

 

  • No synonyms: A partition or subpartition extension must be specified with a base table. You cannot use synonyms, views, or any other objects.

 

  • The PARTITION FOR and SUBPARTITION FOR clauses are not valid for DDL operations on views.

 

  • In the PARTITION FOR and SUBPARTITION FOR clauses, you cannot specify the keywords DEFAULT or MAXVALUE or a bind variable for the partition_key_value or subpartition_key_value.

第二句话说 分区或者子分区的扩展语句必须指定在基表上,而不能指定在同义词或者视图及其他对象。

测试的时候却发现不是这样的:

SQL> create table test partition by range(object_id)
  2  (
  3  partition p1 values less than(10000),
  4  partition p2 values less than(20000),
  5  partition p3 values less than(30000),
  6  partition p4 values less than(maxvalue)
  7  )
  8  as
  9  select * from all_objects;

Table created.


SQL> select count(1) from test partition (p1);

  COUNT(1)
----------
      4224

SQL> create synonym s_test for test;

Synonym created.

SQL> select count(1) from s_test partition (p1);

  COUNT(1)
----------
      4224

可以看到在同义词上指定的PARTITION EXTENSION也是可以的。

SQL> create view v_test as select * from test ;

View created.

SQL> select count(1) from v_test  partition (p1);
select count(1) from v_test  partition (p1)
                     *
ERROR at line 1:
ORA-14109: partition-extended object names may only be used with tables

在视图上指定是不可以的。

虽然我的测试环境是10.2.0.4,而文档时11G的,但是不太可能10G都支持的功能,11G取消了吧

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production

 

 

阅读(1694) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

TOMSYAN2012-03-13 14:06:00

找了个11G的测试环境,在11G中也是支持的。


SQL> SELECT * FROM V$VERSION;

BANNER
--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for HPUX: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production