force shutdown of the database

Moderator: NorbertKrupa

Post Reply
brendon987
Newbie
Newbie
Posts: 17
Joined: Wed Sep 12, 2012 8:28 pm

force shutdown of the database

Post by brendon987 » Wed Jan 16, 2013 6:09 pm

How do I do a force shutdown of the database ?. I.e Just incase I cannot kill the user session

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

Re: force shutdown of the database

Post by JimKnicely » Wed Jan 16, 2013 6:44 pm

Use the SHUTDOWN function logged in as a superuser...

From the docs:
Issuing the SHUTDOWN('true') command forces the database to shut down whether users are connected or not.

Code: Select all

dbadmin=> SELECT SHUTDOWN('true');
          SHUTDOWN
----------------------------
 Shutdown: moveout complete
(1 row)
But make sure you really want to do that! Passing in true will shut down the database no matter how many users are logged on!
Jim Knicely

Image

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

User avatar
Josh
Intermediate
Intermediate
Posts: 106
Joined: Thu Jan 26, 2012 9:38 pm

Re: force shutdown of the database

Post by Josh » Thu Jan 17, 2013 3:00 pm

You can also pull the plug on the servers! That will force a database shutdown :lol:
Thank you!
Joshua

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

Re: force shutdown of the database

Post by JimKnicely » Thu Jan 17, 2013 7:20 pm

Hi,

Another option to stop your database is using the admintools command line option stop_db()...

Example:

Code: Select all

[dbadmin ~]$ /opt/vertica/bin/admintools -t stop_db -d vertica_db
Info: no password specified, using none
Issuing shutdown command to database
Database vertica_db stopped successfully
Note that the database can only be stopped by the user who (as part of the verticadba UNIX user group) initially created the database or who has root or su privileges.
Jim Knicely

Image

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

billykopecki
Beginner
Beginner
Posts: 42
Joined: Thu Apr 19, 2012 9:03 pm

Re: force shutdown of the database

Post by billykopecki » Wed Mar 06, 2013 7:45 pm

Hello,

Is there an option available on the command line admintools utility that will allow me to force a database shutdown even though there are folks logged on?

Code: Select all

bash$ admintools -t stop_db -d salesforce
Info: no password specified, using none
        Issuing shutdown command to database
Database salesforce not stopped successfully
 Error: NOTICE 2519:  Cannot shut down while users are connected

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

Re: force shutdown of the database

Post by JimKnicely » Wed Mar 06, 2013 9:36 pm

Hi,

I don't think admintools can do it, but you can do this from the command line:

Code: Select all

bash-shell$ vsql -c "SELECT SHUTDOWN('true');"
SET
          SHUTDOWN
----------------------------
 Shutdown: moveout complete
(1 row)
Make sure you really want to do that :)
Jim Knicely

Image

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

NorbertKrupa
GURU
GURU
Posts: 527
Joined: Tue Oct 22, 2013 9:36 pm
Location: Chicago, IL
Contact:

Re: force shutdown of the database

Post by NorbertKrupa » Wed Mar 12, 2014 2:18 am

I was not able to forcefully shut down using admintools:

Code: Select all

$ /opt/vertica/bin/admintools -t stop_db -d dbname
        Issuing shutdown command to database
Database dbname not stopped successfully
 Error: NOTICE 2519:  Cannot shut down while users are connected
You would need the -f option to force the databases to shutdown, even if users are connected (which I didn't know until after I just ran SHUTDOWN() from vsql).

I just used SELECT SHUTDOWN('true');
Checkout vertica.tips for more Vertica resources.

Post Reply

Return to “New to Vertica”