`

Oracle 11g System Partition(原创)

 
阅读更多

System Partitioning
System partitioning is quite different from all other types of data partitioning. System partitioning is meant to enable application controlled table partitioning. Just for starters, there aren’t any partitioning keys when you use system partitioning. Under system partitioning the database lets you break a table down into meaningless partitions and you don’t control the partitioning ranges for the actual data placement. The application controls the partitioning and actual data placement.
Because a system-partitioned table doesn’t use partitioning keys, you can’t direct the mapping of the rows to a particular partition. Instead, the application must specify the actual partition in which the database must place a row. Thus, insert statements must use the partition information explicitly. It’s important to remind yourself that system partitioning doesn’t use any partitioning method and thus can’t distribute table rows to partitions. It’s the application’s job to do the data distribution to the partitions.
System partitioning provides the benefit of easier manageability that comes with equipartitioning a table. You can, for example, create a nested table as a system- partitioned table with the same partitions as the base table. System partitioning doesn’t support the normal partition pruning and partition-wise joins like the other types of partitioned tables. You thus lose the performance benefits inherent in partitioning a table.
A System Partitioning Example
As you would expect, system partitioning allows large tables to be broken down into smaller partitions, but unlike other partitioning schemes, the database has no control over the placement of rows during insert operations. The following example shows the creation of a system partitioned table.
SQL> CREATE TABLE system_partitioned_tab (
       id           NUMBER,
       code         VARCHAR2(10),
       description  VARCHAR2(50),
       created_date DATE
     )
     PARTITION BY SYSTEM
     (
       PARTITION part_1,
       PARTITION part_2
     );
The partition must be explicitly defined in all insert statements or an error is produced.
SQL> INSERT INTO system_partitioned_tab VALUES (1, 'ONE', 'One', SYSDATE);
*
ERROR at line 1:
ORA-14701: partition-extended name or bind variable must be used for DMLs on tables partitioned by
the System method
The PARTITION clause is used to define which partition the row should be placed in.
SQL> INSERT INTO system_partitioned_tab PARTITION (part_1) VALUES (1, 'ONE', 'One', SYSDATE);
SQL> INSERT INTO system_partitioned_tab PARTITION (part_2) VALUES (2, 'TWO', 'Two', SYSDATE);
SQL> COMMIT;
SQL> EXEC DBMS_STATS.gather_table_stats(USER, 'SYSTEM_PARTITIONED_TAB');
SQL> COLUMN table_name FORMAT A25
SQL> COLUMN partition_name FORMAT A20
SQL> COLUMN high_value FORMAT A10
SQL> SELECT table_name, partition_name, high_value, num_rows
       FROM user_tab_partitions
      ORDER BY table_name, partition_name;
    TABLE_NAME                PARTITION_NAME       HIGH_VALUE   NUM_ROWS
    ------------------------- -------------------- ---------- ----------
    SYSTEM_PARTITIONED_TAB    PART_1                                   1
    SYSTEM_PARTITIONED_TAB    PART_2                                   1
    2 rows selected.
Notice that the HIGH_VALUE for the partitions is blank.

In addition to the insert statement, the merge statement also requires that you specify the partition-extended syntax to identify the partition into which you want the database to place the merged partition rows. Here’s an example:
SQL> alter table sys_part_tab merge partitions part_1,part_2 into partition p1;
The PARTITION clause is optional for update and delete statements, but omitting this clause will force all partitions to be scanned, since there is no way perform automatic partition pruning when the database has no control over row placement. When the PARTITION clause is used, you must be sure to perform the operation against the correct partition.
SQL> DELETE FROM system_partitioned_tab PARTITION (part_2) WHERE id = 1;
0 rows deleted.
SQL> UPDATE system_partitioned_tab PARTITION (part_1) SET code = 'TWO' WHERE id = 2;
0 rows updated.
The PARTITION clause can also be used in queries to target specific partitions.
SQL> SELECT COUNT(*)
             FROM   system_partitioned_tab PARTITION (part_1);
       COUNT(*)
       ----------
        1
 1 row selected.
You can perform the following operations with a system-partitioned table:

  • Partition maintenance operations
  • All DML and DDL operations
  • Creation of local indexes, as long as they are not unique
  • Creation of local bitmapped indexes
  • Creation of global indexes

Conditions and restrictions on system partitioning include:

  • If you specify the PARTITION BY SYSTEM clause, but don't define partitions, a single partition is created with the name in the format of "SYS_Pn".
  • If you specify PARTITION BY SYSTEM PARTITIONS X clause, the database creates "X" partitions with the name in the format of "SYS_Pn". The range of allowable values for "n" is from 1 to 1024K-1.
  • System partitioning is not available for index-organized tables or a table that is part of a cluster.
  • System partitioning can play no part in composite partitioning.
  • You cannot split a system partition.
  • System partitioning cannot be specified in a CREATE TABLE ... AS SELECT statement.
  • To insert data into a system-partitioned table using an INSERT INTO ... AS subquery statement, you must use partition-extended syntax to specify the partition into which the values returned by the subquery will be inserted.
    as shown here:
    SQL> insert into table_name
         partition (
         PartitionName)
         dataobj_to_partition(base_table, :physical_partid))
         as SubQuery...

参考至:《McGraw.Hill.OCP.Oracle.Database.11g.New.Features.for.Administrators.Exam.Guide.Apr.2008》

       http://www.oracle-base.com/articles/11g/partitioning-enhancements-11gr1.php

本文原创,转载请注明出处、作者

如有错误,欢迎指正

邮箱:czmcj@163.com

 

0
0
分享到:
评论

相关推荐

    oracle_10g_创建数据库和表用户名和密码

    Oracle 10g 默认创建了五个表空间:SYSTEM、SYSAUX、UNDO、USERS 和 TEMPORARY。用户可以根据应用系统的规模及其所要存放对象创建多个表空间,以区分用户数据和系统数据。 表(TABLE)是数据库中存放用户数据的...

    oracle学习文档 笔记 全面 深刻 详细 通俗易懂 doc word格式 清晰 连接字符串

    2. oracle11G自带一个卸载批处理\app\Administrator\product\11.2.0\dbhome_1\deinstall\deinstall.bat 3. 运行该批处理程序将自动完成oracle卸载工作,最后手动删除\app文件夹(可能需要重启才能删除) 4. 运行...

    oracle创建分区表.pdf

    oracle创建分区表 在ORACLE里如果遇到特别大的表,可以使用分区的表来改变其应用程序的性能。 以system身份登陆数据库,查看 v$option视图,如果其中Partition为TRUE,则支持分区 功能;否则不支持。Partition有...

    oracle学习经典教程

    1.3.5 Oracle 11g 中的分区表............... 74 1.3.5.1 11g 中的分区表新特性........................74 1.3.5.1.1 Interval Partitioning ......................74 1.3.5.1.2 System Partitioning .....

    TianleSoftware Oracle中文学习手册

    在Oracle 几年的学习中,做了很多的实验,也遇到了很多的问题, 在这个过程中,积累了一些学习...1.3.2.1.1 Oracle 11g 的 Interval .................................................. 1.3.2.1.2 Oracle 10g 版本 .....

    Oracle9i的init.ora参数中文说明

    语法: TIMESTAMP '1997-01-31 09:26:50.10' (将值存储为 11 个字节)。 默认值: 从 NLS_TERRITORY 中获得 nls_time_format: 说明: 指定一个字符串值, 设置 TIME 数据类型的默认值, 该数据类型包含 HOUR, MINUTE 和 ...

    Oracle事例

    如:alter user jf quota 10M on system; 27、查看放在ORACLE的内存区里的表 SQL>select table_name,cache from user_tables where instr(cache,\'Y\')>0; 28、约束条件 create table employee (empno ...

    种类齐全的调试与反调试,来自GitHub

    - "SOFTWARE\\Oracle\\VirtualBox Guest Additions" - "SYSTEM\\ControlSet001\\Services\\VBoxGuest" - "SYSTEM\\ControlSet001\\Services\\VBoxMouse" - "SYSTEM\\ControlSet001\\Services\\VBoxService" - ...

    MS-DOS 5.0

    3.2 Using the Uninstall Program on an OS/2 System 4. Solving Memory Problems 4.1 386MAX 4.2 All Computers Expanded-Memory Driver 4.3 Bus Master DMA Controller 4.4 HIMEM.SYS Location 4.5 INT15 ...

    SQL培训第一期

    alter system kill session 'sid,serial#'; 2.1.7 备份与恢复 2.1.7.1 导出 导出用户: exp cssdj/cssdj@zr owner=(cssdj,cssdj_zsy) file=d:/cssdj.dmp log=d:/cssdj.log 导出用户表: exp cssdj/cssdj@zr tables=...

    网管教程 从入门到精通软件篇.txt

    G GDM:铃声、口哨声和声音板模块格式 GetRight:GetRight未完成的下载文件 GHO:Norton 克隆磁盘映像 GID:Windows 95全局索引文件(包括帮助状态) GIF:CompuServe位图文件 GL:动画格式 GRP:程序管理组 ...

    plsqldev14.0.0.1961x32多语言版+sn.rar

    For these file control operations PL/SQL Developer relies on a 3rd party shell extension that must be installed on your system. In the screenshots above “GIT Extensions” has been used. Worksets A ...

    plsqldev14.0.0.1961x64多语言版+sn.rar

    64位版本的 PLSQL 正式版,只能运行在64位系统中,需要你安装 64 位的 Oracle 客户端。 安装请查看说明。 APRIL 17, 2020 - VERSION 14.0 RELEASED Built-in Version Control support for Git and Subversion ...

Global site tag (gtag.js) - Google Analytics