如何在Oracle 12C中添加多个分区 (Doc ID 1482456.1)
How to Add Multiple Partitions in Oracle 12C (Doc ID 1482456.1)
APPLIES TO:
Oracle Database - Enterprise Edition - Version 12.1.0.1 and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Information in this document applies to any platform.
Oracle 12C
GOAL
To demonstrate new feature in 12c, adding multiple table partitions in a single command 为了演示12c中的新功能,请在单个命令中添加多个表分区
SOLUTION
You can add multiple new partitions with the ADD PARTITION clause of the ALTER TABLE statement. When adding multiple partitions, local and global index operations are the same as when adding a single partition. Note that both ADD PARTITION and ADD PARTITIONS are synonymous.
您可以使用 ALTER TABLE 语句的 ADD PARTITION 子句添加多个新分区。 添加多个分区时,本地索引和全局索引操作与添加单个分区时相同。 请注意,ADD PARTITION 和 ADD PARTITIONS 都是同义词。
RANGE PARTITIONS 范围分区
You can add multiple range partitions that are listed in ascending order of their upper bound values to the high end (after the last existing partition) of a range-partitioned or composite range-partitioned table, provided the MAXVALUE partition is not defined.
您可以将以上限值的升序排列的多个范围分区添加到范围分区表或组合范围分区表的高端(在最后一个现有分区之后),前提是未定义MAXVALUE分区。
CREATE TABLE sales
(prod_id NUMBER(6),
cust_id NUMBER,
time_id DATE,
channel_id CHAR(1),
promo_id NUMBER(6),
quantity_sold NUMBER(3),
amount_sold NUMBER(10,2))
partition by range(time_id)
(partition sales_q1_2006 values less than (TO_DATE('01-APR-2006','dd-MON-yyyy')),
partition sales_q2_2006 values less than (TO_DATE('01-JUL-2006','dd-MON-yyyy')),
partition sales_q3_2006 values less than (TO_DATE('01-OCT-2006','dd-MON-yyyy')),
partition sales_q4_2006 values less than (TO_DATE('01-JAN-2007','dd-MON-yyyy')));
The above example creates a sales table with four partitions, one for each quarter of 2006. 上面的示例创建了一个具有四个分区的sales表,
Each partition is given a name: sales_q1_2006, sales_q2_2006, sales_q3_2006, and sales_q4_2006. 每个分区用于2006年的每个季度。每个分区都有一个名称:sales_q1_2006,sales_q2_2006,sales_q3_2006和sales_q4_2006。
The time_id column is the partitioning column, while its value represents the partitioning key of a specific row. time_id列是分区列,而其值表示特定行的分区键。
The VALUES LESS THAN clause determines the partition bound: Rows with partitioning key values that compare less than the ordered list of values specified by the clause are stored in the partition.
VALUES LESS THAN子句确定分区的边界:分区键值的行比该子句指定的值的有序列表小的行存储在分区中。
For example, a row with time_id=17-MAR-2006 would be stored in partition sales_q1_2006. 例如,time_id = 17-MAR-2006的行将存储在分区sales_q1_2006中。
You can add multiple partitions using a single statement by specifying the individual partitions. 您可以通过指定单个分区来使用单个语句添加多个分区
For example, in the below example, you add multiple partitions to the Range-partitioned sales table created earlier named sales_q1_2007, sales_q2_2007, sales_q3_2007 and sales_q4_2007.
例如,在下面的示例中,您将多个分区添加到先前创建的名为sales_q1_2007,sales_q2_2007,sales_q3_2007和sales_q4_2007的范围分区销售表中。
ALTER TABLE sales ADD
PARTITION sales_q1_2007 VALUES LESS THAN (TO_DATE('01-APR-2007','dd-MON-yyyy')),
PARTITION sales_q2_2007 VALUES LESS THAN (TO_DATE('01-JUL-2007','dd-MON-yyyy')),
PARTITION sales_q3_2007 VALUES LESS THAN (TO_DATE('01-OCT-2007','dd-MON-yyyy')),
PARTITION sales_q4_2007 VALUES LESS THAN (TO_DATE('01-JAN-2008','dd-MON-yyyy'));
LIST PARTITIONS 列表分区
You can add multiple list partitions to a table using new sets of partition values if the DEFAULT partition does not exist. 如果DEFAULT分区不存在,则可以使用新的分区值集将多个列表分区添加到一个表中。
CREATE TABLE sales_list
(salesman_name VARCHAR2(30),
sales_state VARCHAR2(20))
PARTITION BY LIST(sales_state)
(
PARTITION sales_CA VALUES('California'),
PARTITION sales_NY VALUES ('New York'),
PARTITION sales_NJ VALUES ('New Jersey'),
PARTITION sales_CT VALUES ('Connecticut'),
PARTITION sales_PA VALUES ('Pennsylvania'),
PARTITION sales_IL VALUES('Illinois')); ALTER TABLE sales_list add
PARTITION sales_NE VALUES ('Nebraska'),
PARTITION sales_AZ VALUES ('Arizona'),
PARTITION sales_MD VALUES ('Maryland');
SYSTEM PARTITIONS 系统分区
The BEFORE clause can be used to add multiple new system partitions in relation to only one existing partition. If the clause is specified at the end of the SQL statement, then all the new partitions are added before the partition specified in the clause. Otherwise, the new partitions are added after the existing partitions. BEFORE子句可用于仅相对于一个现有分区添加多个新系统分区。如果在SQL语句的末尾指定了子句,则所有新分区都将添加到该子句中指定的分区之前。否则,新分区将添加到现有分区之后。
For example, the following SQL statement adds three new partitions before the part_last partition for the system partitioned table: 例如,以下SQL语句在系统分区表的part_last分区之前添加了三个新分区
ALTER TABLE system_table1 ADD PARTITIONS 3 BEFORE part_last;
The following SQL statement adds multiple individual partitions using the BEFORE clause: 以下SQL语句使用BEFORE子句添加多个单独的分区
ALTER TABLE system_table2 ADD
PARTITION p5,
PARTITION p6,
PARTITION p7
BEFORE PARTITION pMax;
REFERENCES
NOTE:785462.1 - 11g New Features: System Partitioning
如何在Oracle 12C中添加多个分区 (Doc ID 1482456.1)的更多相关文章
- 如何在Oracle 12C中Drop/Truncate多个分区 (Doc ID 1482264.1)
How to Drop/Truncate Multiple Partitions in Oracle 12C (Doc ID 1482264.1) APPLIES TO: Oracle Databas ...
- Data Guard:Oracle 12c –新增和更新的功能 (Doc ID 1558256.1)
Data Guard: Oracle 12c – New and updated Features (Doc ID 1558256.1) APPLIES TO: Oracle Database - E ...
- Oracle 12c中新建pdb用户登录问题分析
Oracle 12c新建用户登录问题分析1 用sys用户新建用户,提示公用用户名或角色名无效.原因:Oracle 12c中,在容器中建用户(或者应该称为使用者),须在用户名前加c##.默认登录连接的就 ...
- oracle 12c 中asm元数据是否有所变化
详见原文博客链接地址: oracle 12c 中asm元数据是否有所变化
- 如何在VUE项目中添加ESLint
如何在VUE项目中添加ESLint 1. 首先在项目的根目录下 新建 .eslintrc.js文件,其配置规则可以如下:(自己小整理了一份),所有的代码如下: // https://eslint.or ...
- 如何在Android Studio中添加注释模板信息?
如何在Android Studio中添加注释模板信息? 在开发程序的时候,我们一般都会给文件自动添加上一些关于文件的注释信息,比如开发者的名字,开发的时间,开发者的联系方式等等.那么在android ...
- 浅析Oracle 12c中Data Guard新特性
浅析Oracle 12c中Data Guard新特性 写在前面 无论是做Oracle运维的小伙伴还是老伙伴,想必对Oracle数据库的数据级灾备核心技术—Data Guard是再熟悉不过了!这项从 ...
- 为何在查询中索引未被使用 (Doc ID 1549181.1)
To Bottom * 为何在查询中索引未被使用 (Doc ID 1549181.1) To Bottom 文档内容 用途 排错步骤 高速检查 表上是否存在索引? 索引是否应该 ...
- Oracle 12C 新特性之表分区或子分区的在线迁移
Oracle 12c 中迁移表分区或子分区到不同的表空间不再需要复杂的过程.与之前版本中未分区表进行在线迁移类似,表分区或子分区可以在线或是离线迁移至一个不同的表空间.当指定了 ONLINE 语句,所 ...
随机推荐
- 批量修改bilibili客户端下载视频文件名
代码已上传:Github 起因 昨天晚上从B站电脑客户端下了一个分集视频 但是下载后的视频是这样的: 视频名是这样的: 这样既不直观又不美观,就算把视频文件放到一个文件夹内,连续看视频时也不容易记住看 ...
- [TimLinux] JavaScript 事件
1. 简介 JavaScript与HTML之间的交互式通过事件来实现的,事件是文档或浏览器窗口中发生的一些特定的交互瞬间,使用事件处理程序来预订事件,从而在事件发生时,能够执行特定的代码.事件使页面的 ...
- E - Unimodal Array CodeForces - 831A
Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is cons ...
- CoderForces-913D
You are preparing for an exam on scheduling theory. The exam will last for exactly Tmilliseconds and ...
- java笔记 -- 乐观锁与悲观锁
何谓乐观锁和悲观锁 乐观锁对应于生活中乐观的人总是想着事情往好的方向发展,悲观锁对应于生活中悲观的人总是想着事情往坏的方向发展.这两种人各有优缺点,不能不以场景而定说一种人好于另外一种人. 悲观锁 - ...
- Java_百钱买百鸡
题目:公鸡3文钱,母鸡2文钱,3只小鸡1文钱,百钱买百鸡,求多少公鸡,母鸡,小鸡? public class Work6{ public static void main(String[] args) ...
- 2019年Spring核心知识点整理,看看你掌握了多少?
前言 如今做Java尤其是web几乎是避免不了和Spring打交道了,但是Spring是这样的大而全,新鲜名词不断产生,学起来给人一种凌乱的感觉,在这里总结一下,理顺头绪. Spring 概述 Spr ...
- Django大纲
Django框架 ........ 2.聚合查询 分组 F与Q查询 字段 及其 参数 | 数据库的三大范式 3.orm查询优化 MTV与MVC模型 choice参数 ajax serializers ...
- Centos7 Openresty 开发环境
首先要安装编译环境 yum group install "Development Tools" yum install pcre-devel openssl-devel gcc c ...
- ansible部署nginx
1.配置免密登录 [root@localhost ansible]# vim /etc/ansible/hosts //用来配置目标主机 加入以下内容 [nginx] //目标主机组 192.168. ...