SQL Server attached Database Failure Solution

Source: Internet
Author: User

Error message: Error 1813: failed to open the new database 'dbname'. Create database will be terminated. Device activation error. The physical file name 'd: SQL servermssqldatadbname _ log. ldf' may be incorrect!

Solution:

1. Create a database with the same name

2. Stop the sqlserver service again (do not detach the database)

3. overwrite the new database with the data file of the original database.

4. Restart the sqlserver service.

5. When the enterprise controller is opened, there will be doubts. Ignore it and execute the following statement (pay attention to modifying the database name)

6. After completion, you can access the data in the database. At this time, the database itself generally has a problem. The solution is to use the database script to create a new database and then import the data through DTs.

Use mastergosp_configure 'Allow updates', 1 reconfigure with overridegoupdate sysdatabases set status = 32768 where name = 'mpbj 'gosp _ dboption 'mpbj ', 'single user ', 'true' godbcc checkdb ('mpbj ') goupdate sysdatabases set status = 28 where name = 'mpbj 'gosp _ configure 'mpbj', 0 reconfigure with overridego sp_dboption 'mpbj ', 'Single user', 'false' go

Replace the above mpbj with your own database name.

 


 

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.