Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sp_Attach_Single_File_DB Error

Status
Not open for further replies.

JayKusch

MIS
Oct 30, 2001
3,199
US
Mornin' Folk...

have a strange issue w/ sp_attach_single_file_db. as a preface, i have ran this script many times to move DBs around and have yet to see this particular issue.

Have a DB call Web_Logs. its MDF is physically located in the directory structure 'D:\SQL Server 2000\Data' as Web_Logs_Data.mdf and the LDF "WAS" located in 'D:\SQL Server 2000\Trans_Logs' as Web_Logs_Log.ldf

i ran the following sp first:

exec sp_detach_db 'Web_Logs' ... this went well

i then deleted the 7GB tlog/ldf:

del 'D:\SQL Server 2000\Trans_Logs\Web_Logs_Log.ldf


Once again no problem ....

I then have tried several times the e following command


EXEC sp_attach_single_file_db @dbname = 'Web_Logs',
@physname = 'D:\SQL Server 2000\Data\Web_Logs_Data.mdf'


BUT this is the error i am receiving ...


Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'Web_Logs'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'D:\SQL Server 2000\Trans_Logs\\web_logs_log.LDF' may be incorrect.



The problem is that the path for the ldf is wrong. you can see it has 2 '\\' after Trans_Logs where there should only be one. in other words, the path for the LDF should be :


'D:\SQL Server 2000\Trans_Logs\'

NOT ....

'D:\SQL Server 2000\Trans_Logs\\'


Any ideas or mans to look at to try and recover from this error. seems the MDF file has a corrupt path within it that is pointing where the LDF should be created.

As always ... Thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top