Solution:
1. Create a database with the same name (the data file must be consistent with the original one)
2. Stop SQL server again (do not detach the database)
3. Overwrite the new database with the data file of the original database.
4. Restart SQL server.
5. When you open the Enterprise Manager, there will be a doubt. Ignore it and execute the following statement (note that you must modify the database name)
6. after completion, you can generally access the data in the database. In this case, the database itself is still problematic. The solution is to create a new database using the database script, and export the data.
The code is as follows: |
Copy code |
USE MASTER GO
SP_CONFIGURE 'allow updates', 1 RECONFIGURE WITH OVERRIDE GO Update sysdatabases set status = 32768 where name = 'suspicious database name' Go Sp_dboption 'questionable database name', 'single user', 'True' Go Dbcc checkdb ('questionable database name ') Go Update sysdatabases set status = 28 where name = 'questionable database name' Go Sp_configure 'allow updates', 0 reconfigure with override Go Sp_dboption 'questionable database name', 'single user', 'false' Go |
The following error message is displayed after the preceding statement is executed:
The configuration option 'allowupdates' has been changed from 0 to 1. Run the RECONFIGURE statement for installation.
(The number of affected rows is 1)
Server: message 5105, level 16, status 4, row 1
Device activation error. The physical file name 'E: \ Program Files \ Microsoft SQL Server \ MSSQL \ data \ bserp_Data.MDF 'may be incorrect.
Sp_dboption command failed.
Server: message 8966, level 16, status 1, row 1
Failed to read and latch the page (97: 6553715) (using the latch type SH ). Sysobjects failed.
DBCC execution is complete. If DBCC outputs an error message, contact the system administrator.
(The number of affected rows is 1)
The configuration option 'allowupdates' has been changed from 1 to 0. Run the RECONFIGURE statement to install