dbv工具可以用来验证数据文件的有效性,在数据库恢复之前可以使用该命令对备份文件进行有效性检查,防止因备份文件本身的问题导致数据库无法恢复。
当然,dbv命令也可以对在线的数据文件进行检查。
注意,dbv工具只可以对数据文件进行检查,无法使用它完成控制文件和日志文件的检查。
1.dbv命令语法
dbverify ::=
dbv [ USERID=username/password ]
FILE = filename
| { START = block_address | END = block_address }
| BLOCKSIZE = integer
| HIGH_SCN = integer
| LOGFILE = filename
| FEEDBACK = integer
| HELP = { Y | N }
| PARFILE = filename
End of description.
参考自Oracle官方文档http://download.oracle.com/docs/cd/E11882_01/server.112/e10701/img_text/dbverify.htm
2.查看帮助文档
从语法定义中我们看到“HELP = { Y | N }”选项,我们可以使用它查看dbv的帮助信息。
secooler@secDB /home/oracle$ dbv help=y
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Mar 31 19:47:36 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Keyword Description (Default)
----------------------------------------------------
FILE File to Verify (NONE)
START Start Block (First Block of File)
END End Block (Last Block of File)
BLOCKSIZE Logical Block Size (8192)
LOGFILE Output Log (NONE)
FEEDBACK Display Progress (0)
PARFILE Parameter File (NONE)
USERID Username/Password (NONE)
SEGMENT_ID Segment ID (tsn.relfile.block) (NONE)
HIGH_SCN Highest Block SCN To Verify (NONE)
(scn_wrap.scn_base OR scn)
帮助信息中描述了dbv命令的使用方法,不赘述。
3.体验dbv工具的效果
1)查看系统中的数据文件名称
sys@secooler> col name for a60
sys@secooler> select name from v$datafile;
NAME
------------------------------------------------------------
/oracle/ora11gR2/oradata/secooler/system01.dbf
/oracle/ora11gR2/oradata/secooler/sysaux01.dbf
/oracle/ora11gR2/oradata/secooler/undotbs01.dbf
/oracle/ora11gR2/oradata/secooler/users01.dbf
2)使用dbv工具对users01.dbf进行检查
(1)使用最简单的参数
sys@secooler> !dbv file=/oracle/ora11gR2/oradata/secooler/users01.dbf
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Mar 31 19:50:59 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /oracle/ora11gR2/oradata/secooler/users01.dbf
DBVERIFY - Verification complete
Total Pages Examined : 35520
Total Pages Processed (Data) : 33029
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 20
Total Pages Failing (Index): 0
Total Pages Processed (Other): 402
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 2069
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 9291961 (0.9291961)
在实际使用中重点关注以下信息:
Total Pages Failing (Data) : 0
Total Pages Failing (Index): 0
Total Pages Failing (Seg) : 0
Total Pages Marked Corrupt : 0
如果以上信息返回结果不为0,需要重点关注!及时排查原因。
(2)如果指定logfile参数,检查结果将只记录在日志文件中,屏幕上不显示
sys@secooler> !dbv file=/oracle/ora11gR2/oradata/secooler/users01.dbf logfile=dbv_users01.log
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Mar 31 19:52:20 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
此时可以使用SQL*Plus的edit命令查看生成的日志文件内容。
sys@secooler> ed dbv_users01.log
4.小结
dbv是备份有效性验证的好帮手,善用之。
Good luck.
secooler
10.03.31
-- The End --
当然,dbv命令也可以对在线的数据文件进行检查。
注意,dbv工具只可以对数据文件进行检查,无法使用它完成控制文件和日志文件的检查。
1.dbv命令语法
dbverify ::=
dbv [ USERID=username/password ]
FILE = filename
| { START = block_address | END = block_address }
| BLOCKSIZE = integer
| HIGH_SCN = integer
| LOGFILE = filename
| FEEDBACK = integer
| HELP = { Y | N }
| PARFILE = filename
End of description.
参考自Oracle官方文档http://download.oracle.com/docs/cd/E11882_01/server.112/e10701/img_text/dbverify.htm
2.查看帮助文档
从语法定义中我们看到“HELP = { Y | N }”选项,我们可以使用它查看dbv的帮助信息。
secooler@secDB /home/oracle$ dbv help=y
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Mar 31 19:47:36 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Keyword Description (Default)
----------------------------------------------------
FILE File to Verify (NONE)
START Start Block (First Block of File)
END End Block (Last Block of File)
BLOCKSIZE Logical Block Size (8192)
LOGFILE Output Log (NONE)
FEEDBACK Display Progress (0)
PARFILE Parameter File (NONE)
USERID Username/Password (NONE)
SEGMENT_ID Segment ID (tsn.relfile.block) (NONE)
HIGH_SCN Highest Block SCN To Verify (NONE)
(scn_wrap.scn_base OR scn)
帮助信息中描述了dbv命令的使用方法,不赘述。
3.体验dbv工具的效果
1)查看系统中的数据文件名称
sys@secooler> col name for a60
sys@secooler> select name from v$datafile;
NAME
------------------------------------------------------------
/oracle/ora11gR2/oradata/secooler/system01.dbf
/oracle/ora11gR2/oradata/secooler/sysaux01.dbf
/oracle/ora11gR2/oradata/secooler/undotbs01.dbf
/oracle/ora11gR2/oradata/secooler/users01.dbf
2)使用dbv工具对users01.dbf进行检查
(1)使用最简单的参数
sys@secooler> !dbv file=/oracle/ora11gR2/oradata/secooler/users01.dbf
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Mar 31 19:50:59 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /oracle/ora11gR2/oradata/secooler/users01.dbf
DBVERIFY - Verification complete
Total Pages Examined : 35520
Total Pages Processed (Data) : 33029
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 20
Total Pages Failing (Index): 0
Total Pages Processed (Other): 402
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 2069
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 9291961 (0.9291961)
在实际使用中重点关注以下信息:
Total Pages Failing (Data) : 0
Total Pages Failing (Index): 0
Total Pages Failing (Seg) : 0
Total Pages Marked Corrupt : 0
如果以上信息返回结果不为0,需要重点关注!及时排查原因。
(2)如果指定logfile参数,检查结果将只记录在日志文件中,屏幕上不显示
sys@secooler> !dbv file=/oracle/ora11gR2/oradata/secooler/users01.dbf logfile=dbv_users01.log
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Mar 31 19:52:20 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
此时可以使用SQL*Plus的edit命令查看生成的日志文件内容。
sys@secooler> ed dbv_users01.log
4.小结
dbv是备份有效性验证的好帮手,善用之。
Good luck.
secooler
10.03.31
-- The End --
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/519536/viewspace-630960/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/519536/viewspace-630960/