[Ordering] How to restore the content of the database

zhaozj2021-02-17  43

Yesterday helped a friend recovered the SQL Server 7.0 database. Now write the process, everyone share:

My buddy is a data file that is copied from someone else (C: / MSSQL7 / DATA directory)

Initially I used:

Reinstall SQL Server on a good machine, establish the same database device (size), and the database stops SQL Server, override the original database file with the copied database file, and then restart SQL Server. But it is not possible. I guess the key is the same database device (size) that cannot be established.

Later used

System stored procedure: sp_attach_db // Additional Database File to Server

Or SP_ATTACH_DB_SINGLE_FILE / / A single 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 a database file to the server (ie: Repair the database via * .mdf * LDF file)

It is also possible to find the previous data through the logging information. I don't know if the buddy looks like it is

Recovery with log: restore log {data_name | @Database_name_var} from

With [Norecovery / Recovery / StandBy_undo_file_name]

[,] [stopt = {data_time | @Data_time_var}

For example: library named Database1_Log requires data for Database1_log Restore 2000/6/15 1:00: Restroe Log Database1From Database_logwith Recovery, Stopat = 'Jun 15,2000 1:00 am'

References are: (Tsinghua University Press)

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

New Post(0)