I saw one Message posted by Mr. raino clearly explains about how to restore database only with the MDF file.But its showing error while executing the query.can u please reply me when you see this msg
Query I tried
dbcc traceon(3604)dbcc rebuild_log ('Training','Training_Log')
=================Error================DBCC execution completed. If DBCC printed error messages, contact your system administrator.Server: Msg 5105, Level 16, State 2, Line 2Device activation error. The physical file name 'Training_LOG' may be incorrect.DBCC execution completed. If DBCC printed error messages, contact your system administrator.========================================
Full Query you have posted=============================================shutdown sqlmove the current database file or rename itrestart sql servercreate a new database of the same name and log file and location as the old database and log fileget rid of the old database.you may be able to right click delete it in this situation or used sp_removedbcreate a new database of the right size and shape with correct log and data file locationsstop sqlrename the new databases.mdf or delete it if you don't have enough space - do not touch the .ldfmove back in the old database .mdf file or rename it back againrestart sql serverit should come up suspect--------------------------------1. From a query window, set the status so that you can update the systemtables by running the following query:use Mastergosp_configure "allow", 1goreconfigure with overridego2. Then set the status of the DB that is giving you the problem (XXXXX) intoEmergency Mode by running the following query:update sysdatabases set status = 32768 where name = '<DBName>'gocheckpointgoshutdown with nowaitgo3. Go into the data directory (MSSQL7\DATA) and rename the log file associatedthe DB in question (XXXX.ldf) to some temporary name, such as XXXX.TMP.4. Exit the query window.5. Then start up SQL Server from a DOS command window by issuing: sqlservr -c -T3608 -T4022.6. Bring up another query window and verify that the DB is in emergency modeby issuing:select Name, Status from Sysdatabases where name = '<DB_Name>'7. Verify that the status is 32768. If it is, then issue the query:dbcc traceon(3604)dbcc rebuild_log ('<DB_Name>','<log_filename>') <--- You will need the quotation marks REBUILD_LOG should take less than 5 minutes even on a very large database. It should complete with the messageDBCC execution completed8. Take the database out of bypass recovery mode by issuing the commandupdate sysdatabases set status = 0 where name = '<DBName>'9. Exit the query window and then shutdown (Ctrl-C in the DOS window) andrestart SQL server. Verify the status of the database by running DBCC NEWALLOC and DBCC CHECKDB on the database.===============================================================
Try
dbcc rebuild_log ('Training', 'c:\Training_Log.ldf')
I have tried but its showing error.If try to open the created Database from enterprise manager its showing the error.Iam unable to expand the created Database
The information you posted looks somewhat dated (6.5 I'm guessing?). What about simply using the sp_attach_single_file_db method described in Books On-Line? One caveat: attach single file will only work if the original database was shut down cleanly with no users or pending transactions. But this seems a lot simpler and more straightforward than what you're trying to do.
Hope this helps.
we have sql 2005 and cannot get these commands to work. I have no idea what to next try.
same issues w/ database and log are not properly connected.