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
----------
0
----------------创建表----------------------------
SQL> create table test tablespace test as select * from dba_objects;
表已创建。
SQL> select * from redo_size;
VALUE
----------
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行。
SQL> select * from redo_size;
VALUE
----------
16686608
SQL> select (16686608-8432324) redo from dual;
REDO
----------
8254284
SQL> insert /*+ append*/ into test select * from dba_objects;
已创建68982行。
SQL> select * from redo_size;
VALUE
----------
25066556
SQL> select (25066556-16686608) redo from dual;
REDO
----------
8379948
SQL> select (25066556-16686608) redo_append,(16686608-8432324) redo from dual;
REDO_APPEND REDO
----------- ----------
8379948 > 8254284
SQL> truncate table test ;
表被截断。
SQL> drop table test ;
表已删除。
----------------创建nologging表----------------------------
SQL> select * from redo_size;
VALUE
----------
33635864
SQL> create table testnolog nologging as select * from dba_objects where 1=0;
表已创建。
SQL> select count(*) from testnolog;
COUNT(*)
----------
0
SQL> select * from redo_size;
VALUE
----------
33657684
SQL> select table_name,logging,owner
2 from dba_tables where table_name='TESTNOLOG';
TABLE_NAME LOG OWNER
------------------------------ --- ------------------------------
TESTNOLOG NO SYS
SQL> select * from redo_size;
VALUE
----------
33657684
SQL> insert into testnolog select * from dba_objects;
已创建68982行。
SQL> select * from redo_size;
VALUE
----------
41941584
SQL> insert [b ]/*+append*/ into testnolog select * from dba_objects;
已创建68982行。
SQL> select * from redo_size;
VALUE
----------
50298684
SQL> select (50298684-41941584) redo_append,(41941584-33657684) redo from dual;
REDO_APPEND REDO
----------- ----------
8357100 8283900
已连接。
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
----------
0
----------------创建表----------------------------
SQL> create table test tablespace test as select * from dba_objects;
表已创建。
SQL> select * from redo_size;
VALUE
----------
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行。
SQL> select * from redo_size;
VALUE
----------
16686608
SQL> select (16686608-8432324) redo from dual;
REDO
----------
8254284
SQL> insert /*+ append*/ into test select * from dba_objects;
已创建68982行。
SQL> select * from redo_size;
VALUE
----------
25066556
SQL> select (25066556-16686608) redo from dual;
REDO
----------
8379948
SQL> select (25066556-16686608) redo_append,(16686608-8432324) redo from dual;
REDO_APPEND REDO
----------- ----------
8379948 > 8254284
SQL> truncate table test ;
表被截断。
SQL> drop table test ;
表已删除。
----------------创建nologging表----------------------------
SQL> select * from redo_size;
VALUE
----------
33635864
SQL> create table testnolog nologging as select * from dba_objects where 1=0;
表已创建。
SQL> select count(*) from testnolog;
COUNT(*)
----------
0
SQL> select * from redo_size;
VALUE
----------
33657684
SQL> select table_name,logging,owner
2 from dba_tables where table_name='TESTNOLOG';
TABLE_NAME LOG OWNER
------------------------------ --- ------------------------------
TESTNOLOG NO SYS
SQL> select * from redo_size;
VALUE
----------
33657684
SQL> insert into testnolog select * from dba_objects;
已创建68982行。
SQL> select * from redo_size;
VALUE
----------
41941584
SQL> insert [b ]/*+append*/ into testnolog select * from dba_objects;
已创建68982行。
SQL> select * from redo_size;
VALUE
----------
50298684
SQL> select (50298684-41941584) redo_append,(41941584-33657684) redo from dual;
REDO_APPEND REDO
----------- ----------
8357100 8283900
原因:
以前在测试机上做了dataguard 的实验,数据库为Force Logging模式。
指定数据库为Force Logging模式后,数据库将会记录除临时表空间或临时回滚段外所有的操作,而忽略类似NOLOGGING之类的指定参数。
指定数据库为Force Logging模式后,数据库将会记录除临时表空间或临时回滚段外所有的操作,而忽略类似NOLOGGING之类的指定参数。