When the database is restored, it cannot process the database & #39; XXXXX & #39; because it is

Source: Internet
Author: User
When the database is restored, the database XXXXX cannot be processed because it is being used by this session. We recommend that you use the master database when performing this operation. Solution: 1. When you log on with an SQL account and restore it, the above error message is displayed. You can use windows to log on to restore the database. 2. If you use a query analyzer to restore the database, see restor.

When the database is restored, the database 'xxxxx' cannot be processed because it is being used by this session. We recommend that you use the master database when performing this operation. Solution: 1. When you log on with an SQL account and restore it, the above error message is displayed. You can use windows to log on to restore the database. 2. If you use a query analyzer to restore the database, see restor.

When the database is restored, the database 'xxxxx' cannot be processed because it is being used by this session. We recommend that you use the master database when performing this operation.

Solution:

1. When you log on with an SQL account and restore the database, the preceding error message is displayed. You can use windows to log on and restore the database;

2. If you use the query analyzer to restore data, see:

Restore database Auction from disk = 'path' with replace;

System. Data. SqlClient. SqlException: RESTORE cannot process database 'auction 'because it is being used by this session. We recommend that you use the master database when performing this operation. The restore database is terminating abnormally.

The error message is obvious. The statement is changed

Use master; restore database Auction from disk = 'path' with replace;

When the ms SQL server database is restored, the following error occurs:

The database 'xxxxx' cannot be processed because it is being used by this session. We recommend that you use the master database when performing this operation.

Use the following command to restore

Use master
Declare @ s varchar (8000)
Select @ s = isnull (@ s, '') + 'Kill '+ rtrim (spID) from master .. sysprocesses where dbid = db_id ('database name ')
Select @ s
Exec (@ s)

Restore database name
From disk = n' path to restore the database backup file. Bak'
With replace

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.