日期:2014-05-16 浏览次数:20753 次
用实验说明
一、在非归档模式下:
SQL> archive log list 数据库日志模式 非存档模式 自动存档 禁用 存档终点 USE_DB_RECOVERY_FILE_DEST 最早的联机日志序列 2491 当前日志序列 2493
SQL> create or replace view redo_size 2 as 3 select value 4 from v$mystat, v$statname 5 where v$mystat.statistic# = v$statname.statistic# 6 and v$statname.name = 'redo size'; 视图已创建。
用sys用户创建同义词
SQL> create public synonym redo_size for redo_size; 同义词已创建。
以下用scott操作
创建测试表
SQL> create table test_redos as select * from dba_objects where 1=2; 表已创建。
SQL> select * from redo_size;
     VALUE
----------
       736SQL> insert into test_redos select * from dba_objects;
已创建73104行。
SQL> select * from redo_size;
     VALUE
----------
   8473536
SQL> insert /*+ append */ into test_redos select * from dba_objects;
已创建73100行。
SQL> select * from redo_size;
     VALUE
----------
   8504856
SQL> select (8473536-736)普通插入,(8504856-8473536) append插入 from dual;
  普通插入 APPEND插入
---------- ----------
   8472800      31320
二、在归档模式下(在数据库和表空间级别为设置force logging的情况下,默认非force logging):
SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /archive1 Oldest online log sequence 114 Next log sequence to archive 116 Current log sequence 116
①:在表为logging的情况下
SQL>  create table test_redos as select * from dba_objects where 1=2;
Table created.
SQL> select * from redo_size;
     VALUE
----------
     26812
SQL> insert into test_redos select * from dba_objects;
71971 rows created.
SQL> select * from redo_size;
     VALUE
----------
   8490044
SQL> insert /*+ append */ into test_redos select * from dba_objects;
71971 rows created.
SQL> select * from redo_size;
     VALUE
----------
  17001396
SQL> select (8490044-26812)普通插入,(17001396-8490044) append插入 from dual;
  普通插入 APPEND插入
---------- ----------
   8463232    8511352
 ②:在表nologging的情况下
将表设置为nologging模式
SQL> alter table test_redos nologging; Table altered.继续测试
SQL> select * from redo_size;
     VALUE
----------
   8397184
SQL> insert into test_redos select * from dba_objects;
71971 rows created.
SQL> select * from redo_size;
     VALUE
----------
  16801072
SQL> insert /*+ append */ into test_redos select * from dba_objects;
71971 rows created.
SQL> select * from redo_size;
     VALUE
----------
  16836516
SQL> select (16801072-8397184)普通插入,(16836516-16801072) append插入 from dual;
  普通插入 APPEND插入
---------- ----------
   8403888      35444三、在归档force logging模式下:
改变SCOTT用户的默认表空间为force logging模式
SQL> select username,default_tablespace from dba_users where username='SCOTT';
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
SCOTT