Re: Set Restricted_User

ll_nmff_at_yahoo.com
Date: 11/12/04


Date: 12 Nov 2004 07:26:24 -0800

Try

Alter database dbName set single_user with rollback immediate

This will solve the problem.

Lily

"Eric" <Eric@discussions.microsoft.com> wrote in message news:<6E558E28-C7AB-4363-82E8-0C6B99E0BB02@microsoft.com>...
> Hi Sue,
>
> I' not getting any error per se but rather undesirable results by running
> Alter Database with Set Restricted_User.
>
> When I run this command:
>
> Alter Database dbname Set Restricted_User With Rollback Immediate
>
> it logs off everyone including sysadmins and db_owners. Is there a way to
> log out everyone except sysadmins and or db_owners?
>
> Cheers
> Eric
>
> "Sue Hoegemeier" wrote:
>
> > And the difficulty you are having is what exactly? What is
> > the error? Does the database go into restricted_user mode?
> > Are you closing the connection after you execute the
> > statement?
> > On a side note, if you are doing this with an login that is
> > a sysadmin, you don't need to add that login to db_owners.
> > Sysadmins can access a database that is in restricted_user
> > mode.
> >
> > -Sue
> >
> > On Tue, 9 Nov 2004 19:52:01 -0800, "Eric"
> > <Eric@discussions.microsoft.com> wrote:
> >
> > >Hi there,
> > >
> > >I'm having difficulty trying to lock a databse so as to prevent people from
> > >logging in, and at the same time, not logging myself out. The following
> > >statement allows me to lock the db, however, it also logs me out at the same
> > >time.
> > >
> > >Alter Database dbname Set Restricted_User With Rollback Immediate
> > >
> > >I have created a separate executable through VB that locks and unlocks, and
> > >is executed from within another application. This application uses the SQL
> > >Server as the backend. I need to log into the application first using a
> > >system admin account that also has db_owner rights, and then perform locking,
> > >and still remain logged into the db.
> > >
> > >Using the statement above, the db_owner will still have access to the db,
> > >but how do I ensure that the statement does not log me out as soon as I
> > >execute it?
> > >
> >
> >



Relevant Pages

  • Re: Sql Server Mode
    ... > can i change the mode to full acces also i am using ... ALTER DATABASE dbname SET READ_WRITE ...
    (microsoft.public.sqlserver.security)
  • Re: Cannot drop the database RMAModule because it is currently in use
    ... alter database dbname set RESTRICTED_USER with rollback immediate ...
    (microsoft.public.sqlserver.server)
  • Re: sp_renamedb
    ... ALTER DATABASE OLD_DBNAME SET SINGLE_USER WITH ROLLBACK IMMEDIATE ... ALTER DATABASE DANUT SET NEW_DBNAME WITH ROLLBACK IMMEDIATE ...
    (microsoft.public.sqlserver.programming)
  • Re: sp_renamedb
    ... ALTER DATABASE MartialArtsArchive SET SINGLE_USER WITH ROLLBACK IMMEDIATE ... ALTER DATABASE FST SET MULTI_USER WITH ROLLBACK IMMEDIATE ... > ALTER DATABASE MartialArtsArchive SET SINGLE_USER WITH ROLLBACK IMMEDIATE ...
    (microsoft.public.sqlserver.programming)
  • Re: Set Restricted_User
    ... Alter Database dbname Set Restricted_User With Rollback Immediate ... it logs off everyone including sysadmins and db_owners. ... > Are you closing the connection after you execute the ...
    (microsoft.public.sqlserver.security)