(f)--閃回恢復區-- 並行載入對閃庫的影響
nologging 模式
當要批次載入資料時,資料庫還記錄redo,很影響載入速度.這是沒必要的,但預設情況下是記錄redo的.
資料庫為保證批次載入資料時避免產生redo,以提高載入速度,提供了強制和不強制記錄日誌功能
建立實驗表
SQL> drop table t1 purge;
Table dropped.
SQL> drop table t2 purge;
Table dropped.
SQL> create table t1 as select * from scott.emp;
Table created.
SQL> create table t2 as select * from scott.emp where 0=9;
Table created.
SQL> insert into t1 select * from t1;
14 rows created.
SQL>
......
SQL> /
1792 rows created.
SQL> commit;
Commit complete.
SQL>
SQL> select FORCE_LOGGING from v$database;
FOR
---
NO
SQL>
計算當前會話redo的大小指令碼
SQL> ! cat mystat.sql
set echo off
set verify off
column value new_val V
define S='redo size'
set autotrace off
select a.name, b.value
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
/
SQL>
SQL> ! cat mystat2.sql
set echo off
set verify off
column value new_val V
define S='redo size'
select a.name, b.value V, to_char(b.value-&V,'999999999') diff
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
/
set echo on
SQL>
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1054292
SQL> insert into t2 select * from t1 nologging;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1242168 187876
SQL>
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1242168
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL> commit;
Commit complete.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1247896 5728
SQL>
SQL> alter table t2 nologging;
Table altered.
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1249948
SQL> insert /*+ append */ into t2 select * from t1;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1255464 5516
SQL> commit;
Commit complete.
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1256004
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1256488 484
SQL>
雖然此時載入資料速度提高了 但卻對閃庫有了負面影響
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1256488 484
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
927990
SQL>
SQL> commit;
Commit complete.
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL>
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 79693392 bytes
Database Buffers 201326592 bytes
Redo Buffers 2973696 bytes
SQL> alter database mount;
Database altered.
SQL> flashback database to scn 927990;
Flashback complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select count(*) from t2;
select count(*) from t2
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 1, block # 60721)
ORA-01110: data file 1: '/db254/system01.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option
SQL>
將資料庫改為強制日誌模式
alter database force logging;
alter database no force nologging;
強制模式
忽略表nologging引數
忽略語句nologging引數
忽略hint /*+ append */
當要批次載入資料時,資料庫還記錄redo,很影響載入速度.這是沒必要的,但預設情況下是記錄redo的.
資料庫為保證批次載入資料時避免產生redo,以提高載入速度,提供了強制和不強制記錄日誌功能
建立實驗表
SQL> drop table t1 purge;
Table dropped.
SQL> drop table t2 purge;
Table dropped.
SQL> create table t1 as select * from scott.emp;
Table created.
SQL> create table t2 as select * from scott.emp where 0=9;
Table created.
SQL> insert into t1 select * from t1;
14 rows created.
SQL>
......
SQL> /
1792 rows created.
SQL> commit;
Commit complete.
SQL>
SQL> select FORCE_LOGGING from v$database;
FOR
---
NO
SQL>
計算當前會話redo的大小指令碼
SQL> ! cat mystat.sql
set echo off
set verify off
column value new_val V
define S='redo size'
set autotrace off
select a.name, b.value
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
/
SQL>
SQL> ! cat mystat2.sql
set echo off
set verify off
column value new_val V
define S='redo size'
select a.name, b.value V, to_char(b.value-&V,'999999999') diff
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
/
set echo on
SQL>
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1054292
SQL> insert into t2 select * from t1 nologging;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1242168 187876
SQL>
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1242168
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL> commit;
Commit complete.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1247896 5728
SQL>
SQL> alter table t2 nologging;
Table altered.
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1249948
SQL> insert /*+ append */ into t2 select * from t1;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1255464 5516
SQL> commit;
Commit complete.
SQL> @mystat
SQL> set echo off
NAME VALUE
-------------------------------------------------- ----------
redo size 1256004
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1256488 484
SQL>
雖然此時載入資料速度提高了 但卻對閃庫有了負面影響
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL> @mystat2
NAME V DIFF
-------------------------------------------------- ---------- ----------
redo size 1256488 484
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
927990
SQL>
SQL> commit;
Commit complete.
SQL> insert /*+ append */ into t2 select * from t1 nologging;
3584 rows created.
SQL>
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 79693392 bytes
Database Buffers 201326592 bytes
Redo Buffers 2973696 bytes
SQL> alter database mount;
Database altered.
SQL> flashback database to scn 927990;
Flashback complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select count(*) from t2;
select count(*) from t2
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 1, block # 60721)
ORA-01110: data file 1: '/db254/system01.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option
SQL>
將資料庫改為強制日誌模式
alter database force logging;
alter database no force nologging;
強制模式
忽略表nologging引數
忽略語句nologging引數
忽略hint /*+ append */
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28602568/viewspace-758933/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle -- 閃回恢復區---實踐1---閃回庫Oracle
- (f)--閃回恢復區---實踐2---閃回表(閃回DML部分資料會用到閃回查詢)
- Oracle閃回恢復區Oracle
- Oracle資料庫的閃回恢復區Oracle資料庫
- (f)--閃回恢復區---實踐3---閃回查詢(基於AUM (auto undo managemet))
- 【備份恢復】閃回資料庫(一)閃回資料庫的管理資料庫
- Oracle10g閃回恢復區詳解--開啟,設定閃回區Oracle
- 【備份恢復】閃回資料庫(五)RMAN 命令列閃回資料庫資料庫命令列
- 【備份恢復】閃回資料庫(二) 基於 SCN 閃回資料庫資料庫
- Backup And Recovery User's Guide-使用閃回資料庫-監控閃回資料庫對效能的影響GUIIDE資料庫
- 【備份恢復】 閃回技術之閃回刪除
- Oracle10g閃回恢復區詳解Oracle
- 【備份恢復】閃回技術之閃回版本查詢
- 【備份恢復】閃回資料庫(三)基於時間戳閃回資料庫資料庫時間戳
- 【備份恢復】閃回資料庫(四)基於可靠還原點閃回資料庫資料庫
- Oracle DBA2 ---- 閃回恢復Oracle
- 閃回查詢恢復過程
- 【備份恢復】 閃回技術之閃迴歸檔
- oralce恢復誤刪除的表中的資料(閃回、閃回查詢)
- oracle 閃回基於時間的恢復Oracle
- Orcale利用閃回功能恢復資料
- (f)--閃回恢復區-- 報錯ORA-00257: archiver error. Connect internal HiveError
- 閃回(關於閃回資料庫)資料庫
- Oracle資料庫的閃回恢復區及多歸檔路徑的設定Oracle資料庫
- 【備份恢復】 閃回技術之閃回事務處理查詢
- 閃回恢復一個表中的資料
- 對錶誤操作的閃回恢復--flashback_transaction_query檢視
- oracle10g新特性:閃回恢復區(Flash recovery area)Oracle
- 閃回查詢恢復誤刪資料
- Oracle procedure,package,function,triger 閃回 恢復OraclePackageFunction
- Data Guard高階玩法:通過閃回恢復switchover主庫
- Oracle的閃回恢復區和歸檔日誌多路徑設定Oracle
- [z] 利用閃回恢復被覆蓋的Oracle PACKAGE包OraclePackage
- Oracle閃回技術之閃回資料庫Oracle資料庫
- Oracle閃回刪除恢復誤刪資料Oracle
- 使用RMAN對PDB執行閃回資料庫操作資料庫
- 使用RMAN對CDB執行閃回資料庫操作資料庫
- 清空 oracle 閃回區Oracle