On April 5th, SQL Server 2000 database Asia is only damaged by the hard disk. After the rescue, only the MDF and LDF file began to think that only MDF files, so first, first, first, first, first, first, @dbname = n'siadb01 ', @physname = n' D: / Microsoft SQL Server / MSSQL / DATA / AsiaDB01_Data.mdf 'But the prompt is unsuccessful; try to build a database first, then separate it, remove the log file, then perform the hook, still unsuccessful.
Later, I finally found a log file, successfully, but found that the database is displayed as read-only, the original MDF is copyled from the disc, the file attribute is read-only, and then the database read-only property will be removed.
EXEC sp_attach_db @dbname = N'ASIADB01 ', @ filename1 = N'd: / Microsoft SQL Server / MSSQL / Data / ASIADB01_Data.mdf', @ filename2 = N'd: / Microsoft SQL Server / MSSQL / Data / ASIADB01_log.ldf '
Later, the ASIA application is executed, and the process is not issued, but the ADODC1 error is displayed in the program, the [SQL Server] [ODBC] data connection is interrupted, and it is a problem that is an application because of the operating system. Database servers, applications, etc. are new installations. From time to time, the application is not registered in the application, which has been suspected of being an error in the application. Because Hong Kong software supplier customer service staff has been working out along this idea, I have not had any results for a day.
The next day I installed the application on my computer, using the SQL Server Event Profiler to monitor the SQL statement executed when the error is executed, and then the copy to the query analyzer is executed, discover the following questions:
SELECT ZKAKEH2.KASRDEN from zkakeh2
Server: Message 21, Level 24, State 1, Row 1 Warning: Severe error 823 occurred in 04 5 2005 7:43 PM
Connection interrupt
SET ROWCOUNT 100000; SELECT TOP 1000 * from zkakeh2 No problem, but if you check 100,000 records, you can report the interruption interruption, and you can judge the database.
A large number of error DBCC CheckTable ('zkakeh2') DBCC Checkdb ('AsiaDB01') is used after DBCC checklist and database.
The use of repair options, it is not successful. DBCC Checkdb ('asiadb01', repair_rebuild) DBCC Checkdb ('asiadb01', repair_allow_data_loss)
No way, use the newly created database that contains the same object, then use DTS to import the data from the bad database. In the middle, because there are several tables, the import data is not successful, the import data is unsuccessful, first put the data first Clear: truncate table kparam3; truncate table zmoney; truncate table ztrno; re-imported data of these four tables, everything OK. Re-use with DBCC tools, Pass, finally see a wire. Reset application ODBC, connect, success! Thank you.
Summary: The database should be backed up in time (including log backup). This case is because the backup file is missing. Only the hard drive is broken, and therefore, it is a hundred discount. When you encounter this problem, Negotion should be considered from the database, not doubting the problem of front-end applications :)