楼主: eygle

[精华] Nologging到底何时才能生效?

[复制链接]
论坛徽章:
12
会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB元老
日期:2006-04-24 14:03:07授权会员
日期:2006-04-24 13:56:42ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44生肖徽章2007版:虎
日期:2008-01-02 17:35:53CTO参与奖
日期:2009-01-15 11:42:46目光如炬
日期:2017-04-09 22:00:00
11#
发表于 2004-7-14 09:45 | 只看该作者
摘自:
"http://www.translate.ru/url/tran_url.asp?lang=&url=http%3A%2F%2Fdsvolk.msk.ru%2Foracle%2Ffaq%2F&direction=re&template=General&cp1=NO&cp2=NO&autotranslate=off&transliterate=on"
一个很不错的网站

all_about_redo_logs.doc

194 KB, 下载次数: 1145

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
12#
发表于 2004-7-14 09:45 | 只看该作者
BTW :我想这里也是论述 归档模式、direct、nologging  之间相互的关系吧,这几个之间的关系,itpub曾经有几个人都论述过的。在oracle  document 中也是有说明的 。 只不过没有人专门把这个整理出来。在此总算有勤快人整理出来了  

使用道具 举报

回复
论坛徽章:
3
数据库板块每日发贴之星
日期:2005-10-19 01:01:30管理团队2006纪念徽章
日期:2006-04-16 22:44:45会员2006贡献徽章
日期:2006-04-17 13:46:34
13#
发表于 2004-7-14 10:03 | 只看该作者
最初由 eygle 发布
[B]不是我的错

我引用的时候就说:

biti给出过测试,说明在append模式下不会对[B]数据[/B]产生undo[/COLOR]



[/B]


是我的错
我看的不够仔细了
谢谢biti偶像的回答

使用道具 举报

回复
论坛徽章:
117
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20版主7段
日期:2012-05-15 15:24:11ITPUB 11周年纪念徽章
日期:2012-09-28 17:34:42ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:32紫蛋头
日期:2013-03-04 17:00:07优秀写手
日期:2013-12-18 09:29:09
14#
 楼主| 发表于 2004-7-14 10:22 | 只看该作者
最初由 xie3000 发布
[B]摘自:
"http://www.translate.ru/url/tran_url.asp?lang=&url=http%3A%2F%2Fdsvolk.msk.ru%2Foracle%2Ffaq%2F&direction=re&template=General&cp1=NO&cp2=NO&autotranslate=off&transliterate=on"
一个很不错的网站 [/B]


Kambhampati Ravi Sudhakar 这个作者口气够大
all about redo logs

可是显然他的文章里有明显的错误.

我们看他这段话:


I tried to get the maximum possible difference in the readings but I have lesser data  and hence the difference is less, but in your case this might have a higher value


他把上面测试的结果归结为lesser data的影响.
显然过于草率.


我们看以下测试:

[php]

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Enabled
Archive destination            /opt/oracle/oradata/hsjf/archive
Oldest online log sequence     156
Current log sequence           158
SQL> @redo
SQL> select * from redo_size;

     VALUE
----------
     80892

SQL> create table test nologging as select * from dba_objects;

Table created.

SQL> select * from redo_size;

     VALUE
----------
    118024

SQL> drop table test;

Table dropped.

SQL> select * from redo_size;

     VALUE
----------
    139732

SQL> create table test as select * from dba_objects;

Table created.

SQL> select * from redo_size;

     VALUE
----------
    176864

SQL> select (176864 -139732) redo2,(118024 -80892) redo1 from dual;

     REDO2      REDO1
---------- ----------
     37132      37132

SQL> drop table test;

Table dropped.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  235999908 bytes
Fixed Size                   451236 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> @redo
SQL> select * from redo_size;

     VALUE
----------
     35768

SQL> create table test nologging as select * from dba_objects;

Table created.

SQL> select * from redo_size;

     VALUE
----------
     73860

SQL> drop table test;

Table dropped.

SQL> select * from redo_size;

     VALUE
----------
     95596

SQL> create table test as select * from dba_objects;

Table created.

SQL> select * from redo_size;

     VALUE
----------
   1215092

SQL> select (1215092 -95596) redo2,(73860 -35768) from dual;

     REDO2 (73860-35768)
---------- -------------
   1119496         38092
.
[/php]

显然ctas的Nologging在archivelog模式下才会不记录redo,而在Noarchivelog模式下会产生同样多的redo
在归档模式下的CTAS nologging应该等价于非归档模式下ctas + insert append
[/COLOR]

这是9i里的测试结果.
有兴趣的可以测试一下其他版本.

使用道具 举报

回复
论坛徽章:
12
会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB元老
日期:2006-04-24 14:03:07授权会员
日期:2006-04-24 13:56:42ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44生肖徽章2007版:虎
日期:2008-01-02 17:35:53CTO参与奖
日期:2009-01-15 11:42:46目光如炬
日期:2017-04-09 22:00:00
15#
发表于 2004-7-14 10:40 | 只看该作者
口气的确不小
作者Kambhampati Ravi Sudhakar
前面这样说的,是不是由于版本的问题有人在8I上试过吗?


Introduction
This paper provides detailed information to understand How the Database Redo log buffers works and how to detect and resolve tuning problems related to Oracle memory subsystem. This document also explains in brief, how to use Oracle utility LogMiner
Most of the concepts brought to light here are applicable to Oracle8i only, And the usage of scripts are at users discretion only.

Target Audience
·        Database Administrators and,
·        Oracle Application developers who have  knowledge of Oracle8i server and its memory subsystems

Excerpts Are you safe and comfortable with a database that does not have a recovery system . I guess no!

One would expect the database to be like a steno writer who logs every thing somewhere so that when the boss says,  “go and draft it!”, the writings comes on to a paper This is just what a Redo Log buffer does, It logs every thing in memory which constitutes System global Area, the Oracle memory subsystem, and when commit is issued the Log writer writes everything on the data files permanently.

The redo log buffer is a circular buffer in the SGA that holds information about changes made to the database. This information is stored in redo entries. Redo entries contain the information necessary to reconstruct, or redo, changes made to the database by INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP operations. Redo entries are used for database recovery, if necessary.
Redo entries are copied by Oracle server processes from the user's memory space to the redo log buffer in the SGA. The redo entries take up continuous, sequential space in the buffer. The background process LGWR writes the redo log buffer to the active online redo log file (or group of files) on disk.

使用道具 举报

回复
招聘 : 数据库管理员
论坛徽章:
3
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB 11周年纪念徽章
日期:2012-10-09 18:05:07
16#
发表于 2004-7-14 10:42 | 只看该作者
up

使用道具 举报

回复
论坛徽章:
3
数据库板块每日发贴之星
日期:2005-10-19 01:01:30管理团队2006纪念徽章
日期:2006-04-16 22:44:45会员2006贡献徽章
日期:2006-04-17 13:46:34
17#
发表于 2004-7-14 11:05 | 只看该作者
最初由 xie3000 发布
[B]口气的确不小
作者Kambhampati Ravi Sudhakar
前面这样说的,是不是由于版本的问题有人在8I上试过吗?
[/B]



8174上的一个测试,非归档模式:

[php]
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
PL/SQL Release 8.1.7.4.0 - Production
CORE    8.1.7.2.1       Production
TNS for 32-bit Windows: Version 8.1.7.4.0 - Production
NLSRTL Version 3.4.1.0.0 - Production

SQL> archive log list
数据库日志模式             非存档模式
自动存档             启用
存档终点            D:\database\oracle\ora817\RDBMS
最早的概要信息日志序列     1488
当前日志序列           1491  


SQL> select * from redo_size;

     VALUE
----------
     91848

SQL> create table test nologging as select * from all_objects;

表已创建。

SQL> select * from redo_size;

     VALUE
----------
    147148

SQL> drop table test;

表已丢弃。

SQL> select * from redo_size;

     VALUE
----------
    177584

SQL> create table test as select * from all_objects;

表已创建。

SQL> select * from redo_size;

     VALUE
----------
    232892      

SQL> select (232892 - 177584 ) redo,(147148-91848) redo_nolog from dual;

      REDO REDO_NOLOG
---------- ----------
     55308      55300
'
[/php]

在归档模式下的情况:
[php]
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount
ORACLE 例程已经启动。

Total System Global Area   65648668 bytes
Fixed Size                    75804 bytes
Variable Size              44523520 bytes
Database Buffers           20971520 bytes
Redo Buffers                  77824 bytes
数据库装载完毕。
SQL> alter database archivelog
  2  /

数据库已更改。

SQL> alter database open;

数据库已更改。   

SQL> drop table test;

表已丢弃。

SQL> select * from redo_size;

     VALUE
----------
     30520
     
SQL> create table test as select * from all_objects;

表已创建。

SQL> select * from redo_size;

     VALUE
----------
   2953668

SQL> drop table test;

表已丢弃。

SQL> select * from redo_size;

     VALUE
----------
   3070020

SQL> create table test nologging as select * from all_objects;

表已创建。

SQL> select * from redo_size;

     VALUE
----------
   3125328

SQL> select (2953668-30520) redo,(3125328-3070020) redo_nolog from dual;

      REDO REDO_NOLOG
---------- ----------
   2923148      55308
'
[/php]

在归档模式下的近一步测试,比较ctas和ctas无数据+ insert append 的redo size:
[php]
SQL> drop table test;

表已丢弃。

SQL> select * from redo_size;

     VALUE
----------
   3155764

SQL> create table test as select * from all_objects where 1=0;

表已创建。

SQL> insert /*+append*/into test select * from all_objects;

已创建25474行。

SQL> commit;

提交完成。

SQL> select * from redo_size;

     VALUE
----------
   6079860
   
SQL> select  (6079860-3155764) logging from dual;

(6079860-3155764)
-----------------
          2924096   

   
SQL> drop table test;

表已丢弃。

SQL> select * from redo_size;

     VALUE
----------
   6110356

SQL> create table test nologging as select * from all_objects where 1=0;

表已创建。

SQL> insert /*+append*/ into test select * from all_objects;

已创建25474行。

SQL> commit;

提交完成。

SQL> select * from redo_size;

     VALUE
----------
   6167588
   
SQL> select (6079860-3155764) logging ,(6167588-6110356)nologging from dual;

   LOGGING  NOLOGGING
---------- ----------
   2924096      57232
'
[/php]

根据这个结果,我们看到:

noarchivelog下的CTAS 的redo=noarchivelog下的CTAS nologging的redo =archivelog下的CTAS nologging的redo
这三种情况下,都对系统产生了较少的redo size
只有在archivelog 下CTAS,才产生了较多的redo size
这个和eygle得到的结论是一致的


比较了CTAS和CTAS+insert append后,实际上(archivelog mode):
[B]
CTAS nologging redo =CTAS(no data) nologing +insert append redo size;

CTAS redo =CTAS(no data) +insert append redo size;
[/B]

使用道具 举报

回复
招聘 : 数据库管理员
论坛徽章:
3
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB 11周年纪念徽章
日期:2012-10-09 18:05:07
18#
发表于 2004-7-14 11:05 | 只看该作者
看了各位在那边的讨论,最近看oracle ooo迷糊的地方终于开始开朗了点~ 呵呵,谢谢各位老大~
偶很佩服eygle的研究精神,发现问题,决不放过~

总结的看是不是应该这样理解:
非归档模式下,不管表是否有nologging,append都会减少redo的生成:因append模式是将数据插入临时表空间的临时段中,而该表空间里的所有对象是不会有undo信息的,commit的时候就把该段移接到操作表的hwm屁股后;这是否是oracle文档上说的direct-pat insert操作是要单独一个事务的原因(这点与操作的parallelism有无关系)?redo有两部分,操作表seg的dirty blocks的redo,该操作生成的undo seg的dirty block的redo(不考虑dbms本身字典变化的redo),这样append就省了很多redo,因为即没有操作表seg的dirty block也无undo 段的redo(因数据在临时段里插入)。

而归档模式下,append+logging才能减少redo的生成~

这样的话,比如一个类dss生产系统,按tom的话说是只有开发db才noarchive,生产系统肯定要archive。那么在一个类dss的生产系统(must be archived)做数据装载时,使用append+nologging(maybe +parallel)来加快数据加载的时间。
非归档的数据库 只要append一个条件就能起减少redosize的决定性作用。


是不是可以这样理解?
而不管怎么操作,对dbms自身的那点redo是无法避免的吧`~

使用道具 举报

回复
论坛徽章:
12
会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB元老
日期:2006-04-24 14:03:07授权会员
日期:2006-04-24 13:56:42ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44生肖徽章2007版:虎
日期:2008-01-02 17:35:53CTO参与奖
日期:2009-01-15 11:42:46目光如炬
日期:2017-04-09 22:00:00
19#
发表于 2004-7-14 11:25 | 只看该作者
to :糖醋兔子
事实证明和eygle
的结果一致

使用道具 举报

回复
论坛徽章:
117
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20版主7段
日期:2012-05-15 15:24:11ITPUB 11周年纪念徽章
日期:2012-09-28 17:34:42ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:32紫蛋头
日期:2013-03-04 17:00:07优秀写手
日期:2013-12-18 09:29:09
20#
 楼主| 发表于 2004-7-14 11:41 | 只看该作者
其实Tom前面的那个例子就是Oracle8i的

http://asktom.oracle.com/pls/ask ... ERIA:3224814814761,

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表