ITPUB??ì3
12月微软Hyper-V虚拟化沙龙主题征集
ITPUB论坛 » Oracle专题深入讨论 » Nologging到底何时才能生效?

标题: [精华] Nologging到底何时才能生效?
离线 xie3000
防洪专家


精华贴数 1
个人空间 0
技术积分 7333 (180)
社区积分 111 (3309)
注册日期 2002-11-21
论坛徽章:10
ITPUB元老会员2006贡献徽章授权会员生肖徽章2007版:虎ITPUB新首页上线纪念徽章 
      

发表于 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"
一个很不错的网站




xie3000 上传了这个附件:
2004-7-14 09:45
  下载次数: 908
all_about_redo_logs.doc (194 KB)
 
__________________
ORACLE DATABASE  ADMINISTRATOR  OCP8I&9I、网络工程师、CCNP
========QQ在线聊天========给我发邮件========
只看该作者    顶部
在线/呼叫 biti_rainy
人生就是如此



精华贴数 38
个人空间 0
技术积分 111199 (4)
社区积分 11832 (132)
注册日期 2001-12-12
论坛徽章:41
现任管理团队成员ITPUB长老会成员ITPUB元老年度论坛发贴之星年度论坛发贴之星ITPUB北京九华山庄2008年会纪念徽章
管理团队2007贡献徽章参与2007年甲骨文全球大会(中国上海)纪念ITPUB北京香山2007年会纪念徽章管理团队2006纪念徽章会员2007贡献徽章会员2006贡献徽章

发表于 2004-7-14 09:45 
BTW :我想这里也是论述 归档模式、direct、nologging  之间相互的关系吧,这几个之间的关系,itpub曾经有几个人都论述过的。在oracle  document 中也是有说明的 。 只不过没有人专门把这个整理出来。在此总算有勤快人整理出来了  


__________________
眼界决定边界,态度决定高度
blog:
人生就是如此
只看该作者    顶部
离线 糖醋兔子
斑竹


精华贴数 0
个人空间 0
技术积分 450 (4395)
社区积分 301 (1937)
注册日期 2004-7-1
论坛徽章:3
管理团队2006纪念徽章会员2006贡献徽章数据库板块每日发贴之星   
      

发表于 2004-7-14 10:03 


QUOTE:
最初由 eygle 发布
不是我的错

我引用的时候就说:

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





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


__________________
那都是很好很好的 可是我偏不喜欢
只看该作者    顶部
离线 eygle
天下有雪


精华贴数 65
个人空间 0
技术积分 206875 (1)
社区积分 6449 (240)
注册日期 2001-10-8
论坛徽章:61
现任管理团队成员ITPUB长老会成员ITPUB元老Heart of PUBITPUB维基人ITPUB北京九华山庄2008年会纪念徽章
管理团队2006纪念徽章授权会员2008年新春纪念徽章生肖徽章2007版:猴生肖徽章2007版:龙ITPUB新首页上线纪念徽章

发表于 2004-7-14 10:22 


QUOTE:
最初由 xie3000 发布
摘自:
"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"
一个很不错的网站


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 code:


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.



SQLselect from redo_size;



     
VALUE

----------

    
118024



SQL
drop table test;



Table dropped.



SQLselect from redo_size;



     
VALUE

----------

    
139732



SQL
create table test as select from dba_objects;



Table created.



SQLselect from redo_size;



     
VALUE

----------

    
176864



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



     
REDO2      REDO1

---------- ----------

     
37132      37132



SQL
drop table test;



Table dropped.



SQLshutdown immediate

Database closed
.

Database dismounted.

ORACLE instance shut down.

SQLstartup 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
.

SQLalter database archivelog;



Database altered.



SQLalter 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.



SQLselect from redo_size;



     
VALUE

----------

     
73860



SQL
drop table test;



Table dropped.



SQLselect from redo_size;



     
VALUE

----------

     
95596



SQL
create table test as select from dba_objects;



Table created.



SQLselect from redo_size;



     
VALUE

----------

   
1215092



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



     
REDO2 (73860-35768)

---------- -------------

   
1119496         38092

.

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


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


__________________
只看该作者    顶部
离线 xie3000
防洪专家


精华贴数 1
个人空间 0
技术积分 7333 (180)
社区积分 111 (3309)
注册日期 2002-11-21
论坛徽章:10
ITPUB元老会员2006贡献徽章授权会员生肖徽章2007版:虎ITPUB新首页上线纪念徽章 
      

发表于 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.


__________________
ORACLE DATABASE  ADMINISTRATOR  OCP8I&9I、网络工程师、CCNP
========QQ在线聊天========给我发邮件========
只看该作者    顶部
离线 winkexp
Rock You~


精华贴数 0
个人空间 0
技术积分 1302 (1362)
社区积分 22 (7367)
注册日期 2003-7-18
论坛徽章:2
会员2006贡献徽章授权会员    
      

发表于 2004-7-14 10:42 
up


__________________
Blog:http://blog.itpub.net/winkexp希望增加技术交流和知识共享,共同进步!
只看该作者    顶部
离线 糖醋兔子
斑竹


精华贴数 0
个人空间 0
技术积分 450 (4395)
社区积分 301 (1937)
注册日期 2004-7-1
论坛徽章:3
管理团队2006纪念徽章会员2006贡献徽章数据库板块每日发贴之星   
      

发表于 2004-7-14 11:05 


QUOTE:
最初由 xie3000 发布
口气的确不小
作者Kambhampati Ravi Sudhakar
前面这样说的,是不是由于版本的问题有人在8I上试过吗?


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


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 WindowsVersion 8.1.7.4.0 Production

NLSRTL Version 3.4.1.0.0 
Production 



SQL
archive log list

数据库日志模式             非存档模式

自动存档             启用

存档终点            D
:databaseoracleora817RDBMS

最早的概要信息日志序列     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-91848redo_nolog from dual;



      
REDO REDO_NOLOG

---------- ----------

     
55308     &n

在归档模式下的情况:
PHP code:


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-30520redo,(3125328-3070020redo_nolog from dual;



      
REDO REDO_NOLOG

---------- ----------

   
2923148     &n

在归档模式下的近一步测试,比较ctas和ctas无数据+ insert append 的redo size:
PHP code:


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-3155764logging 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-3155764logging ,(6167588-6110356)nologging from dual;



   
LOGGING  NOLOGGING

---------- ----------

   
2924096     &n

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

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


比较了CTAS和CTAS+insert append后,实际上(archivelog mode):

CTAS nologging redo =CTAS(no data) nologing +insert append redo size;

CTAS redo =CTAS(no data) +insert append redo size;



__________________
那都是很好很好的 可是我偏不喜欢
只看该作者    顶部
离线 winkexp
Rock You~


精华贴数 0
个人空间 0
技术积分 1302 (1362)
社区积分 22 (7367)
注册日期 2003-7-18
论坛徽章:2
会员2006贡献徽章授权会员    
      

发表于 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是无法避免的吧`~


__________________
Blog:http://blog.itpub.net/winkexp希望增加技术交流和知识共享,共同进步!
只看该作者    顶部
离线 xie3000
防洪专家


精华贴数 1
个人空间 0
技术积分 7333 (180)
社区积分 111 (3309)
注册日期 2002-11-21
论坛徽章:10
ITPUB元老会员2006贡献徽章授权会员生肖徽章2007版:虎ITPUB新首页上线纪念徽章 
      

发表于 2004-7-14 11:25 
to :糖醋兔子
事实证明和eygle
的结果一致


__________________
ORACLE DATABASE  ADMINISTRATOR  OCP8I&9I、网络工程师、CCNP
========QQ在线聊天========给我发邮件========
只看该作者    顶部
离线 eygle
天下有雪


精华贴数 65
个人空间 0
技术积分 206875 (1)
社区积分 6449 (240)
注册日期 2001-10-8
论坛徽章:61
现任管理团队成员ITPUB长老会成员ITPUB元老Heart of PUBITPUB维基人ITPUB北京九华山庄2008年会纪念徽章
管理团队2006纪念徽章授权会员2008年新春纪念徽章生肖徽章2007版:猴生肖徽章2007版:龙ITPUB新首页上线纪念徽章

发表于 2004-7-14 11:41 
其实Tom前面的那个例子就是Oracle8i的

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


__________________
只看该作者    顶部
相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问