Oracle技术之临时表的undo生成
2013-06-19 10:22
211 查看
临时表的redo生成要比普通表少的多,但是undo的产生并不比普通表少。
通过一个简单的例子说明:
SQL> create global temporary table t_temp
2 (id number, name varchar2(30))
3 on commit preserve rows;
表已创建。
SQL> create table t_normal
2 (id number, name varchar2(30));
表已创建。
SQL> select sid
2 from v$mystat
3 where rownum = 1;
SID
----------
133
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size '
5 and b.sid = 133;
未选定行
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
3988
SQL> insert into t_normal
2 select rownum, object_name
3 from dba_objects;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
135232
SQL> insert into t_temp
2 select rownum, object_name
3 from dba_objects;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
254240
SQL> select 254240 - 135232 temp_table, 135232 - 3988 normal_table from dual;
TEMP_TABLE NORMAL_TABLE
---------- ------------
119008 131244
可以看到,临时表和普通表产生的undo数据没有太多的差别,而实际上临时表的插入产生的redo信息也是undo信息对应的redo。
SQL> insert /*+ append */ into t_temp
2 select *
3 from t_temp;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
254408
SQL> insert /*+ append */ into t_normal
2 select *
3 from t_normal;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
256468
SQL> select 254408 - 254240 temp_table, 256468 - 254408 normal_table from dual;
TEMP_TABLE NORMAL_TABLE
---------- ------------
168 2060
对于append方式插入,普通表和临时表都会产生少量的undo,而临时表相对会更少一些。
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html
通过一个简单的例子说明:
SQL> create global temporary table t_temp
2 (id number, name varchar2(30))
3 on commit preserve rows;
表已创建。
SQL> create table t_normal
2 (id number, name varchar2(30));
表已创建。
SQL> select sid
2 from v$mystat
3 where rownum = 1;
SID
----------
133
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size '
5 and b.sid = 133;
未选定行
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
3988
SQL> insert into t_normal
2 select rownum, object_name
3 from dba_objects;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
135232
SQL> insert into t_temp
2 select rownum, object_name
3 from dba_objects;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
254240
SQL> select 254240 - 135232 temp_table, 135232 - 3988 normal_table from dual;
TEMP_TABLE NORMAL_TABLE
---------- ------------
119008 131244
可以看到,临时表和普通表产生的undo数据没有太多的差别,而实际上临时表的插入产生的redo信息也是undo信息对应的redo。
SQL> insert /*+ append */ into t_temp
2 select *
3 from t_temp;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
254408
SQL> insert /*+ append */ into t_normal
2 select *
3 from t_normal;
已创建49081行。
SQL> commit;
提交完成。
SQL> select value
2 from v$statname a, v$sesstat b
3 where a.statistic# = b.statistic#
4 and a.name = 'undo change vector size'
5 and b.sid = 133;
VALUE
----------
256468
SQL> select 254408 - 254240 temp_table, 256468 - 254408 normal_table from dual;
TEMP_TABLE NORMAL_TABLE
---------- ------------
168 2060
对于append方式插入,普通表和临时表都会产生少量的undo,而临时表相对会更少一些。
oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html
相关文章推荐
- 查看oracle 系统临时表空间、undo表空间、SGA和PGA大小
- 查看oracle 系统临时表空间、undo表空间、SGA和PGA大小
- 数据库oracle 【临时UNDO】12c新特性
- Oracle 12C 新特性之临时undo控制
- java静态页面生成技术--循环输出列表--BUG临时修复
- oracle解决因drop命令生成临时表名的问题(如表分区)
- 【日记】2017-10-23 oracle 和线程问题 工单不生成 工单临时表为空
- Oracle12c中性能优化&功能增强新特性之临时undo
- 查看oracle 系统临时表空间、undo表空间、SGA和PGA大小
- 查看oracle 系统临时表空间、undo表空间、SGA和PGA大小
- 查看oracle 系统临时表空间、undo表空间、SGA和PGA大小
- ORACLE 临时表的REDO UNDO
- 读oracle核心技术之redo与undo
- oracle技术之利用STANDBY将单实例数据库升级为RAC环境(四)
- oracle 生成对应文件时报错 Table configuration with catalog null, schema null...
- arcgis server manger页面打不开,无法生成临时类(result=1)。 ”的解决 .
- 如何使用动软代码生成器连接oracle生成数据库设计文档
- oracle临时表的用法总结
- Oracle基本数据改变原理浅析(redo与undo)--oracle核心技术读书笔记一
- iOS自动化打包实现(在线生成APP需要的技术)