.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

disconnect all the users from database

Posted By:      Posted Date: October 03, 2010    Points: 0   Category :Sql Server

Hi gurus

Is there any command to disconnect all the users from the database. I don't want to set it in single user mode.



View Complete Post

More Related Resource Links

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

I have to do it manually or is there any other way...?to transfer the users in database mirroring

One issue in database mirroring: In Primary server every week 2-3 users will additionally added.How will these users gone to Mirror Server database?I have to do it manually or is there any other way...? One more thing is that Primary server is llve  and 24 hours users connected, If I want to migrate users on other server then I have to make mirror server as primary server and then run SP_rev_login , it is automatic failover then  the newly created users will not be at the mirror server??then problem"SQLSERVER DBA" "INDIA"

How to ensure that all users are logged off the sql database and that they can't access when the SQ


We are trying to restore a SQL Server 2005 (all the databases). We have failed with the restore for a couple of times and the vendor says that we have to ensure that all database users are logged off the database. A restore will fail if other users try to use the database while the restore operation is in

How could this be acomplished. There is no way that we can control if any user or app access the server while we are restoring.

The problem is that when when we are restoring the databases if someone access any of them while the restore is taking place the process fails.

The question is how should the restore be performed? Is there any way to change the state of the database so that the databases can be restored?

Any thoughts?

Users, Sessions, Processes, Instances, Database Engine

Can you depict me the existing relation between Users, Sessions, Processes, Instances and Database Engine of SQL Server?

Forms based authentication allow only specific users from database table


I have the following implementation and I'm sure there is an easy way to do what I want to do but I can't figure it out. 

1. I use forms based authentication to authenticate to my site

2.  I use active directory to authenticate the users

3.  I use the Allow Users="xxx" tag to authorize the users limited to the list that can access my site. (e.g.. even though Mary is an AD user she can't access my site unless I put her credentials in the allow users tag in the web.config file)

All is working well but I want to move the users access list (e.g.. <allow users="john" />" from the web.config to a database table so that I can create a user maintenance page for my admins to add and delete user access.   For the life of me I can't figure out how to do this and I can't seem to find an article on it either.  I'm sure I'm just not looking for the right thing, so help is greatly appreciated. 

Here is my web.config file..

        <add name="DBConnectionString" connectionString="Data Source=PRIMSRV;Initial Catalog=MAINDB;Persist Security Info=True;User ID=svc.Test;Password=password

disconnect from SQL Server 2008 DataBase




In My WPF application I'm connecting to SQL server 2008 dataBase.

i want to give the users the option to restore the dataBase, when I'm trying to disconnect, and restore, i get the message saying that the restore failed due to the fact that it doesn't exclusive access.


I tried executing the command:


and now i can't access it at all...

1. how can i kill all the connections to the dataBase for restore?

2. How can i cancel this ALTER command?




Change the default users for a new database?

Is there any way to customise the default users that have access to a newly created database? I have an Active Directory group that has been granted logon rights to the SQL server, but I need it to have read/write access to any new databases that are created on the server. I don't want to use the Mgmt Studio to grant the permissions. This is because we have an app that creates the databases, but it doesn't set the security. I want an easy way for the security to be granted.

create database trigger to capture new session users



I would like to capture the session user names of people connecting to our database and store them in a separate table.

I was hoping I could "create trigger foo on database for logon". But that is only valid for server based triggers. The problem is I know adding a server based trigger might upset some of our database guys so ideally I would like to avoid this option if possible.

Does anyone have any suggestions?

Thanks in advance



assign different asp pages to users with different user types (database used is ms access)



hello.. i'm a bit stuck with my project and i hope anyone out there could lend a hand.. im completely new to asp.net so please bear with me.. =)

i have a table in ms access where i have username, password and usertype.. i wanted to use that table so that when i log in, the user with the "admin" usertype will go to the admin page while the user with the "user" usertype will go to the members page.. i can log in so the only issue is how to redirect them to their respective pages.. any help would be appreciated.. =)

Hide database names from unauthroized users in SSMS


If a user is not authorized to see a database can I exclude that database from even appearing in Management Studio for that user







Database Users showing disabled


In SSMS, a database user is showing up as disabled (a down reddish arrow). When I look at the server login - it shows that it is a valid login to the instance. I go to Login Properties and then click User Mapping on the GUI and check the particular database to add/enable this user to a Role. However, no luck. It still shows the user as disabled. The user cannot connect to the database. This is in SQL Server 2005, EE64.

Can someone please help? - Thanks.

DB users with write access to a database


how-to: needed for a security audit

System-Generated List of Users with write-access to the SQL database, showing full names and user IDs


Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Enabling Users to Maintain SharePoint Content

When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

Some areas of the site usually contain less-dynamic information. Internal memos and corporate policies are common examples of this information. One option for this information is to post these documents in a document library. Documents in a library are often stored in a few different formats: Word, Acrobat (PDF), or HTML. Each of these formats has its drawbacks.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend