SQL Server database restore always displays the "Restoring ..." workaround

Source: Internet
Author: User

Today when Sqlerver restore the database, the card is there to prompt the "restoring ..." status, the database cannot be manipulated at this time, let me show you how to solve some problems

Workaround:

The code is as follows Copy Code

RESTORE DATABASE Demo

From DISK = ' D:/demo.bak '

With MOVE ' demo ' to ' D:/demo.mdf ',

MOVE ' Demo_log ' to ' d:/demo.ldf ',

STATS = ten, REPLACE

GO


If you do not know the logical file name of the backup file, you can query it as follows:

--Returns a result set consisting of a list of databases and log files contained in the backup set.

--Main access to logical file names

The code is as follows Copy Code

Use master

RESTORE filelistonly

<wbr/> <wbr/> from DISK = ' D:/t/pdmtraining.bak '

Go

Cause analysis

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:

The code is as follows Copy Code

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:

The code is as follows Copy Code

RESTORE Database dbname WITH NORECOVERY

SQL Server database restore always displays the "Restoring ..." workaround

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.