alter table test_table nologging;没有效果,redo日志还是一样多

delphisanding1 2011-07-12 10:14:01
create test_table as select * from all_objects where 1=0;
set autot on stat
insert into test_table select * from all_objects;

统计信息
-------------------------------
65137 recursive calls
4107 db block gets
69566 consistent gets
380 physical reads
5567760 redo size
668 bytes sent via SQL
576 bytes received via
4 SQL*Net roundtrips
371 sorts (memory)
0 sorts (disk)
49375 rows processed

然后我:alter table test_table nologging;
再次:insert into test_table select * from all_objects;
还是显示:

统计信息
--------------------------------
6314 recursive calls
3860 db block gets
38841 consistent gets
78 physical reads
5536272 redo size
673 bytes sent via SQL*
576 bytes received via
4 SQL*Net roundtrips
20 sorts (memory)
0 sorts (disk)
49375 rows processed

redo信息为什么还是一样多?nologging不起作用?

我的是10G的,为什么9I的这样设置是可以的,设置nologging后redo信息只有1/10了。
...全文
1049 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
河蟹哥哥 2011-07-12
  • 打赏
  • 举报
回复
昨天也为这个nologging搜索,总结一下
1.查询当前数据库的归档状态:
select name,log_mode from v$database;
默认为 NOARCHIVELOG 非归档
2.在非归档模式下,update是否使用nologging没有效果。
在归档模式下,update是否使用nologging对提高速度有较明显的效果。
3.为了提高插入的速度,我们可以对表关闭写log功能。 SQL 如下:
sql> alter table table_name NOLOGGING;
插入/修改,完数据后,再修改表写日志:
sql> alter table table_name LOGGING;
4.没有写log, 速度会块很多,但是也增加了风险,如果出现问题就不能恢复。
所以具体情况,具体对待..
  • 打赏
  • 举报
回复
The NOLOGGING clause also specifies that subsequent direct loads using SQL*Loader and direct load INSERT operations are not logged. Subsequent DML statements (UPDATE, DELETE, and conventional path insert) are unaffected by the NOLOGGING attribute of the table and generate redo

--oracle官方文档上的解释
delphisanding1 2011-07-12
  • 打赏
  • 举报
回复
为什么direct load方式与普通插入数据方式

nologging与logging两种模式有这么大区别?
delphisanding1 2011-07-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 tangren 的回复:]
确认你的数据库是否处于归档模式,非归档模式nologging不起什么作用。
[/Quote]

数据库是归档模式的,我用2楼的插入语句,就少了很多redo信息。
delphisanding1 2011-07-12
  • 打赏
  • 举报
回复
我懂了,是不是对于普通的插入数据,nologgin不起作用?

我如果输入下面的语句,也就是通过direct load的方式插入,就会少很多redo信息:

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


统计信息
--------------------------------
5339 recursive calls
744 db block gets
34397 consistent gets
0 physical reads
9984 redo size
658 bytes sent via SQL*
590 bytes received via
4 SQL*Net roundtrips
5 sorts (memory)
0 sorts (disk)
49375 rows processed
tangren 2011-07-12
  • 打赏
  • 举报
回复
确认你的数据库是否处于归档模式,非归档模式nologging不起什么作用。

17,382

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧