Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 cant see a drive while attaching

Author  Topic 

ruan4u
Posting Yak Master

132 Posts

Posted - 2005-05-24 : 10:49:11
When I am trying to attach a database stored on D:\backup it doesnt show D drive. It only C and E. Why would this be?

SreenivasBora
Posting Yak Master

164 Posts

Posted - 2005-05-24 : 14:57:33
Hey,

Check your drive partition. I feel your C drive is partitioned into D also and E is a separate drive.

Use below script from Query analyzer you can get the same results

EXEC sp_attach_single_file_db @dbname = 'TestDB',
@filename1 = N'D:\backup\TestDB_data.mdf',
@filename2 = N'D:\backup\TestDB_log.ldf'



With Regards
Sreenivas Reddy B
Go to Top of Page

ruan4u
Posting Yak Master

132 Posts

Posted - 2005-05-24 : 18:42:52
and if i have to restore it from a .BAK file?
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-05-24 : 19:47:52
If the D: drive is a network drive, then it's not going to do you any good to specify D: if you are trying to automate this. You will need to use the network share names:

EXEC sp_attach_single_file_db @dbname = 'TestDB',
@filename1 = N'\\SERVER\server_share\backup\TestDB_data.mdf',
@filename2 = N'\\SERVER\server_share\backup\TestDB_log.ldf'

It will be the same thing for restores.

(from books online):


BACKUP DATABASE Northwind
TO DISK = '\\SERVER\server_share\Northwind.bak'
RESTORE FILELISTONLY
FROM DISK = '\\SERVER\server_share\Northwind.bak'
RESTORE DATABASE TestDB
FROM DISK = '\\SERVER\server_share\Northwind.bak'
WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',
MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'




MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -