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.
Author |
Topic |
bryan42
Starting Member
28 Posts |
Posted - 2011-06-28 : 15:48:45
|
What's the best way to force a busy database into single user mode?I'm running this in a job and it fails each time:ALTER DATABASE [dbname] SET SINGLE_USER WITH ROLLBACK IMMEDIATEGO |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-06-28 : 15:57:48
|
Is the job step running from that database? Change it to master and see if it works. |
|
|
bryan42
Starting Member
28 Posts |
Posted - 2011-06-28 : 16:08:20
|
It's already running with master specified in the step.I've seen some posts discuss killing all the current connections. Trying that, I'm finding new connections are made while I'm killing the current ones, so connections almost always remain when I try to change to single user mode. It's a busy database. There's got to be a way to do this, though. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-06-28 : 16:24:31
|
You said it's failing. What's the error message?Do you have enough permission to alter database? |
|
|
|
|
|