How to recover (reproduced) when the SQL Server2000 database file is corrupted

zhaozj2021-02-16  66

In the SQL Server2000, what should we do if the database file (non-system database file) encounters an error. The following is the note before the author. Only the database of non-MASTER, MSDB.

described as follows:

1 Construction of a test database TEST (Database type is complete) 2 built a table, insertion point record Create Table A (C1 varchar (2)) Go Insert Into a Values ​​('AA') Go Insert Into a Values ​​('bb') Go 3 full backup, to the file test_1.bak4 in making something insert into a values ​​('cc') Go Create Table B (C1 Int) Go Insert Into B Values ​​(1) Go Insert Into B Values ​​(2) Go5 Shutdown Database Server 6 edit database file test_data.mdf with UltraEdit, and then modify the point byte content, which is equivalent to a deadly damage. 7 Start the database, and run the Enterprise Manager, click on the database, see TEST to become gray, and display it. 8 Run isql -slocalhost -usa -p1> backup log test to disk = 'd: program filesmicrosoft sql servermssqlbackup est_2.bak' with no_truncate2> Go has processed 2 pages, these pages belong to the database 'test' file 'test_log' (in Document 1). The Backup log operation has been successfully handled 2 pages, which took 0.111 seconds (0.087 MB / sec).

9 Recover the oldest full backup 1> Restore Database test from disk = 'd: program filesmicrosoft SQL ServerMssqlbackup Est_1.bak' with Norecovery2> Go has processed 96 pages, these pages belong to the database 'test' file 'test_data' (in Document 1). Process 1 pages, these pages are file 'test_log' (on file 1). Restore Database Successfully handles 97 pages, spent 0.107 seconds (7.368 MB / sec).

10 Restore the nearest log 1> Restore log test from disk = 'd: program filesmicrosoft SQL ServerMssqlbackup est_2.bak' with recovery2> Go has processed 2 pages, these pages belong to the database 'test' file 'test_log' (on file 1 ). Restore log operations have been successfully processed by 2 pages and spent 0.056 seconds (0.173 MB / sec).

The data has been fully recovered, which can be used. Select * from ago

Summary, DBA should have a perfect database backup plan. In this case, if there is no complete backup, the recovery of the database is impossible.

转载请注明原文地址:https://www.9cbs.com/read-15751.html

New Post(0)