close

當還原MSSQL時,可能會遇到如下問題:


Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database 'deseobikedb' because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.


這是一個網路的類似問題:
Does this message mean that I have to restore the master database before I restore the MyDatabase backup?


A: No, you don’t have to restore the master database before you restore a user database. This message is telling you that your user database connection is using the MyDatabase database. SQL Server Express can't complete the restore operation because the user database has an active connection with your current session. You’ll need to change your database connection to a different database before you attempt to perform the restore. You can use the T-SQL USE command, as I show in the following code, to change your current database connection to the master database before you perform the restore.


USE master
RESTORE DATABASE MyDatabase FROM DISK = 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\MyDatabase.bak'


所以,只是加上USE master這行就可以了

arrow
arrow
    全站熱搜

    NetPC虛擬主機 發表在 痞客邦 留言(0) 人氣()