March 19, 2009 at 5:53 pm
I am trying to install a certain database onto a different named instance by detaching the file copying it and pasting it to the desired directory which the named instance that I just created for a work lab that I am doing. It keeps giving me an error message stating that the file cannot be copied because it is in use by another user but Ive searched everywhere and can not find the file anywhere else. Does anybody have any suggestions.
March 19, 2009 at 7:43 pm
Have you considered backup and restore?
MCITP, Database Administrator
A hodgepodge of Information Technology and Life
LinkedIn Profile
My Twitter
March 20, 2009 at 10:30 am
check the NFTS permissions on the database files, the user you are logged on as likely doesn't have permissions to the files
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
March 20, 2009 at 11:17 am
danielmonro (3/19/2009)
I am trying to install a certain database onto a different named instance by detaching the file copying it and pasting it to the desired directory which the named instance that I just created for a work lab that I am doing. It keeps giving me an error message stating that the file cannot be copied because it is in use by another user but Ive searched everywhere and can not find the file anywhere else. Does anybody have any suggestions.
"the file"? which file?
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.March 22, 2009 at 3:27 pm
The whole system?
March 23, 2009 at 1:13 am
Is this is at all possible restarting the instance on which the database used to be may help. Sometimes when you detach the database the file may still have locks on it from SQL Server. If this is not an option, try backup and restore or re-attaching the database and detaching it again. I would do it using TSQL, not GUI, in this case the situation like yours is less likely.
March 23, 2009 at 6:24 am
It's possible that antivirus programm on your machine may accessing it.
Also make sure that you have detached the database properly. Check for the same using sp_helpdb.
March 23, 2009 at 7:38 am
On the SQL server machine, right-click on my computer and select "Manage". Expand shared folders and click on "Open Files". Search for your file name to determine who has a lock on the file you are trying to copy/move. You can right-click on the file to remove the lock (close file actually), if appropriate.
-- You can't be late until you show up.
March 23, 2009 at 10:08 am
Jason Crider (3/19/2009)
Have you considered backup and restore?
I agree. I always prefer using backup and restore. You can go back and drop the database from the original location once you verify that you have a good copied restored on the other instance. Just makes me feel safer doing it that way.
March 23, 2009 at 11:00 am
If it does seem that the file is actually locked, you might process monitor to get to the bottom of it.
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
March 23, 2009 at 3:23 pm
If it is Windows Server 2003, right click the file --> properties --> Click on Unblock if enabled.
---------------------------------------------------
Thanks,
Satheesh.
March 25, 2009 at 10:03 am
danielmonro (3/19/2009)
It keeps giving me an error message stating that the file cannot be copied because it is in use by another user but Ive searched everywhere and can not find the file anywhere else. Does anybody have any suggestions.
I recently had exactly the same issue and wanted to resolve it without going for the backup/restore option as has been previously suggested (no real reason for avoiding it, I just wanted to find out why the copy failed). All I did was stop the SQL Server Service and the lock was released. This may have been a bit heavy handed, and I did intend to investigate a bit further at a later date, but it did work.:-)
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply