volking
asked on
URGENT: force ALL DB connections to terminate!
Our weekly backup failed because some joker was working at 3am Sunday morning and had a connection open to the DB! We have a BATch file which ...
isql -S MyOldSvrName -E -U MyLoginID -P MyPswd -Q "sp_detach_db 'MyDB', 'true'"
del \\MySvr\backup\MyDB_Data.M DF
del \\MySvr\backup\MyDB_Log.LD F
copy \\MySvr\MyDB_Data.MDF \\MySvr\backup\MyDB_Data.M DF
copy \\MySvr\MyDB_Log.LDF \\MySvr\backup\MyDB_Log.LD F
isql -S MySvr -E -U MyLoginID -P MyPswd -Q "sp_attach_db @dbname = 'MyDB', @filename1 = 'C:\MyDB_Data.MDF', @filename2 = 'C:\MyDB_Log.LDF'"
To run sp_detach_db ALL CONNECTIONS MUST BE TERMINATED!
How to force-terminate all connections using a stored proc?
Any ideas?
isql -S MyOldSvrName -E -U MyLoginID -P MyPswd -Q "sp_detach_db 'MyDB', 'true'"
del \\MySvr\backup\MyDB_Data.M
del \\MySvr\backup\MyDB_Log.LD
copy \\MySvr\MyDB_Data.MDF \\MySvr\backup\MyDB_Data.M
copy \\MySvr\MyDB_Log.LDF \\MySvr\backup\MyDB_Log.LD
isql -S MySvr -E -U MyLoginID -P MyPswd -Q "sp_attach_db @dbname = 'MyDB', @filename1 = 'C:\MyDB_Data.MDF', @filename2 = 'C:\MyDB_Log.LDF'"
To run sp_detach_db ALL CONNECTIONS MUST BE TERMINATED!
How to force-terminate all connections using a stored proc?
Any ideas?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.