SQL> conn system/yang as sysdba
已连接。
SQL> create or replace view redo_size
2 as
3 select value
4 from v$mystat m,v$statname s
5 where m.statistic#=s.statistic#
6* and s.name='redo size'
SQL> select * from redo_size;
VALUE
----------
<b>----------------创建表----------------------------</b>
SQL> create table test tablespace test as select * from dba_objects;
表已创建。
8432324
SQL> select table_name ,logging,owner from dba_tables where table_name='TEST';
TABLE_NAME LOG OWNER
------------------------------ --- ------------------------------
TEST YES SCOTT
TEST YES SYS
SQL> show user
USER 为 "SYS"
SQL> insert into test select * from dba_objects;
已创建68982行。
16686608
SQL> select (16686608-8432324) redo from dual;
REDO
8254284
<b>SQL> insert /*+ append*/ into test select * from dba_objects;</b>
25066556
SQL> select (25066556-16686608) redo from dual;
8379948
SQL> select (25066556-16686608) redo_append,(16686608-8432324) redo from dual;
<b>REDO_APPEND REDO </b>
----------- ----------
8379948 <b>></b><b> 8254284</b>
SQL> truncate table test ;
表被截断。
SQL> drop table test ;
表已删除。
<b>----------------创建nologging表----------------------------</b>
33635864
SQL> create table testnolog <b>nologging</b> as select * from dba_objects where 1=0;
SQL> select count(*) from testnolog;
COUNT(*)
33657684
SQL> select table_name,logging,owner
2 from dba_tables where table_name='TESTNOLOG';
TESTNOLOG NO SYS
SQL> insert into testnolog select * from dba_objects;
41941584
SQL> insert [b]/*+append*/ into testnolog select * from dba_objects;
50298684
SQL> select (50298684-41941584) redo_append,(41941584-33657684) redo from dual;
REDO_APPEND REDO
----------- ----------
<b>8357100 </b> <b>8283900 </b>
原因:
以前在测试机上做了dataguard 的实验,数据库为Force Logging模式。
指定数据库为Force Logging模式后,数据库将会记录除临时表空间或临时回滚段外所有的操作,而忽略类似NOLOGGING之类的指定参数。