昨晚因为家里有事需要马上回家,在下班的时候马上就关机(手提电脑),生怕赶不上公交回去,
但是Windows7关机关了很久(感觉Windows7关机比WindowsXP关机速度相差太远了)
还没有关机完毕,于是本人就拔掉电源,收拾好笔记本电脑就赶公交去了
结果回到家,打开SSMS一看,杯具的事情发生了,有3个数据库置疑
马上打开SQL ERRORLOG看一下,只有一条与置疑有关的信息
1 2013-09-11 17:38:27.97 服务器 SQL Server is terminating because of a system shutdown. This is an informational message only. No user action is required.
上面是关机之前的信息
下面是回到家开机的时候的信息
1 2013-09-11 18:29:06.15 spid31s 错误: 9003,严重性: 20,状态: 1。 2 2013-09-11 18:29:06.15 spid31s The log scan number (37:324:1) passed to log scan in database 'RemoteViewTest2012' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup. 3 2013-09-11 18:29:06.27 spid32s CHECKDB for database 'DBLOGTEST' finished without errors on 2013-06-10 00:00:46.493 (local time). This is an informational message only; no user action is required. 4 2013-09-11 18:29:06.61 spid24s CHECKDB for database 'hengshan' finished without errors on 2013-06-10 00:00:42.547 (local time). This is an informational message only; no user action is required. 5 2013-09-11 18:29:07.20 spid29s CHECKDB for database 'TransactionTestDb' finished without errors on 2013-06-10 00:01:01.113 (local time). This is an informational message only; no user action is required. 6 2013-09-11 18:29:07.45 spid26s CHECKDB for database 'Northwind' finished without errors on 2013-06-10 00:00:51.853 (local time). This is an informational message only; no user action is required. 7 2013-09-11 18:29:08.23 spid27s CHECKDB for database 'partionTest' finished without errors on 2013-09-10 22:52:17.883 (local time). This is an informational message only; no user action is required. 8 2013-09-11 18:29:08.36 spid4s Recovery is writing a checkpoint in database 'AdventureWorks' (6). This is an informational message only. No user action is required. 9 2013-09-11 18:29:06.60 spid31s 错误: 3414,严重性: 21,状态: 1。 10 2013-09-11 18:29:06.60 spid31s An error occurred during recovery, preventing the database 'RemoteViewTest2012' (database ID 17) from restarting. Diagnose the recovery errors and fix them, or restore from a known good backup. If errors are not corrected or expected, contact Technical Support. 11 2013-09-11 18:29:08.66 spid31s CHECKDB for database 'RemoteViewTest2012' finished without errors on 2013-06-10 00:00:46.493 (local time). This is an informational message only; no user action is required. 12 2013-09-11 18:29:08.83 spid20s CHECKDB for database 'AdventureWorks' finished without errors on 2013-06-10 00:00:08.693 (local time). This is an informational message only; no user action is required. 13 2013-09-11 18:29:09.01 spid30s CHECKDB for database 'YourSQLDba' finished without errors on 2013-06-10 00:00:46.493 (local time). This is an informational message only; no user action is required. 14 2013-09-11 18:29:10.39 spid23s 1 transactions rolled forward in database 'DLGPOS' (9). This is an informational message only. No user action is required. 15 2013-09-11 18:29:10.66 spid21s CHECKDB for database 'AdventureWorksDW' finished without errors on 2013-06-10 00:00:35.087 (local time). This is an informational message only; no user action is required. 16 2013-09-11 18:29:10.68 spid21s 0 transactions rolled back in database 'DLGPOS' (9). This is an informational message only. No user action is required. 17 2013-09-11 18:29:10.68 spid21s Recovery is writing a checkpoint in database 'DLGPOS' (9). This is an informational message only. No user action is required. 18 2013-09-11 18:29:10.82 spid23s CHECKDB for database 'DLGPOS' finished without errors on 2013-06-13 23:14:53.543 (local time). This is an informational message only; no user action is required. 19 2013-09-11 18:29:13.47 spid22s CHECKDB for database 'dbdreamlink' finished without errors on 2013-06-10 00:00:37.570 (local time). This is an informational message only; no user action is required. 20 2013-09-11 18:29:13.69 spid28s 错误: 9003,严重性: 20,状态: 1。 21 2013-09-11 18:29:13.69 spid28s The log scan number (276:83:1) passed to log scan in database 'GPOSDB' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup. 22 2013-09-11 18:29:13.69 spid28s 错误: 3414,严重性: 21,状态: 1。 23 2013-09-11 18:29:13.69 spid28s An error occurred during recovery, preventing the database 'GPOSDB' (database ID 14) from restarting. Diagnose the recovery errors and fix them, or restore from a known good backup. If errors are not corrected or expected, contact Technical Support. 24 2013-09-11 18:29:13.69 spid28s CHECKDB for database 'GPOSDB' finished without errors on 2013-02-04 10:00:33.557 (local time). This is an informational message only; no user action is required. 25 2013-09-11 18:29:13.88 spid18s 24 transactions rolled forward in database 'msdb' (4). This is an informational message only. No user action is required. 26 2013-09-11 18:29:13.97 spid4s 0 transactions rolled back in database 'msdb' (4). This is an informational message only. No user action is required. 27 2013-09-11 18:29:13.97 spid4s Recovery is writing a checkpoint in database 'msdb' (4). This is an informational message only. No user action is required. 28 2013-09-11 18:29:15.02 spid18s CHECKDB for database 'msdb' finished without errors on 2013-06-10 00:00:49.520 (local time). This is an informational message only; no user action is required. 29 2013-09-11 18:29:16.79 spid25s 错误: 9003,严重性: 20,状态: 1。 30 2013-09-11 18:29:16.79 spid25s The log scan number (193:5320:1) passed to log scan in database 'Monitoring' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup. 31 2013-09-11 18:29:16.80 spid25s 错误: 3414,严重性: 21,状态: 1。 32 2013-09-11 18:29:16.80 spid25s An error occurred during recovery, preventing the database 'Monitoring' (database ID 11) from restarting. Diagnose the recovery errors and fix them, or restore from a known good backup. If errors are not corrected or expected, contact Technical Support. 33 2013-09-11 18:29:16.80 spid25s CHECKDB for database 'Monitoring' finished without errors on 2013-06-10 00:00:47.140 (local time). This is an informational message only; no user action is required. 34 2013-09-11 18:29:38.33 spid4s Recovery is writing a checkpoint in database 'pratice' (5). This is an informational message only. No user action is required. 35 2013-09-11 18:29:38.75 spid19s CHECKDB for database 'pratice' finished without errors on 2013-06-10 00:00:56.963 (local time). This is an informational message only; no user action is required. 36 2013-09-11 18:29:40.27 spid4s Recovery is complete. This is an informational message only. No user action is required. 37 2013-09-11 18:29:48.07 spid52 Using 'xpsqlbot.dll' version '2005.90.5000' to execute extended stored procedure 'xp_qv'. This is an informational message only; no user action is required. 38 2013-09-11 18:29:52.60 spid52 Using 'xpstar90.dll' version '2005.90.5000' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required. 39 2013-09-11 18:29:53.21 spid52 Using 'xplog70.dll' version '2005.90.5000' to execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required. 40 2013-09-11 19:03:59.16 spid57 Common language runtime (CLR) functionality initialized using CLR version v2.0.50727 from C:\Windows\Microsoft.NET\Framework\v2.0.50727\. 41 2013-09-11 19:03:59.82 spid57 AppDomain 2 (pratice.dbo[runtime].1) created. 42 2013-09-11 19:10:02.86 spid59 DBCC TRACEON 3604, server process ID (SPID) 59. This is an informational message only; no user action is required. 43 2013-09-11 19:10:02.92 spid59 DBCC TRACEOFF 3604, server process ID (SPID) 59. This is an informational message only; no user action is required.
由于我没有做数据库备份,只能使用下面的SQL脚本来逐个数据库逐个数据库紧修复
1 --恢复数据库置疑状态sp_resetstatus 2013-5-9 已放博客园 2 EXEC [sys]. [sp_resetstatus] @DBName = 'GPOSDB' 3 --重置置疑数据库的状态 4 5 --sp_resetstatus 关闭数据库上的置疑标记。此过程更新 sysdatabases 中的命名数据库的模式和状态列。 6 --在运行此过程之前,应参考 SQL Server 错误日志并解决所有问题。执行 sp_resetstatus 后停止并重新启动SQL Server。 7 --由于某些原因,数据库可能成为置疑状态。 8 --可能的原因包括操作系统拒绝对数据库资源的访问,以及一个或多个数据库文件不可用性或已损坏。 9 10 ALTER DATABASE [GPOSDB] SET EMERGENCY 11 GO 12 DBCC CHECKDB ( 'GPOSDB') WITH NO_INFOMSGS ,ALL_ERRORMSGS 13 14 15 ALTER DATABASE [GPOSDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE 16 17 EXEC sys.SP_CONFIGURE 'ALLOW UPDATES' , 1 18 RECONFIGURE WITH OVERRIDE 19 GO 20 RECONFIGURE WITH OVERRIDE 21 GO 22 23 DBCC checkdb( 'GPOSDB',REPAIR_ALLOW_DATA_LOSS ) 24 GO 25 26 ALTER DATABASE [GPOSDB] SET MULTI_USER 27 GO 28 29 30 ALTER DATABASE [GPOSDB] SET ONLINE 31 GO