您好,我是小DAI,专注于数据库管理员相关的技术问答,请问有什么可以帮您?

sp_dbcc_patch_finishtime

语法


sp_dbcc_patch_finishtime <dbname>, <opid> [,<optype> [,<seq> [,<finishtime>]]]

参数

<dbname>

是 checkstoragecheckverify 在中止时所操作的数据库的名称。此参数的类型为 varchar。

<opid>

是与中止的操作相对应的操作 ID。此参数的类型为 smallint。

<optype>

或是要调查的操作的类型。可接受的值为“checkstorage”或“checkverify”。此参数的类型为 varchar。

<seq>

是 checkverify 序列号(checkstorage 不使用序列号,但 checkverify 需要)。此参数的类型为 smallint。

<finishtime>

为 datetime 值,表示 checkstorage 或 checkverify 操作的中止时间。缺省值为当前时间。

示例

示例 1

出现以下错误时,为数据库 my_db 启用 checkstorage 和 checkverify 报告:


dbcc checkstorage (my_db)
                
                Checking my_db: Logical pagesize is 2048 bytes
                00:00000:00014:2003/01/20 11:50:05.01 server  Error: 9960, Severity: 20, State: 1
                A non-recoverable error has occurred in the CHECKSTORAGE operation. The 
                operation has been aborted.
                
                Msg 9970, Level 20, State 1:
                Line 2:
                DBCC cannot update the finish time in dbcc_operation_log table for this
                operation(opid = '1') of database 'my_db'. This can be patched by executing
                sp_dbcc_patch_finishtime.

示例 2

出现以下错误时,为数据库 my_db 启用 checkstorage 和 checkverify 报告:


dbcc checkstorage (my_db)
                
                Checking my_db: Logical pagesize is 2048 bytes
                00:00000:00014:2003/01/20 11:50:05.01 server  Error: 9960, Severity: 20, State: 1
                A non-recoverable error has occurred in the CHECKSTORAGE operation. The 
                operation has been aborted.
                
                Msg 9970, Level 20, State 1:
                Line 2:
                DBCC cannot update the finish time in dbcc_operation_log table for this
                operation(opid = '1') of database 'my_db'. This can be patched by executing
                sp_dbcc_patch_finishtime.

使用错误消息中包括的信息执行 sp_dbcc_patch_finishtime:


sp_dbcc_patch_finishtime my_db, 1

用法

当 checkstorage 或 checkverify 操作中止时,就会输出一条消息,其中包括该操作的 ID 和该操作中止时正在检查的数据库的名称。中止的 checkverify 操作还会在消息中提供一个序列号。消息会指示用户运行 sp_dbcc_patch_finishtime,并提供 <dbname><opid>,如果是 checkverify 操作,还会提供序列号 <seq>。执行 sp_dbcc_patch_finishtime 后,可以创建有关已中止的操作的故障报告。