SQL Server 2000, if the database file (database files) when an error is encountered. how do we. Following is the author of Notes previously. Only apply to non-master, msdb database.




As follows :


A test database built a test (for the type of database exclusively)
Two built a table, insert record
Create table a (c1 varchar (2))
Go
Insert into a values ( ‘aa’)
Go
Insert into a values ( ‘bb’)
Go
3 for a complete backup of documents test_1.bak
4 for a few modifications
Insert into a values ( ‘cc’)
Go
Create table b (c1 int)
Go
Insert into b values (1)
Go
Insert into b values (2)
Go
5 shutdown database server
6 with ultraedit test_data.mdf edit database files, tinker point bytes, the equivalent of the database was fatal damage.
7 launched the database, and run enterprise management tools, open database, see test turned gray, but also shows that the doubt.
8 running isql -SLocalhost -Usa-P
1> backup log test TO DISK= ‘D : Program FilesMicrosoft SQL Server MSSQLBACKUP
Est_2.bak ‘WITH NO_TRUNCATE
2>go
Have dealt with two, these pages is the database ‘test’ document ‘TEST_Log’ (located on a document).
BACKUP LOG operate successfully disposed of two, spent 0.111 seconds (0.087 MB/ seconds).


9 for the resumption of the oldest full backup
1> RESTORE DATABASE FROM test DISK= ‘D : Program FilesMicrosoft SQL Server MSSQL
BACKUP est_1.bak ‘WITH NORECOVERY
2> go
96 have been processed, these pages is the database ‘test’ document ‘TEST_Data’ (located on a document).
Have a handle these pages is the database ‘test’ document ‘TEST_Log’ (located on a document).
RESTORE DATABASE operate successfully handled 97. spent 0.107 seconds (7.368 MB/ seconds).


10 recently restored log
1> RESTORE FROM LOG test DISK= ‘D : Program FilesMicrosoft SQL Server MSSQLBACKU
P est_2.bak ‘WITH RECOVERY
2> go
Have dealt with two, these pages is the database ‘test’ document ‘TEST_Log’ (located on a document).
RESTORE LOG operate successfully disposed of two, spent 0.056 seconds (0.173 MB/ seconds).


Data have been fully restored, and it can be used.
Select * from a
Go


In conclusion, DBA should have a complete database backup plan. In this case, if we do not have a complete backup of the database it is impossible to resume the

Comment Form

You must be logged in to post a comment.

About this blog

Just for web admin!

Photostream