[20150309]热备份与redo.txt
-- 最近一段时间看关于备份的书籍,提到热备份期间,如果对某块做dml操作,redo 日志里面是包含整个数据库,防止出现块分裂。
-- http://blog.itpub.net/267265/viewspace-1441552/
--实际上仅仅第1次会做,后续的dml就不会做这样的操作,做一个测试例子:
1.测试环境:
SCOTT@test> @ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.3.0 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
SCOTT@test> alter tablespace users begin backup ;
Tablespace altered.
2.开始测试:
SCOTT@test> set autot traceonly
SCOTT@test> update dept set loc=upper(loc) ;
4 rows updated.
Execution Plan
----------------------------------------------------------
Plan hash value: 921533340
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | UPDATE STATEMENT | | 4 | 32 | 3 (0)| 00:00:01 |
| 1 | UPDATE | DEPT | | | | |
| 2 | TABLE ACCESS FULL| DEPT | 4 | 32 | 3 (0)| 00:00:01 |
---------------------------------------------------------------------------
Statistics
----------------------------------------------------------
0 recursive calls
5 db block gets
8 consistent gets
0 physical reads
9664 redo size
834 bytes sent via SQL*Net to client
784 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
4 rows processed
SCOTT@test> commit ;
Commit complete.
--可以发现产生的redo size=9664.
3.如果我后续依旧做这样的操作:
SCOTT@test> update dept set loc=lower(loc) ;
4 rows updated.
Execution Plan
----------------------------------------------------------
Plan hash value: 921533340
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | UPDATE STATEMENT | | 4 | 32 | 3 (0)| 00:00:01 |
| 1 | UPDATE | DEPT | | | | |
| 2 | TABLE ACCESS FULL| DEPT | 4 | 32 | 3 (0)| 00:00:01 |
---------------------------------------------------------------------------
Statistics
----------------------------------------------------------
0 recursive calls
5 db block gets
8 consistent gets
0 physical reads
1436 redo size
837 bytes sent via SQL*Net to client
784 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
4 rows processed
SCOTT@test> commit ;
Commit complete.
--可以发现产生的redo size=1436.
--再次证明,仅仅第1次产生的redo包含整个数据块,后续的修改就不需要这样了。