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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attach a DB from a network drive SQL 2K

Status
Not open for further replies.

sanjdhiman

Programmer
Jan 15, 2003
189
GB
Dear All,

I have an Urgent problem/

I am currently trying to re-attach an mdf and an ldf file from a network drive (F:\). SQL 2000 server

i tried using the

dbcc traceon(1807)
EXEC sp_attach_db @dbname = N'actdw_UK',
@filename1 = N'\\ukfs1\databasebackups$\actdw_UK\actdw_UK_Data.mdf',
@filename2 = N'\\ukfs1\databasebackups$\actdw_UK_Log.ldf'


However I got the following error message:

Device activation error. The physical file name '\\ukfs1\databasebackups$\actdw_UK\actdw_UK_Data.mdf' may be incorrect.

I have no database set up on the LOCAL server with the name actdw_UK. Is this the problem?

I am running this SQL statement against the Master DB in Query analyser.

Can anyone help.. I am trying to re-attach the database from this network drive.

Kind REgards

Sanj
 

sanj mate This error is because you are restoring a database and original e.g place, e:\... is no longer there.
Go to Options(in restore process) and change to any valid path or, if you have "e:" create a folder with same name than original
 
camy123

im not tryin to restore the database im trying to re-attach the database.

Thanks

Sanj
 
sory mate i meant re-attach .. answering 3 threads at once..and also mis read your querie
ok
Create a database with the same name as an empty shell. detach this database. Then remove the .LDF file from the folder and overwrite the .MDF file with your backup .MDF.

Use the sp_attach_single_file_db procedure to reattach the database.

I know you can do this with .LDF and .MDF files but I've never tried to do it with just the .MDF. Hyou can with sp_attach_single_file_db, try it out on a Dev server it will work done it many times..
 
one question
EXEC sp_attach_db @dbname = N'actdw_UK',
what does the N in front signify ive nevr had to use that
 
thanks everyone it was a permissions error on the directory in which the attached dbs were located

the N at the front of the ' mark allows SQL server to make sure it doesnt convert the ' mark into something else.

its just good practice..

thats all
thanks all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top