Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 15911

Unable to bring database back into MULTI_USER mode.

$
0
0

I'm wondering if somebody could provide insight into a problem I'm having with SQL Server 2005.  Although the problem is happening wthin an SSIS ETL, I don't think this problem is SSIS related.

 

In the ETL I need to rename a database, so I first put the database into single-user mode by issuing the command:

 

ALTER DATABASE foobar SET SINGLE_USER WITH ROLLBACK 30

 

The database then goes into single-user mode, and after the renaming occurs, I attempt to put the same database back into multi-user mode:

 

ALTER DATABASE foobar SET MULTI_USER WITH ROLLBACK IMMEDIATE

 

However, whenever I have a query pane opened against the same database in SQL Server Management Studio, the ETL fails and I get this error message:

 

"Error: Changes to the state or options of database 'foobar' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it."

 

I'm wondering why the ALTER DATABASE command does not kill off the active connections?  This is on my development box, and I'm the only one connected to the database.  I've tried with ROLLBACK 30 as well, same thing.  If I cut and paste the same command into Mangement Studio, the command succeeds so I don't think its a permission issue (using Windows Authentication both Management Studio and the ETL are executed by the same login).  If I close the query pane the ETL succeeds at restoring multi-user mode.  Is there something I am missing?  Thanks in advance!


Viewing all articles
Browse latest Browse all 15911

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>