日期:2014-05-18  浏览次数:20600 次

SQL数据库出问题了。求教啊。
SQL code

SELECT A.CO,A.ITEMNO,(CASE WHEN A.MASTERJOB = '''' THEN A.JOBNO ELSE A.MASTERJOB END),
     A.MRNO,A.MASTERJOB,A.JOBNO,
     A.LOC,A.CODE,A.BDESC,A.QTY,A.UNIT,A.TDATE,A.P_CODE,H.DE,H.WFHT,
     C.LOTNO,C.QTY
     FROM MRT AS A LEFT OUTER JOIN MAINMR AS B ON A.MRNO=B.MRNO LEFT OUTER JOIN MRUDF AS H  ON A.MRNO=H.MRNO
     left outer join MRTLOT AS C ON (C.MRNO=A.MRNO AND C.CODE=A.CODE  AND C.P_CODE=A.P_CODE AND
     C.JOBNO=A.JOBNO )WHERE 1=1
     AND H.DE=N'生一部' AND B.DOCTYPE='B' AND A.TDATE BETWEEN '2012-2-29' AND '2012-3-30'


查询后出现
SQL code

消息 824,级别 24,状态 2,第 1 行
SQL Server 检测到基于一致性的逻辑 I/O 错误 校验和不正确(应为: 0x7a2d4b4a,但实际为: 0x7d0a6b4a)。在文件 'D:\sql2005\MSSQL.1\MSSQL\data\kji_D.mdf' 中、偏移量为 0x00000473a90000 的位置对数据库 ID 5 中的页 (1:2334024) 执行 读取 期间,发生了该错误。SQL Server 错误日志或系统事件日志中的其他消息可能提供了更详细信息。这是一个威胁数据库完整性的严重错误条件,必须立即纠正。请执行完整的数据库一致性检查(DBCC CHECKDB)。此错误可以由许多因素导致;有关详细信息,请参阅 SQL Server 联机丛书。




------解决方案--------------------
SQL code
SELECT A.CO,A.ITEMNO,(CASE WHEN A.MASTERJOB = '' THEN A.JOBNO ELSE A.MASTERJOB END),
     A.MRNO,A.MASTERJOB,A.JOBNO,
     A.LOC,A.CODE,A.BDESC,A.QTY,A.UNIT,A.TDATE,A.P_CODE,H.DE,H.WFHT,
     C.LOTNO,C.QTY
     FROM MRT AS A LEFT OUTER JOIN MAINMR AS B ON A.MRNO=B.MRNO LEFT OUTER JOIN MRUDF AS H  ON A.MRNO=H.MRNO
     left outer join MRTLOT AS C ON (C.MRNO=A.MRNO AND C.CODE=A.CODE  AND C.P_CODE=A.P_CODE AND
     C.JOBNO=A.JOBNO ) WHERE 1=1
     AND H.DE=N'生一部' AND B.DOCTYPE='B' AND convert(varchar(10),A.TDATE,120) BETWEEN '2012-02-29' AND '2012-03-30'

------解决方案--------------------
http://topic.csdn.net/u/20120329/13/bb5e0581-255e-49d0-9816-df625964cb83.html
------解决方案--------------------
SQL code
DBCC CHECKDB('数据库名')

------解决方案--------------------
SQL code

USE MASTER
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
ALTER DATABASE dbName SET EMERGENCY
GO
sp_dboption 'dbName', 'single user', 'true'
GO
DBCC CHECKDB('dbName','REPAIR_ALLOW_DATA_LOSS')
GO
ALTER DATABASE dbName SET ONLINE
GO
sp_configure 'allow updates', 0 reconfigure with override
GO
sp_dboption 'dbName', 'single user', 'false'
GO