How to disallow users from connecting to DB temporarily

Moderator: NorbertKrupa

Post Reply
debfawn
Beginner
Beginner
Posts: 47
Joined: Tue Jan 29, 2013 2:30 pm

How to disallow users from connecting to DB temporarily

Post by debfawn » Thu Nov 14, 2013 5:46 pm

Hello - What is the best way to disallow users from connecting to a Vertica database temporarily while we refresh tables in the DB? We want to not have folks connect for about a 5 hour period. We're sending out a global email, but people will probably still try to log in during the outage.

Thanks!

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: How to disallow users from connecting to DB temporarily

Post by JimKnicely » Thu Nov 14, 2013 7:43 pm

Hi,

Refer to the "Single User Mode" topic here:

http://www.vertica-forums.com/viewtopic.php?f=5&t=146

You can also lock all non-admin user accounts, do your work, and then unlock all the users...

First, generate a script that will re-lock and currently locked users users:

Code: Select all

SELECT 'ALTER USER ' || user_name || ' ACCOUNT UNLOCK;' FROM users WHERE is_locked = 't';
Save the script until later.

Next, you can generate a script to lock all non admin users using the query:

Code: Select all

SELECT 'ALTER USER ' || user_name || ' ACCOUNT LOCK;' FROM users WHERE is_super_user = 'f';
After you perform your DB work, you can generate a script to unlock all non admin users using the query:

Code: Select all

SELECT 'ALTER USER ' || user_name || ' ACCOUNT UNLOCK;' FROM users WHERE is_super_user = 'f';
Finally, if you had any users that were locked prior to locking/unlocking all users, you'll need to re-lock them using the script you generated in the first step ;)
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

Post Reply

Return to “New to Vertica Database Administration”