首頁 資料庫 mysql教程 validate命令---rman进行备份和回复的验证

validate命令---rman进行备份和回复的验证

Jun 07, 2016 pm 04:10 PM
validate 命令 回覆 備份 進行

rman作为oracle备份与恢复工具,为我们提供了强大的功能,其中包括对数据文件的物理和逻辑检测以及备份文件的有效性检测。 首先,来看一下rman对数据文件的检测。我们知道,rman在备份数据时,会将数据读入读缓存,然会将数据从读缓存写入写缓存并最终写入数

rman作为oracle备份与恢复工具,为我们提供了强大的功能,其中包括对数据文件的物理和逻辑检测以及备份文件的有效性检测。

首先,来看一下rman对数据文件的检测。我们知道,rman在备份数据时,会将数据读入读缓存,然会将数据从读缓存写入写缓存并最终写入数据库。在从读缓存到写缓存的过程中,rman会进行物理一致性的检测(db_block_checksum未true)和逻辑一致性检测(使用了check logical选项)。例如:

SQL> show parameter db_block

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
db_block_buffers		     integer	 0
db_block_checking		     string	 FALSE
db_block_checksum		     string	 TRUE
db_block_size			     integer	 8192
SQL> 
登入後複製
RMAN> backup tablespace test1;

Starting backup at 2014-11-06 15:12:49
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/home/app/oraten/oradata/oraten/test01.dbf
channel ORA_DISK_1: starting piece 1 at 2014-11-06 15:12:50
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/06/2014 15:12:51
ORA-19566: exceeded limit of 0 corrupt blocks for file /home/app/oraten/oradata/oraten/test01.dbf
登入後複製

有时,我们仅仅希望验证一下数据文件是否可以备份,而不想进行真正的备份,这是我们就可以使用validate命令了,如

RMAN> backup validate database;

Starting backup at 2014-11-06 15:14:23
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/app/oraten/oradata/oraten/system01.dbf
input datafile fno=00003 name=/home/app/oraten/oradata/oraten/sysaux01.dbf
input datafile fno=00002 name=/home/app/oraten/oradata/oraten/undotbs01.dbf
input datafile fno=00005 name=/home/app/oraten/oradata/oraten/test01.dbf
input datafile fno=00004 name=/home/app/oraten/oradata/oraten/users01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2014-11-06 15:14:27
登入後複製
注意,这里并没有发现test01.dbf的物理损坏块,个人认为,rman仅仅只是将数据文件读入了读缓存,而没有进行下面的操作,也就是说对于物理块的检测其功能是有限的,但,我们可以用其来检测物理文件的可读性和位置等。

下面是官方文档中的描述:

VALIDATE Causes RMAN to scan the specified files and verify their contents, testing whether this file can be backed up. RMAN creates no output files. Use this
command periodically to check for physical and logical errors in database files.

使用validate命令可以验证备份集的有效性,官方文档:

To examine a backup set and report whether it can be restored. RMAN scans all of the backup pieces in the specified backup sets and looks at the checksums to verify that
the contents are intact so that the backup can be successfully restored if necessary. Use this command when you suspect that one or more backup pieces in a backup set
are missing or have been damaged. Use VALIDATE BACKUPSET to specify which backups to test; use the VALIDATE option of the RESTORE command to let RMAN
choose which backups to validate. For validating image copies, run RESTORE VALIDATE FROM DATAFILECOPY

示例:

RMAN> run {
2> set maxcorrupt for datafile 5 to 2;
3> backup database;}
登入後複製
RMAN> validate backupset 84;

using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T152820_b5p8ro7v_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T152820_b5p8ro7v_.bkp tag=TAG20141106T152820
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
登入後複製
validate命令验证的是备份的物理有效性而不是存储在备份中的数据块的物理有效性。

RESTORE ... PREVIEW

该命令进行restore命令的预演,可以在任何resotre命令后加上preview来进行还原预演,这个命令只是从数据字典读出需要的备份的元数据,不进行文件的验证。
You can apply RESTORE ... PREVIEW to any RESTORE operation to create a detailed list of every backup to be used in the requested RESTORE operation, as well as the necessary target SCN for recovery after the RESTORE operation is complete. This command accesses the RMAN repository to query the backup metadata, but does not actually read the backup files to ensure that they can be restored.

RMAN> restore database preview;

Starting restore at 2014-11-06 15:44:28
using channel ORA_DISK_1


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
84      Full    551.76M    DISK        00:00:18     2014-11-06 15:28:24
        BP Key: 52   Status: AVAILABLE  Compressed: NO  Tag: TAG20141106T152820
        Piece Name: /home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T152820_b5p8ro7v_.bkp
  List of Datafiles in backup set 84
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1       Full 922948     2014-11-06 15:28:20 /home/app/oraten/oradata/oraten/system01.dbf
  2       Full 922948     2014-11-06 15:28:20 /home/app/oraten/oradata/oraten/undotbs01.dbf
  3       Full 922948     2014-11-06 15:28:20 /home/app/oraten/oradata/oraten/sysaux01.dbf
  4       Full 922948     2014-11-06 15:28:20 /home/app/oraten/oradata/oraten/users01.dbf
  5       Full 922948     2014-11-06 15:28:20 /home/app/oraten/oradata/oraten/test01.dbf

archive logs generated after SCN 922948 not found in repository
Media recovery start SCN is 922948
Recovery must be done beyond SCN 922948 to clear data files fuzziness
Finished restore at 2014-11-06 15:44:28
登入後複製
RECOVER ... TEST:在内存中模拟recover过程,并不进行真正的recovery,可以用该命令来提起发现recovery中的问题。注意,模拟的recovery和正常recovery可能会遇到不同的问题。
A simulated recovery initiated with the RECOVER ... TEST command in RMAN or SQL*Plus. A trial recovery applies redo in a way similar to normal media recovery, but it never writes its changes to disk and it always rolls back its changes. Trial recovery occurs only in memory.
Trial recovery lets you foresee what problems might occur if you were to continue with normal recovery. For problems caused by ongoing memory corruption, trial recovery and normal recovery can encounter different errors.
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

無法引導到Windows復原環境 無法引導到Windows復原環境 Feb 19, 2024 pm 11:12 PM

無法引導到Windows復原環境

如何在Windows 11/10中執行SUDO命令 如何在Windows 11/10中執行SUDO命令 Mar 09, 2024 am 09:50 AM

如何在Windows 11/10中執行SUDO命令

使用ddrescue在Linux上恢復數據 使用ddrescue在Linux上恢復數據 Mar 20, 2024 pm 01:37 PM

使用ddrescue在Linux上恢復數據

如何在Windows 11的檔案總管中刪除啟動備份 如何在Windows 11的檔案總管中刪除啟動備份 Feb 18, 2024 pm 05:40 PM

如何在Windows 11的檔案總管中刪除啟動備份

win11網卡mac位址怎麼查? Win11使用指令取得網路卡MAC位址方法 win11網卡mac位址怎麼查? Win11使用指令取得網路卡MAC位址方法 Feb 29, 2024 pm 04:34 PM

win11網卡mac位址怎麼查? Win11使用指令取得網路卡MAC位址方法

hyperv增強會話模式在哪? Win11用指令啟用或停用Hyper-V增強會話模式技巧 hyperv增強會話模式在哪? Win11用指令啟用或停用Hyper-V增強會話模式技巧 Feb 29, 2024 pm 05:52 PM

hyperv增強會話模式在哪? Win11用指令啟用或停用Hyper-V增強會話模式技巧

hosts檔案刪了怎麼恢復 hosts檔案刪了怎麼恢復 Feb 22, 2024 pm 10:48 PM

hosts檔案刪了怎麼恢復

超實用!讓你成為Linux大神的Sar命令 超實用!讓你成為Linux大神的Sar命令 Mar 01, 2024 am 08:01 AM

超實用!讓你成為Linux大神的Sar命令

See all articles