Oracle 減少redo size的方法

來源:互聯網
上載者:User

用實驗說明

一、在非歸檔模式下:

SQL> archive log list
資料庫記錄模式            非存檔模式
自動封存            禁用
存檔終點            USE_DB_RECOVERY_FILE_DEST
最早的聯機日誌序列    2491
當前日誌序列          2493

用sys使用者建立查詢redo size的視圖(方便查詢)

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;

表已建立。

查看當前redo量

SQL> select * from redo_size;

    VALUE
----------
      736

插入資料,看結果

SQL> 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

以上結果說明在非歸檔模式下,append插入資料產生的redo要少得多。

  • 1
  • 2
  • 3
  • 下一頁

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.