Restore the database with code, the Operation interface has been prompted to complete, but the database is always "restoring"

Source: Internet
Author: User

In the online search of information and practice, you can use the following code to restore the backed up database
RESTORE database [NEW_TTTTT]--New library name
From DISK = N ' E:\DBBackup\tttt_1\tttt_1_Full_2016_06_04_155332.bak '--backup file
With FILE = 1,
MOVE n ' tttt_1 ' to n ' E:\test\new_tttt.mdf ',--new additional location for the original database name
MOVE n ' tttt_1_log ' to n ' E:\test\new_tttt_1.LDF ',--new additional location for the original database name
NORECOVERY,
Nounload, STATS = 10
GO--Full backup restore


RESTORE database [NEW_TTTTT]--New library name
From DISK = N ' E:\DBBackup\tttt_1\tttt_1_Diff_2016_06_04_160529.bak '--backup file
With FILE = 1,
MOVE n ' tttt_1 ' to n ' E:\test\new_tttt.mdf ',--new additional location for the original database name
MOVE n ' tttt_1_log ' to n ' E:\test\new_tttt_1.LDF ',--new additional location for the original database name
Nounload, STATS = 10
go--Differential Backup Restore

But there is a problem in the process of restoration, which is the problem of "being restored" as the topic says.

After finding the data, the practice finds it feasible.

The specific method is

Cause analysis (transfer from http://www.111cn.net/database/mssqlserver/50360.htm)

1) Manager does not actively refresh, need to manually refresh to see the latest status (performance considerations)

2) In rare cases, the recovery process is suspended. This time assume that you want to recover and return to the accessible state, to execute:

RESTORE Database dbname with recovery

This allows the recovery process to end completely.

3) If you want to continue to restore the log files later, you do need to put the database in the "Restoring State",

This is usually done with the following command:

RESTORE Database dbname WITH NORECOVERY

Restore the database with code, the Operation interface has been prompted to complete, but the database is always "restoring"

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.