I only have an .mdf
file of my database which is not attaching.
I am using the following command:
EXEC sp_attach_single_file_db @dbname = 'Test_Data',
@physname = N'D:\Test_Data\Test_Data.mdf';
and I get the following error message:
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'Test_Data'. CREATE DATABASE is aborted.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:24; actual 0:0). It occurred during a read of page (1:24) in database ID 11 at offset 0x00000000030000 in file 'D:\Test_Data\Test_Data.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
Please help!
Ad hoc updates to system catalogs are not allowed.
when executing this statementUpdate sysdatabases set status = 32768 where name = "BadDbName"