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 2005 Forums
 SQL Server Administration (2005)
 Copying the database....help please!!

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-04-13 : 05:43:54
HI I'm quite new to the admin side of SQL server 2005

and I need help copying a SQL database to my colleagues laptop (we are not on a network)

Basically I try to copy the .mdf file so that he can attach it onto his server, but I get the following error:

"Cannot copy ....mdf as it is being used by another person or program"

Although I am not using it. i.e. i re-start my pc and try to copy it and get the same error.

I also try to detach the database from SQL and copy it, but still no luck.

Please can anybody give me assistance.

Many thanks!!!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-13 : 05:49:56
quote:
Basically I try to copy the .mdf file so that he can attach it onto his server, but I get the following error:

"Cannot copy ....mdf as it is being used by another person or program"

You can't copy the MDF when the SQL Server is running.
If you want to copy the MDF, you can either stop the SQL Server or just take the database offline. COPY IT then bring it back online again.

Run SQL Server Management Studio, right click on the database - Tasks - Take Offline. COPY MDF, repeat steps and select Bring OnLine.



KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-13 : 05:50:51
Another way that does not required to take the database offline is the backup & restore. Backup the database and copy the backup file over and restore it.


KH

Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-04-13 : 07:09:23
Thanks for that. It works fine for database on my drive.

The problem I have is that the .mdb file is on an ecrypted drive and doesn't give me permissions to copy/move it. The .ldf files is not on the Encrypted drive and that is fine to copy.

Is there any way from SQL Server that I can move this .mdb file to a new (non-ecrypted) folder?

Thanks!!!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-13 : 09:42:44
use backup and restore method


KH

Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-04-13 : 10:49:07
You can ask your windows admin to move file for you.
Go to Top of Page
   

- Advertisement -