我已通过测试确认,单击 SQL Server Management Studio (SSMS 2012) 中观察到的 SQL Server 实例的数据库节点的刷新图标(一次或多次)会导致我的第 3 方数据库恢复软件失败。如果没有点击刷新图标,则恢复成功。
我的问题:单击刷新图标时,SQL Server 引擎(或 msdb 数据库)会发生什么情况?
更新(下午 2:36) 当故障发生时,一个数据库处于恢复状态。具体错误是“无法恢复数据库,因为未恢复日志。”
更新(下午 2:48) 第 3 方数据库恢复软件是 GUI 驱动的。无法发布还原脚本。我将通过 Profiler 捕获命令。
更新(下午 3:30)- 恢复从 Profiler 捕获的脚本(没有 SSMS 刷新)
select name, physical_name from model.sys.database_files
select name from master..sysdatabases where name = 'DC_EARTH001'
select DatabaseProperty( 'DC_EARTH001', 'IsInLoad' )
select database_id from master.sys.databases where name ='DC_EARTH001'
select DatabaseProperty( 'DC_EARTH001', 'IsSuspect' )
select DatabaseProperty( 'DC_EARTH001', 'IsShutdown' )
select name, physical_name from model.sys.database_files
RESTORE DATABASE [DC_EARTH001] FROM VIRTUAL_DEVICE='MVD_SQLAgent-DC_EARTH001__a6d9fb41_c3fc_4b00_a78e_596dd32fc149_' WITH SNAPSHOT, NORECOVERY, MOVE 'DC_EARTH001' TO 'X:\DC_EARTH001.mdf', MOVE 'DC_EARTH001_log' TO 'Y:\DC_EARTH001_log.ldf'
select name, physical_name from model.sys.database_files
select name from master..sysdatabases where name = 'DC_EARTH002'
select DatabaseProperty( 'DC_EARTH002', 'IsInLoad' )
select database_id from master.sys.databases where name ='DC_EARTH002'
select DatabaseProperty( 'DC_EARTH002', 'IsSuspect' )
select DatabaseProperty( 'DC_EARTH002', 'IsShutdown' )
RESTORE DATABASE [DC_EARTH002] FROM VIRTUAL_DEVICE='MVD_SQLAgent-DC_EARTH002__584bf879_215d_4c15_b7ad_230ecab60488_' WITH SNAPSHOT, NORECOVERY, MOVE 'DC_EARTH002' TO 'X:\DC_EARTH002.mdf', MOVE 'DC_EARTH002_log' TO 'Y:\DC_EARTH002_log.LDF'
select name from master..sysdatabases where name = 'DC_EARTH003'
select name, physical_name from model.sys.database_files
select DatabaseProperty( 'DC_EARTH003', 'IsInLoad' )
select database_id from master.sys.databases where name ='DC_EARTH003'
select DatabaseProperty( 'DC_EARTH003', 'IsSuspect' )
select DatabaseProperty( 'DC_EARTH003', 'IsShutdown' )
RESTORE DATABASE [DC_EARTH003] FROM virtual_device = 'DC_EARTH003_00__416c5ed9_54e9_4ad1_9adc_3c7401c3fd57_' WITH NORECOVERY , MOVE 'DC_EARTH003_data' TO 'X:\DC_EARTH003.mdf', MOVE 'DC_EARTH003_log' TO 'Y:\DC_EARTH003.ldf'
exec xp_msver
select convert( char(100), ServerProperty('Edition') )
select is_srvrolemember( 'sysadmin', 'NT AUTHORITY\SYSTEM' )
exec sp_helpsort
select name, source_database_id from master.sys.databases order by name
select DatabaseProperty( 'DC_EARTH003', 'IsTruncLog' )
select status from sysdatabases where name='DC_EARTH003'
RESTORE DATABASE [DC_EARTH003] WITH RECOVERY
select DatabaseProperty( 'DC_EARTH001', 'IsTruncLog' )
select status from sysdatabases where name='DC_EARTH001'
RESTORE DATABASE [DC_EARTH001] WITH RECOVERY
select DatabaseProperty( 'DC_EARTH002', 'IsTruncLog' )
select status from sysdatabases where name='DC_EARTH002'
RESTORE DATABASE [DC_EARTH002] WITH RECOVERY
更新 (2015/04/07 @ 9:25am) 微软提出的解决方案:SQL Server 2012 SP1 CU1
- 在 SQL Server 2012 中同时还原数据库和执行语句时性能下降或死锁(场景 2 http://support.microsoft.com/en-us/kb/2725950
更新(2015/04/07 @ 9:25am)解决方案实施:SQL Server 2012 SP1 CU15 http://support.microsoft.com/en-us/kb/3038001
- 问题已解决
SQL Server 2012 SP1 CU15 ( http://support.microsoft.com/en-us/kb/3038001 ) 解决了该问题(在数据库还原期间发出命令不会发生死锁)。