Order:
MS SQL Server R2 additional MDF database times 1813 error with no LDF logs. Prompt database is forced to detach, no log can not be restored, and so on.
Possible causes:
Because the system is performing a timed job, there is no primary to multiple forced separation of the database. When attaching back MDF file times error 1813. In short, the hands of the cheap trouble ...
Workaround:
1, first to backup good MDF file, if he did not have the manager to eat you must not. They don't spit on the bones.
2. Create a new database in the database with the same name appended to it. such as "TestDB"
3. Stop the SQL Server service
4. Locate the folder where the database resides, and delete the Testdb_log.ldf and testdb.mdf files
5. Copy the database "Testdb.mdf" files that need to be attached to the current path.
6. Start the SQL Server service and connect to the database through Enterprise Manager.
7. The new database address in step 1 of this time is already pointing to the MDF file where you need to attach the database. But now the database is still not open.
8. Execute statement: ALTER DATABASE testdb SET EMERGENCY
9. Execute statement: ALTER DATABASE testdb SET single_user
10. Execute statement: ALTER DATABASE testdb REBUILD LOG on (name=dbname_log, filename= ' C:\XXX\dbname_log.ldf ')
where filename is the LDF file name you need to create a new LDF log path. After running, a warning "warning message after execution" warning: The log of database ' Xhtyjbbs ' has been regenerated. The consistency of the transaction has been lost. The RESTORE chain is broken and the server no longer has the context of the previous log files, so you need to know what they are. You should run DBCC CHECKDB to verify physical consistency. The database has been placed in dbo-only mode. When you are ready to make the database available, you need to reset the database options and remove any extra log files. "Don't bird him."
11, DBCC CHECKDB (TestDB, Repair_allow_data_loss) This step will compare cards, may cause the interface is not responding. Wait a little while. After the successful database becomes single user mode, the following two steps are modified into multi-user mode.
12. ALTER DATABASE TestDB SET multi_user
13. ALTER DATABASE TestDB SET ONLINE
Tail:
The database should be ready for use without an accident. Be sure to back up the MDF file first, even if you have a bad play and a backup.
"MSSQL" MSSQL restore single MDF file 1813 error