How to recover data in SQL Server

Source: Internet
Author: User

Several ways to recover data in SQL Server:

1. The nature is Backup recovery method Backup This is the safest and most reliable way to operate, as long as you select Restore in SQL Server's Enterprise Manager.

You can also do this with T-sql:

RESTORE DATABASE Test from DISK = ' C:mssql7ackup est.bak '

Of course, this is the use of the file recovery, if it is a device to restore nature is also possible.

2. But sometimes, SQL Server is in our unprepared situation paralyzed, sometimes accompanied by NT paralysis and caused, (this time, tofu want to Wall Gates portrait has still a few tomatoes), how to do? At this time, only SQL Server-T The system stored procedures provided in:


Here's a simple example:

sp_attach_db @dbname = N ' pubs ',

@filename1 = N ' C:mssql7datapubs.mdf ',

@filename2 = N ' C:mssql7datapubs_log.ldf '

This method should be said to have a high success rate, but in practice tofu heard this, the database becomes read-only, there is no way. If only MDF does not have LDF files, you can use the Sp_attach_single_file

sp_attach_single_file_db @dbname = ' pubs ', @physname = ' c:mssql7datapubs.mdf '

This method would have been used to reverse the operation of the Sp_deatach, but the direct use would have been successful.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.