How to recover data in SQL Server _php tutorial

Source: Internet
Author: User
There are several ways to recover data in SQL Server:
1. Backup recovery method Backup This method is the safest and most reliable way to operate is simple, as long as you choose Restore in SQL Server Enterprise Manager.
It can also be done with T-sql:
RESTORE DATABASE Test from DISK = ' C:mssql7ackupest.bak '
Of course this is used for file recovery, and if the device is restored naturally it is also possible.
2. But sometimes, SQL Server is paralyzed in our unprepared situation, sometimes accompanied by the paralysis of the NT caused by, (this time, tofu want to wall Gates of the portrait has still a few tomatoes), how to do? At this point, only the system stored procedures that are available in SQL Server's T-SQL are used:
sp_atach_db
Give a simple example here:
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 an LDF file, you can use Sp_attach_single_file
sp_attach_single_file_db @dbname = ' pubs ', @physname = ' c:mssql7datapubs.mdf '
This method is used to counter the operation of the Sp_deatach, but the direct use can still be successful.

http://www.bkjia.com/PHPjc/631185.html www.bkjia.com true http://www.bkjia.com/PHPjc/631185.html techarticle There are several ways to recover data in SQL Server: 1. The nature of Backup recovery method Backup This method is the safest and most reliable method to operate is also very simple, as long as the SQL S ...

  • Related Article

    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.