[Sorting] How To Restore database content

Source: Internet
Author: User

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)
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.