Running a simple SQLCMD script file, which simply detaches a database on SQL2005, is locking the file system objects so that I cannot copy them to another server or re-attach them. I've looked at the processes running on the server and the cmd.exe object opened, ran, then closed. I cannot restart this 24-7 production e-commerce server or any of the sql server services. Any ideas would be appreciated.
SQLCMD
xp_cmdshell 'sqlcmd -E -SMedusa -i "\\medusa\f$\@detach.sql"'
@detach.sql
USE [master]
GO
ALTER DATABASE [ATLAS] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
USE [master]
GO
EXEC master.dbo.sp_detach_db @dbname = N'ATLAS', @keepfulltextindexfile=N'true'
GO