Oracle PL/SQL

1、查询当前归档模式

select name,log_mode from v$database;

2、查询当前redo size

select b.sid,a.name,a.value from v$sysstat a,v$mystat b where a.statistic#=b.statistic# and a.name like 'redo size%';

 3、在表为非归档模式下,且为nologging表,使用/*+ append*/进行insert操作可以减少大量的redo size。其中redo_size表为我们查询系统redo size表建立的视图

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

总结:

非归档模式下:nologging表使用append能大量减少redo量。

归档模式下:在表空间和数据库级非force logging模式下,表如果是nologging,则append能大量减少redo量。

原文地址:https://www.cnblogs.com/ZeroMZ/p/10793799.html