Booting out users of a multi user database system

0 pts.
Tags:
Development
We have a databse and every now and then we have to performance maintainance on it. the problem is it can only be done when there are no users in the databse, is there anyway of creating a button that removes all users (apart from the admin) so that they we can perform them maintainance.
ASKED: November 23, 2004  6:28 AM
UPDATED: November 25, 2004  1:55 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

This is what I’d recommend. This is for SQL server, if you have another DBMS this will be slightly different. I’m assuming you want to automate this task. (1) let all your users know that scheduled maintenance begins at ?? time and give them advanced notice of the outage. (2) In SQL server, next you should restrict access so that anyone that is kicked off, cant login. (3) Create a SQL script that will loop thru the sysprocesses table and issue a KILL command for users in your database.
You can even make a stored proc in your database to automate this task. If your DBMS is SQL Server, look in books online and search on KILL, sysprocesses, and sp_who.

I hope this helps

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • cmarsellus
    Each night I have a database which I need to insure no useres are using because the file is being updated. I preform a cl routine which preforms the WRKOBJLCK command: WRKOBJLCK OBJ(&LIB/&FILEN) OBJTYPE(*FILE) MBR(*ALL) + OUTPUT(*) This routine removes the useres using files and creates a report.
    50 pointsBadges:
    report
  • Jethro55
    what database it it?
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following