Yesterday, I helped a friend restore the SQL Server 7.0 database. Now let's write down the process and share it with you:
My buddy copied a database data file from someone else (file in the C:/MSSQL7/Data Directory)
Initially I used:
Reinstall SQL server on a good machine and create the same database device (size) as the database
Stop SQL Server, overwrite the created database file with the copied database file, and restart
SQL Server. But never. I guess the key is that you cannot build the same database device (size ).
Later, I used
System stored procedure:
Sp_attach_db // append the database file to the server
Or
Sp_attach_db_single_file // append a single database file to the server
The specific SQL statement is:
For example:
Exec sp_attach_single_file_db 'pubs', 'e:/data/pubs. MDF'
Sp_attach_db @ dbname = "conmis2000", @ filename1 = "D:/1/conmis2000_data.mdf", @ filename2 = "D:/1/conmis2000_log.ldf"
How to attach database files to the server (I .e., repair the database through *. MDF * LDF file)
In addition, you can see that the previous data can be restored through logs when searching for information. I don't know if that guy can.
Log Recovery:
Restore log {data_name | @ database_name_var}
From
With [norecovery/recovery/standby_undo_file_name]
[,] [Stopat = {data_time | @ data_time_var}
For example, if the database name is database1, the data before may be restored:
Restroe log database1
From database_log
With recovery, stopat = 'jun 15,2000 am'
Reference books: <SQL Server7.0 System Management and Application Development Guide> (Tsinghua University Press)