|
数据库版本10.2.0.2
书上说使用直接路径插入在标记为nologging的表上执行操作是才能绕过重做日志的生成
故测试如下;
1.创建表
create table rainbow_objects as select * from dba_objects where 1=2;
2.检查该表属性
SQL> select LOGGING from dba_tables where table_name='RAINBOW_OBJECTS';
LOGGING
---------
YES
3.set autotrace traceonly statistics
4.测试插入产生的redo
方法1 正常插入
SQL> insert into rainbow_objects select * from dba_objects;
40352 rows created.
Statistics
----------------------------------------------------------
1419 recursive calls
5650 db block gets
4104 consistent gets
4 physical reads
4597764 redo size
840 bytes sent via SQL*Net to client
749 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
13 sorts (memory)
0 sorts (disk)
40352 rows processed
方法2 直接路径插入
SQL> insert /*+append*/ into rainbow_objects select * from dba_objects;
40352 rows created.
Statistics
----------------------------------------------------------
184 recursive calls
699 db block gets
2750 consistent gets
0 physical reads
13692 redo size
824 bytes sent via SQL*Net to client
764 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
40352 rows processed
结果发现redo size 得到了明显的减少,这是为什么,我的表还没设置为nologging啊 |
|