An error occurred while attaching the database. database recovery failed.

Source: Internet
Author: User
Tags microsoft sql server management studio sql server management studio
An error occurred while attaching the database, database recovery failed time: 17:19:24 Source: http://www.finaldata.org Author: dstfy browse: 207 Data Recovery, dass data recovery, database recovery I first use the following command to restore: use master; goexec...

Data Recovery, maxcompute data recovery, and database recovery

First, use the following command to restore:
Use master;
Go
Exec sp_detach_db @ dbname = 'daigou ';
Exec sp_attach_single_file_db @ dbname = 'daigou ',
@ Physname = n'c: \ database \ daigou_data.mdf ';

Message 15010, level 16, status 1, process sp_detach_db, row 34th
The database 'daigou 'does not exist. Provide a valid database name. To view available databases, use SYS. databases.
Failed to activate the file. The physical file name 'd: \ Program Files \ Microsoft SQL Server \ MSSQL \ data \ daigou_log.ldf' may be incorrect.
The new log file 'd: \ database \ daigou_log.ldf' has been created.
Converting database 'daigou' from version 539 to current version 611.
The database 'daigou 'is being upgraded from version 539 to version 551.
Message 601, Level 12, status 3, 1st rows
As the data is moved, it is impossible to continue scanning in nolock mode.

Title: Microsoft SQL Server Management Studio
------------------------------

The database daigou cannot be accessed. (Objectexplorer)

 

 

If you cannot find a normal log file, try the following method:
1. Change your n'd: \ database \ daigou_data.mdf name
2. Create a database with the same name. The data and log file names are the same as those you attached.
3. Stop SQL Service
4. Change the MDF name of the new database.
5. Change the name of step 1 back.
6. Restart the SQL Service
7. If your database is available, congratulations.
8. If possible, set it to the emergency recovery mode, so that at least the data in the database can be read, get them out, put them in a new database, and then replace the old database with the new database.
Alter database db_name set emergency
9. Of course, you can also try to switch between the emergency recovery mode and the mode to see if it will be better.
Alter database db_name Set Online

 

If two files are recovered together,
Create Database [daigou] On
(Filename = n'd: \ database \ daigou_data.mdf ')
,
(Filename = n'd: \ database \ daigou_log.ldf ')
For attach
The following error message is displayed:
Message 1813, level 16, status 2, 1st rows
The new database 'daigou 'cannot be opened '. The create database is aborted.
Message 9004, level 21, status 1, 1st rows
An error occurred while processing logs of the database 'daigou. If possible, restore from the backup. If no backup is available, you may need to regenerate the log.

 

Alter database [daigou] Set Online

After
Message 5173, level 16, state 1, 1st rows
One or more files do not match the master file of the database. If you try to attach a database, use the correct file to retry the operation. If this is an existing database, the file may be corrupted and should be restored from the backup.
The log file 'd: \ database \ daigou_log.ldf' does not match the main file. The file may come from another database, or the log may have been regenerated before.
Message 945, Level 14, status 2, 1st rows
Because the file is not accessible, or the memory or disk space is insufficient, the database 'daigou' cannot be opened '. For more information, see SQL server error logs.
Message 5069, level 16, state 1, 1st rows
Alter database statement failed.

Set
Alter database db_name set emergency
Then, click Database to report the following error:

Title: Microsoft SQL Server Management Studio
------------------------------

The request dialog box cannot be displayed.

------------------------------
Other information:

The request dialog box cannot be displayed. (Sqlmgmt)

------------------------------

An exception occurred when executing a Transact-SQL statement or batch processing. (Microsoft. sqlserver. connectioninfo)

------------------------------

The database 'daigou' version 539 cannot be opened. Upgrade the database to the latest version. (Microsoft SQL Server, error: 946)

SQL 2000 operations
Use master;
Go
Exec sp_detach_db @ dbname = 'daigou ';
Exec sp_attach_single_file_db @ dbname = 'daigou ',
@ Physname = n'e: \ database \ daigou_data.mdf ';

The error message is as follows:
Server: Message 15010, level 16, status 1, process sp_detach_db, row 25
The database 'daigou 'does not exist. Use sp_helpdb to display available databases.
Server: Message 5170, level 16, status 1, Row 1
The file 'e: \ database \ daigou_log.ldf' cannot be created because it already exists.
Server: Message 1813, level 16, status 1, Row 1
The new database 'daigou 'cannot be opened '. Create database will be terminated.
Device activation error. The physical file name 'd: \ Program Files \ Microsoft SQL Server \ MSSQL \ data \ daigou_log.ldf' may be incorrect.

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.