数据库文件MDF有问题,100一定给~说给就给~

nvzishanhun123456789 2003-08-29 07:51:56
运行程序:
EXEC sp_attach_db @dbname = N'sy',
@filename1 = N'c:\sydata\sy.mdf',
@filename2 = N'c:\sydata\sy.ldf'


结果
Server: Msg 5172, Level 16, State 15, Line 1
The header for file 'c:\sydata\sy.mdf' is not a valid database file header. The PageAudit property is incorrect.

等待解决方案~100分 (一定给)
...全文
102 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
谢谢各位支持,可还是不行,不过分我还是要给的~
leimin 2003-08-30
  • 打赏
  • 举报
回复
一般这样的问题,你需要重新安装MSSQLSERVER,因为会影响MODEL,MSDB数据库。
leimin 2003-08-30
  • 打赏
  • 举报
回复
sulution:
Remove the DPT Class driver and update to newer version of DPTDISK.SYS(v1.02 contained in the 2.18 version of Storage Manager).

Use the following steps:

1. Go to My Computer – Select C:\winnt\system32\drivers. Once you get to the Drivers directory, select View and then Options. Once the Options windows opens select the View tab. In the Hidden Files box, click Show All Files and then Apply and OK.

2. Locate and right click on the file DPTDISK.SYS in the Drivers directory and select Properties. Under Attributes, if the Read Only box is checked, please uncheck it and click Apply.

3. You will be brought back to the Drivers directory, highlight the file DPTDISK.SYS and press delete. It will confirm that you want to delete the file, answer YES. Close all open windows.

4. Reboot the machine and install updated DPTI2O.sys and DPTDISK.sys driver files from the 2.18 version of Storage Manager.
leimin 2003-08-30
  • 打赏
  • 举报
回复
If you detach the database by using the sp_detach_db stored procedure and then try to attach the database by using the sp_attach_db stored procedure, the following error message may occur:

Server: Msg 5172, Level 16, State 15, Line 1
The header for file 'd:\pubs.mdf' is not a valid database file header. The PageAudit property is incorrect.
The same error messages may also occur with other models of the DPT RAID controller card.
CAUSE
This problem occurs from a particular combination of the firmware version on the DPT controller card and the version of the DPT Performance Enhancing driver, Dptdisk.sys.
WORKAROUND
The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

zjcxc 2003-08-29
  • 打赏
  • 举报
回复
试大力的方法,
如果不行,那真的没有什么好办法了.
pengdali 2003-08-29
  • 打赏
  • 举报
回复
新建一同名数据库(文件名,文件组都和原来的一样),然后停止数据库服务,用原来文件替换新建的数

据库文件,启动数据库,该数据库被设未suspect

然后把数据库改成紧急模式:
sp_configure 'allow', 1
reconfigure with override
update sysdatabases set status = 32768 where name = '数据库名'

把LDF文件改名,再执行
DBCC REBUILD_LOG ('数据库名', 'E:\fdzz\database\fdzz1204_Log.LDF' )

恢复数据库紧急模式
update sysdatabases set status = 0 where name = '数据库名'
执行
restore database 数据库名 WITH RECOVERY
sp_configure 'allow', 0
reconfigure with override

然后用DBCC CHECKDB ('数据库名')看看有没有错误

如果上面还是不行,试试吧数据库设为紧急模式,应该可以看到数据了,在把数据导出到一个新的数据库

txlicenhe 2003-08-29
  • 打赏
  • 举报
回复
用企业管理器试试呢?
//附加数据库 sp_attach_db 当使用 sp_attach_db 系统存储过程附加数据库时。 sp_attach_db:将数据库附加到服务器。 语法 sp_attach_db [ @dbname = ] 'dbname' , [ @filename1 = ] 'filename_n' [ ,...16 ] 参数 [@dbname =] 'dbname' 要附加到服务器的数据库的名称。该名称必须是唯一的。dbname 的数据类型为 sysname,默认值为 NULL。 [@filename1 =] 'filename_n' 数据库文件的物理名称,包括路径。filename_n 的数据类型为 nvarchar(260),默认值为 NULL。最多可以指定 16 个文件名。 参数名称以 @filename1 开始,递增到 @filename16。文件名列表至少必须包括主文件,主文件包含指向数据库中其它文件的系统表。 该列表还必须包括数据库分离后所有被移动的文件。 返回代码值:0(成功)或 1(失败) eg:下面的示例将 pubs 中的两个文件附加到当前服务器。 EXEC sp_attach_db @dbname = N'pubs', @filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf', @filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf' EXEC sp_attach_db @dbname = N'Ty20051029101451aaa', @filename1 = N'd:\5屏幕\Ty20051029101451aaa_data.mdf', @filename2 = N'd:\5屏幕\Ty20051029101451aaa_log.ldf' ---解决问题了 //删除数据库 DROP DATABASE 从Microsoft? SQL Server? 删除一个或多个数据库。删除数据库将删除数据库所使用的数据库文件和磁盘文件。 语法 :DROP DATABASE database_name [ ,...n ] 参数 :database_name 指定要删除的数据库名称。从 master 数据库中执行 sp_helpdb 以查看数据库列表。 eg: exec sp_helpdb database_name exec Drpo DataBase [Ty20051029101451aaa] //分离数据库 可以使用 sp_detach_db 存储过程分离该数据库,然后使用带有 FOR ATTACH 子句的 CREATE DATABASE 重新附加。 sp_detach_db Archive GO CREATE DATABASE Archive ON PRIMARY (FILENAME = 'c:\program files\microsoft sqlserver\mssql\data\archdat1.mdf') FOR ATTACH GO //显示当前数据库信息 --select * from Master..sysDatabases //新建---不行啊 CREATE DATABASE TestOA ALTER DATABASE TestOA SET OFFLINE WITH ROLLBACK IMMEDIATE RESTORE DATABASE TestOA From disk='C:\Documents and Settings\Administrator\桌面\帐套\data\Template.Dat' ALTER DATABASE TestOA SET OFFLINE WITH ROLLBACK IMMEDIATE exec sp_detach_db Km20051030011601 --分离数据库 exec sp_attach_single_file_db km20051030011601,'D:\TestDatabase\Km20051030011601.mdf'--只附加.mdf文件

27,579

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧