部分联机备份为什么产生更多的日志

本文探讨了在线备份过程中可能出现的不一致数据问题,特别是断裂块的现象及其在不使用RMAN进行备份时的预防措施。重点介绍了在进行备份时如何避免生成断裂块,并通过SQL*Plus实现用户管理恢复过程中的修复。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Detection ofFractured Blocks During Open Backups

One danger in making online backups is thepossibility of inconsistent data within a block. For example, assume that youare backing up block 100 in datafile users.dbf. Also, assumethat the copy utility reads the entire block while DBWR is in the middle ofupdating the block. In this case, the copy utility may read the old data in thetop half of the block and the new data in the bottom top half of the block. Theresult is called a fractured block, meaningthat the data contained in this block is not consistent. at a given SCN.

When performing backups of an opentablespace without using RMAN, you must put tablespaces in backupmode to prevent the creation of fractured blocks in your backup. Whennot in backup mode, the database records only changed bytes in the redo stream.When a tablespace is in backup mode, each time a block is changed the databasewrites the before-image of the entire block to the redo stream before modifyingthe block. Then, the database also records the changes to the block in the redolog. During user-managed recovery using SQL*Plus, the database applies both thecaptured block images and the recorded block changes from the redo logs.Applying the block images repairs any possible fractured blocks in the backupbeing restored and recovered.

RMAN does not require that you putdatafiles into backup mode. During an RMAN backup, a database server sessionreads each block of the datafile and checks whether each block is fractured bycomparing the block header and footer. If a block is fractured, the sessionre-reads the block. If the same fracture is found, then the block is consideredpermanently corrupt. If MAXCORRUPT is exceeded,the backup stops.

实验证明:

SQL> col name for a10

SQL> select b.name,a.value fromv$sysstat a,v$statname b where  b.namelike '%redo size%' and a.STATISTIC# =b.STATISTIC#;

NAME            VALUE

----------        ----------

redo size       55436588

 

SQL> insert into t values (3,'xl',10);

已创建 1 行。

SQL> select b.name,a.value fromv$sysstat a,v$statname b where  b.namelike '%redo size%' and a.STATISTIC# =b.STATISTIC#;

NAME            VALUE

----------         ----------

redo size        55437056

SQL> select  55437056 - 55436588 from dual;

55437056-55436588

-----------------

      468

SQL> alter tablespaceZXNTAGL_TS_DATA_TAGL begin backup;

表空间已更改。

SQL> select * from v$backup;

FILE# STATUS                                  CHANGE# TIME

----------                 ---------------------------------------------- --------------

 1NOT ACTIVE                           157372534 10-2月 -12

 2NOT ACTIVE                           157372534 10-2月 -12

 3NOT ACTIVE                            157372534 10-2月 -12

 4NOT ACTIVE                           157372534 10-2月 -12

 5ACTIVE                               157376625 11-2月 -12

 6NOT ACTIVE                           157372534 10-2月 -12

 7NOT ACTIVE                            157372534 10-2月 -12

已选择7行。

SQL> select b.name,a.value fromv$sysstat a,v$statname b where  b.namelike '%redo size%' and a.STATISTIC# =b.STATISTIC#;

NAME            VALUE

----------        ----------

redo size       55440792

SQL> insert into t values (3,'xl',10);

已创建 1 行。

SQL> select b.name,a.value fromv$sysstat a,v$statname b where  b.namelike '%redo size%' and a.STATISTIC# =b.STATISTIC#;

NAME            VALUE

----------         ----------

redo size        55454740

SQL> select  55454740 - 55440792 from dual;

55454740-55440792

-----------------

    13948

SQL> select 13948 - 468 from dual;

 13948-468

----------

  13480

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值