Oracle Partitioning分区技术历年新特性回顾

partition

Partitioning分区是Oracle一种重要的处理大量数据的特性,从Oracle 8开始引入range partition范围分区,到现在11g中出现的Interval Partition、REF Partitions、Partition Advisor等new feature,分区技术在一步步走向成熟。

 

 

下表列出了从Oracle 8到11g的各历史版本中出现的分区特性:

 

Core functionality Performance Manageability Oracle8 Range partitioning “Static” partition pruning Basic maintenance operations: add, drop, exchange Global range indexes Oracle8i Hash and composite range-hash partitioning Partition-wise joins Merge operation “Dynamic” pruning Oracle9i List partitioning Global index maintenance Oracle9i R2 Composite range-list partitioning . . . → Read More: Oracle Partitioning分区技术历年新特性回顾

解决Oracle中Split Partition缓慢的问题

有这样一个case , 用户的10g产品数据库中有一张按照月份划分的RANGE分区表 , 其范围为Less than (maxvalue)的最后一个Partition分区总是为空Empty的, 用户每隔半年会对这个MaxValue Partition 执行Split Partition 操作, 以便存放后续月份的数据, 同时这个表上还有一个非分区索引Nonpartitioned indexes。

 

满以为Split 这样一个Empry Partition会是一个回车就结束的任务, 但是Performance issue就在这平淡无奇的分区维护工作中出现了, 实际在执行”Alter Table Split partition Pn at (value) into …” 的DDL语句时,发现需要花费超过十多分钟才能完成一次Split。问题就在于,如果是有大量数据的Partition分区 , Split 操作慢一些也是正常的(expected预期内的) , 但是实际这里的Max Partition总是为空的,没有任何一条数据, 为什么Split 一个空的分区也会是这种蜗牛的速度呢?

 

我们来模拟这个现象, 首先创建一张分区表,Maxvalue的Partition是Empty的,且有一个普通索引:

 

 

SQL> select * from v$version; BANNER —————————————————————- Oracle Database 10g Enterprise . . . → Read More: 解决Oracle中Split Partition缓慢的问题

解决ORA-14098分区交换索引不匹配错误

上周在客户一套BRM系统上执行分区交换Exchange Partition操作的时候出现了ORA-14098错误,该错误是由于分区表上的LOCAL分区索引与非分区表上的索引不匹配造成的,我们来看一下这个错误:

[oracle@rh2 ~]$ oerr ora 14098 14098, 00000, “index mismatch for tables in ALTER TABLE EXCHANGE PARTITION” // *Cause: The two tables specified in the EXCHANGE have indexes which are // not equivalent // *Action: Ensure that the indexes for the two tables have indexes which // follow this rule // For every non . . . → Read More: 解决ORA-14098分区交换索引不匹配错误

从视图查询表分区的相关信息

分区表的分区键和分区类型都可以通过获取创建该分区表的DDL定义语句来了解,那么可不可以直接查询字典视图来获取这些信息呢?常用的dba_tab_partitions视图并没有包含我们想要的分区属性信息;这里我们可以用到dba_part_key_columns(describes the partitioning key columns for all partitioned objects in the database. Its columns are the same as those in ALL_PART_KEY_COLUMNS)和dba_part_tables(displays the object-level partitioning information for all partitioned tables in the database. Its columns are the same as those in ALL_PART_TABLES)这2个视图:

. . . → Read More: 从视图查询表分区的相关信息

11g New Features:INTERVAL PARTITIONING

Applies to:

Oracle Server – Enterprise Edition – Version: 11.1.0.6 to 11.2.0.1.0 – Release: 11.1 to 11.2 Information in this document applies to any platform.

Purpose This note explains one of the new features of 11g called :INTERVAL PARTITIONING Scope and Application

This article should be helpful to DBAs and Developers who work primarily in . . . → Read More: 11g New Features:INTERVAL PARTITIONING

How To Introduce Interval Parititioning into a Range Partitioned Table

Applies to:

Oracle Server – Enterprise Edition – Version: 11.1.0.6 Information in this document applies to any platform.

Goal

This note tells you how to introduce interval partitioning into a table that was originally created as a range-partitioned table, without having to recreate the table from scratch.

The example illustrates how to use the ALTER . . . → Read More: How To Introduce Interval Parititioning into a Range Partitioned Table

如何设计分区索引

通过下图定义的规则,可确定分区索引类型:

Hash Global分区索引介绍 HASH-Partitioned Global索引是Oracle 10g开始提供的新特性。而在以前的版本中 ,Oracle只支持Range-Partitioned Global索引。HASH-Partitioned Global索引的好处如下: 比Range-Partitioned Global索引易于实施。HASH-Partitioned Global索引是根据 索引字段值,通过Oracle内部的HASH算法自动均匀散列到定义的分区中。而 Range-Partitioned Global索引需要根据索引字段值的范围进行分区,因此实施和 维护的难度都大。 HASH-Partitioned Global索引适合于在并发量、吞吐量很大的交易系统(OLTP) 中,对某些字段的访问冲突。尤其是sequence字段值。 HASH-Partitioned Global索引适合于大批量的数据查询。HASH-Partitioned Global索引不仅可以提供分区之间的并行查询, 而且在分区内也可进行并行查询的处理。 建立分区索引必须指定表空间,并且指定的表空间要与数据表空间分开, 这样便于管理,同时尽可能分开索引和数据的IO访问,提高效率