Home All Groups Group Topic Archive Search About

Dropping all connections to a database

Author
13 May 2005 3:03 PM
Doug F.
Is there an easy command I can use within a sql script that will drop all
connections to a database, without having to go the SEM and dropping them via
Management/Current Activity/Process info?

Thanks.

DF

Author
13 May 2005 3:06 PM
Alejandro Mesa
Use "ALTER DATABASE".

Example:

alter database northwind
set single_user with ROLLBACK IMMEDIATE


AMB


Show quote
"Doug F." wrote:

> Is there an easy command I can use within a sql script that will drop all
> connections to a database, without having to go the SEM and dropping them via
> Management/Current Activity/Process info?
>
> Thanks.
>
> DF
Author
13 May 2005 3:10 PM
John Bandettini
Doug

Try this

alter database [dbname]
set restricted_user
with rollback immediate

Regards

John

Show quote
"Doug F." wrote:

> Is there an easy command I can use within a sql script that will drop all
> connections to a database, without having to go the SEM and dropping them via
> Management/Current Activity/Process info?
>
> Thanks.
>
> DF
Author
13 May 2005 3:20 PM
Doug F.
Alejandro and John  - thank you both.

Doug F.

Show quote
"John Bandettini" wrote:

> Doug
>
> Try this
>
> alter database [dbname]
> set restricted_user
> with rollback immediate
>
> Regards
>
> John
>
> "Doug F." wrote:
>
> > Is there an easy command I can use within a sql script that will drop all
> > connections to a database, without having to go the SEM and dropping them via
> > Management/Current Activity/Process info?
> >
> > Thanks.
> >
> > DF

AddThis Social Bookmark Button