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