I/O error (bad page ID) detected during the read at offset 0 x0000007f0c4000 in the file 'D: \ SJK \ aaaaa_Data MDF'.
Search on the Internet a lot of methods, finally use the SQL statements below solution:
USE the MASTER
GO
Sp_dboption 'database name', 'single user', 'true'
Go
DBCC CHECKDB (' database name 'REPAIR_ALLOW_DATA_LOSS)
Go
USE 'database name'
Go
The exec sp_msforeachtable 'DBCC CHECKTABLE (''? , ' 'REPAIR_REBUILD)'
Go
Sp_dboption 'database name', 'single user', 'false'
Go
But after a few hours or a few days, the error will appear again, finally I found that as long as the database is shut, open again, can fix this error, but repaired, still can appear, this problem is really very big, want to know the brothers to help solve, thank you!
CodePudding user response:
With a professional commercial database system, even if is a professional embedded database (but embedded library must not abuse multiple user library), don't use those as early as 15 years ago was eliminated by Microsoft office such as "database", who are mainly used in Microsoft's local, single machine in the program, do not use in other places, if you find that basically mapping disk path through the network access will cause the file is damaged, or interview with multiple processes usually frequently because of the outage of a process file is damaged, so in fact this is a "common", its starting point, is like paddy field of shrimp is put into the sea, more than the program design ability,CodePudding user response:
Your so-called "repair database", this kind of practice is to throw in the file data links to content and rewrite the file already, this is not acceptable in normal development, only 15, 20 years ago in some personal software will do this,