Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / SQL / July 2008

Tip: Looking for answers? Try searching our database.

Database is in Transistion. There is already an open datareader     associated with this data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jc - 22 Jul 2008 19:44 GMT
SQL 2005.

I tried to take a DB offline but it just never came back.

I now just want to detach and/or delete it it.. but get error:

"There is already an open datareader associated with this Data"

What's the best way to remove connections from a DB from the command
line.

How can I now remote that open datareader?

Thanks for any help or information.
Alex Kuznetsov - 22 Jul 2008 20:29 GMT
> SQL 2005.
>
[quoted text clipped - 6 lines]
> What's the best way to remove connections from a DB from the command
> line.

       ALTER DATABASE YourDb SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Eric Russell - 22 Jul 2008 20:47 GMT
There are many ways to list what connections are active on a server. One way
is to use sp_who2, and you can use KILL <SPID> to terminate the process.
Also, it is possible to set a database to RESTRICTED_USER mode while
simultaneously disconnecting all connections and aborting any active
transactions. The following will disconnect all connections without active
transactions and allow 2 minutes for any currently active transactions to
complete. Once done, the database will be in RESTRICTED_USER mode, meaning
that only the sysadmin or members of the DBO group can access it. Once the
maintenace operation has completed, restore the database to MULTI_USER mode.

ALTER DATABASE database-name SET RESTRICTED_USER WITH ROLLBACK AFTER 120
SECONDS

> SQL 2005.
>
[quoted text clipped - 10 lines]
>
> Thanks for any help or information.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.