Tuesday, March 27, 2012

Dropping all connections to a database

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.
DFUse "ALTER DATABASE".
Example:
alter database northwind
set single_user with ROLLBACK IMMEDIATE
AMB
"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|||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|||Alejandro and John - thank you both.
Doug F.
"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

No comments:

Post a Comment