普通表 分区表 大对象表之间不同的segment分配
来源:互联网 发布:中国出口数据统计 编辑:程序博客网 时间:2024/06/07 03:32
普通表 分区表 大对象表之间不同的segment分配
分类: oracle 2013-04-11 22:50 35人阅读 评论(0)收藏 举报
- scott@ORCL> create table table1 (id number,name varchar2(2));
- 表已创建。
- scott@ORCL> create table table2 (id number,time date) partition by range(time)
- 2 ( partition p1 values less than (to_date('2010-10-1','yyyy-mm-dd')),
- 3 partition p2 values less than (to_date('2010-11-1','yyyy-mm-dd')),
- 4 partition p4 values less than (maxvalue)
- 5 );
- 表已创建。
- scott@ORCL> create table table3 (id number,name clob);
- 表已创建。
- --没有插入数据,oracle未给表分配空间
- scott@ORCL> select count(*) from user_segments where segment_name ='TABLE1';
- COUNT(*)
- ----------
- 0
- scott@ORCL> col segment_name for a20;
- --分区表虽未插入数据,但已分配空间
- scott@ORCL> select segment_name,partition_name from user_segments where segment_name ='TABLE2';
- SEGMENT_NAME PARTITION_NAME
- -------------------- ------------------------------
- TABLE2 P1
- TABLE2 P2
- TABLE2 P4
- --大对象字段也未分配空间
- scott@ORCL> select segment_name,partition_name from user_segments where segment_name ='TABLE3';
- 未选定行
- scott@ORCL> insert into table1 values(1,'a');
- 已创建 1 行。
- --普通表插入数据之后分配空间
- scott@ORCL> select count(*) from user_segments where segment_name ='TABLE1';
- COUNT(*)
- ----------
- 1
- scott@ORCL> insert into table3 values(1,'a');
- 已创建 1 行。
- --大对象表也是在插入数据之后分配空间
- scott@ORCL> select segment_name,partition_name from user_segments where segment_name ='TABLE3';
- SEGMENT_NAME PARTITION_NAME
- -------------------- ------------------------------
- TABLE3
- ---查看大数据表分配多少个segment
- scott@ORCL> select count(*) from dba_segments;
- COUNT(*)
- ----------
- 13104
- scott@ORCL> drop table table3 purge;
- 表已删除。
- scott@ORCL> select count(*) from dba_segments;
- COUNT(*)
- ----------
- 13101
- --发现大数据对象表分配了三个segment,仔细对比创建表之后,分配了哪些segment
- scott@ORCL> create table user_segment1 as select * from user_segments;
- 表已创建。
- scott@ORCL> create table table3 (id number,name clob);
- 表已创建。
- scott@ORCL> insert into table3 values(1,'a');
- 已创建 1 行。
- scott@ORCL> col segment_name for a35;
- --大数据表分配了三个segment
- --表本身的segment
- --大对象的segment
- --LOBINDEX是为定位LOB字段内容自动创建的索引,无法删除,Oracle会自动维护。
- scott@ORCL> select segment_name,segment_type from user_segments where segment_name not in(select segment_name from user_segment1);
- SEGMENT_NAME SEGMENT_TYPE
- ----------------------------------- ------------------
- SYS_IL0000089578C00002$$ LOBINDEX
- TABLE3 TABLE
- SYS_LOB0000089578C00002$$ LOBSEGMENT
- USER_SEGMENT1 TABLE
scott@ORCL> create table table1 (id number,name varchar2(2));表已创建。scott@ORCL> create table table2 (id number,time date) partition by range(time) 2 ( partition p1 values less than (to_date('2010-10-1','yyyy-mm-dd')), 3 partition p2 values less than (to_date('2010-11-1','yyyy-mm-dd')), 4 partition p4 values less than (maxvalue) 5 );表已创建。scott@ORCL> create table table3 (id number,name clob);表已创建。--没有插入数据,oracle未给表分配空间scott@ORCL> select count(*) from user_segments where segment_name ='TABLE1'; COUNT(*)---------- 0scott@ORCL> col segment_name for a20;--分区表虽未插入数据,但已分配空间scott@ORCL> select segment_name,partition_name from user_segments where segment_name ='TABLE2';SEGMENT_NAME PARTITION_NAME-------------------- ------------------------------TABLE2 P1TABLE2 P2TABLE2 P4--大对象字段也未分配空间scott@ORCL> select segment_name,partition_name from user_segments where segment_name ='TABLE3';未选定行scott@ORCL> insert into table1 values(1,'a');已创建 1 行。--普通表插入数据之后分配空间scott@ORCL> select count(*) from user_segments where segment_name ='TABLE1'; COUNT(*)---------- 1scott@ORCL> insert into table3 values(1,'a');已创建 1 行。--大对象表也是在插入数据之后分配空间scott@ORCL> select segment_name,partition_name from user_segments where segment_name ='TABLE3';SEGMENT_NAME PARTITION_NAME-------------------- ------------------------------TABLE3---查看大数据表分配多少个segmentscott@ORCL> select count(*) from dba_segments; COUNT(*)---------- 13104scott@ORCL> drop table table3 purge;表已删除。scott@ORCL> select count(*) from dba_segments; COUNT(*)---------- 13101 --发现大数据对象表分配了三个segment,仔细对比创建表之后,分配了哪些segmentscott@ORCL> create table user_segment1 as select * from user_segments;表已创建。scott@ORCL> create table table3 (id number,name clob);表已创建。scott@ORCL> insert into table3 values(1,'a');已创建 1 行。scott@ORCL> col segment_name for a35;--大数据表分配了三个segment--表本身的segment--大对象的segment--LOBINDEX是为定位LOB字段内容自动创建的索引,无法删除,Oracle会自动维护。scott@ORCL> select segment_name,segment_type from user_segments where segment_name not in(select segment_name from user_segment1);SEGMENT_NAME SEGMENT_TYPE----------------------------------- ------------------SYS_IL0000089578C00002$$ LOBINDEXTABLE3 TABLESYS_LOB0000089578C00002$$ LOBSEGMENTUSER_SEGMENT1 TABLE
- 普通表 分区表 大对象表之间不同的segment分配
- 普通表 分区表 大对象表之间不同的segment分配
- 普通大表转为分区表
- 普通表变为分区表
- 普通表转分区表
- 将普通表转变为分区表
- 将普通表转变为分区表
- 将普通表转变为分区表
- 将普通表改为分区表
- 普通表转分区表方法
- 普通表转换为分区表
- 将普通表转变为分区表
- 将普通表转变为分区表
- mysql 普通表转分区表
- mysql 普通表转分区表
- 普通表到分区表转换
- 分区表转普通表脚本
- oracle 分区表放入不同的表空间
- 多线程中有关线程锁的简化应用。
- linux中程序的观察
- Android记录9--实现转盘效果
- Android开发 重启运用程序的代码
- 时尚的CSS3进度条
- 普通表 分区表 大对象表之间不同的segment分配
- 2014百度校园招聘研发一面
- ubuntu自动安装 nginx后 文件结构及位置
- php 执行shell命令的函数
- 2.0 Introduction
- hibernate学习笔记(三)
- socket编程——TCP/UDP数据传输
- <MFC>消息对话框的创建弹出
- poj1019