[bbk5378] 第89集 -第11章 -数据库诊断 05

oracle在内存中操作数据块,达到一定条件后,往磁盘文件上去读或者写的时候,会检查是否存在坏块.

db_block_checksum参数设置成off的时候,Oracle只针对系统表空间的数据块进行检查,非系统表空间则不关心.

假如db_block_checksum=typical,oracle会在由内存写到磁盘的时候,会检查是否存在坏块.

假如db_block_checksum=full,oracle会在执行DML操作之前,都会检查是否存在坏块.不管是内存中的还是磁盘上的块,只要发生insert,delete,update发生多少次就会检查多少次,如果是内存中的,当往磁盘中写的时候还要检查,提高了数据的安全性,牺牲了数据库性能能.毕竟安全第一嘛,还是值得的.不过oracle推荐值,默认值是typical。

解读db_lost_write_protect参数:

  none,表空间丢失写保护的功能没有打开

  typical,对于可读可写的表空间,其丢失写保护的功能打开.

  full,对于只读性的表空间,其丢失数据写保护的功能打开.

假如想实现数据库块的恢复,首先需要识别出哪些块坏了,坏在哪个表空上,哪个数据文件上,要实现上述要求,首先需要设置Oracle初始化参数,来开启此项功能,具体设置要求如下:

DB_ULTRA_SAFE OFF DATA_ONLY DATA_AND_INDEX
DB_BLOCK_CHECKING OFF or FALSE MEDIUM FULL or TRUE
DB_BLOCK_CHECKSUM TYPICAL FULL FULL
DB_BLOCK_WRITE_PROTECT TYPICAL TYPICAL TYPICAL

 

 

 

 

 

表功能性解读:当DB_ULTRA_SAFE设置为OFF时,DB_BLOCK_CHECKING自动设置为OFF or FALSE

                        DB_BLOCK_CHECKSUM自动设置为TYPICAL

                        DB_BLOCK_WRITE_PROTECT自动设置为TYPICAL

Block Media Recovery

  • Lowers the mean time to recover(MTTR)
  • Increases availability during media recovery
    • -The data file remains online during recovery
    • -Only blocks being recovered are inaccessible
  • Is invoked using the RMAN RECOVER...BLOCK command
    • Restores blocks using flashback logs and full or level 0 backups
    • Media recovery is performed using redo logs
  • The V$DATABASE_BLOCK_CORRUPTION view displays blocks marked corrupt.

在进行坏块恢复的时候,数据库处于Online状态,其他无损的块任然可以正常访问,只是修复坏块;如此以来提高了数据库的可访问性.    

Prerequisites for Block Media Recovery(块媒介恢复的先决条件)

  • The target database must be in ARCHIVELOG mode.
  • The backups of the data files containing the corrupt blocks must be full or level 0 backups
    • -Proxy copies must be restored to a non-default location before they can be used.
  • RMAN can use only archived redo logs for the recovery.
  • The corrupted data block can be restored form Flashback logs if available.

The RECOVER...BLOCK Command

The RMAN RECOVER...BLOCK command:

  • Identifies the backups containing the blocks to recover
  • Reads the backups and accumulates requested blocks into in-memory buffers
  • Manages the block media recovery session by reading the archive logs from backup if necessary.
RECOVER DATAFILE 6 BLOCK 3;--Recover a single block



RECOVER        --Recover multiple blocks in multiple data files
DATAFILE 2 BLOCK 43

DATAFILE 2 BLOCK 79

DATAFILE 6 BLOCK 183;



RECOVER CORRUPTION LIST; --Recover all blocks logged in V$DATABASE_BLOCK_CORRUPTION

 

 

posted @ 2013-06-05 16:51  ArcerZhang  阅读(293)  评论(0编辑  收藏  举报