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

Cant copy SQL Server database

Status
Not open for further replies.

tani1978

MIS
Sep 29, 2005
49
DE
Hello friends
I am trying to copy one of my SQL Server database which is located in the default folder
Code:
C:\Program Files\Microsoft SQL Server\MSSQL\Data
but somehow i am getting everytime the same error :
Caanot copy database it is being by another application.I have restatrted the computer a number of times but without success. How can I copy the database to another place in my computer?
 
You have to stop SQL server in order to do that
Also why don't you backup the file and copy that
Another option is sp_detach and sp_attach

I would go with backup and restore in this case

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
Which database? Is is a system or user database? If it is a system one and you don't move it correctly, SQL Server will quit working.

-SQLBill

Posting advice: FAQ481-4875
 
To copy a user database, you would have to put it into SINGLE_USER mode and be the only user. The better way is SQLDenis's suggestion. Detach the database, copy the .mdf and .ldf files. Move the copies to their new location. Attach the orginal database.

-SQLBill

Posting advice: FAQ481-4875
 
thanks i got it using task manager i stoped sqlserver.exe and then copied it thanks for your advises.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top