Stop a database
This article explains how to stop a database.
Introduction
When you stop a database normally, the following happens:
-
A
SHUTDOWNevent is written to the EXA_SYSTEM_EVENTS system table. -
All sessions are killed (including any running queries), and relevant entries are written in the auditing system tables EXA_DBA_AUDIT_SQL and EXA_DBA_AUDIT_SESSIONS, and in the non-auditing system tables EXA_SQL_LAST_DAY, EXA_DBA_PROFILE_LAST_DAY, EXA_USER_PROFILE_LAST_DAY, and EXA_DBA_SESSIONS_LAST_DAY.
-
The system table writes are committed and thus persisted, and will be visible to the user when the database is started.
Prerequisites
There are no prerequisites for this procedure.
Procedure
This procedure uses the c4 and confd_client command-line tools in a Linux terminal. To learn more about these tools, see Exasol Deployment Tool (c4) and ConfD.
-
Connect to the cluster operating system (COS) using
c4 connect -i PLAY_ID -s cos.Example:
Copy./c4 connect -i c3275f84 -s cosTo find the play ID, you can use
c4 ps.For more information about how to use c4 commands, see How to use c4.
-
To find the database name when you are connected to COS, use the ConfD job db_list.
Example:
Copyconfd_client db_list
- MY_DATABASE -
Optional parameters:
Parameter name Data type Description clusterstring The database cluster(s) that should be stopped. If the parameter is omitted, all clusters are stopped.
Accepted values are:
<clustername>Stops the database on a specific worker cluster.MAINor+allStops the main database and all worker databases. The database name can be passed instead of MAIN. This is the same as omitting the parameter.
forceboolean When set to
True, the database is forced to shut down.This option should only be used if the database cannot be shut down normally.
The
forceoption should only be used if the database cannot be shut down normally. For more information, see Forced shutdown.Examples:
To stop the database on a specific worker cluster:
Copyconfd_client db_stop db_name: MY_DATABASE cluster: WORKER1To stop the database on all clusters:
Copyconfd_client db_stop db_name: MY_DATABASE
# or
confd_client db_stop db_name: MY_DATABASE cluster: MY_DATABASE
# or
confd_client db_stop db_name: MY_DATABASE cluster: MAIN
# or
confd_client db_stop db_name: MY_DATABASE cluster: +all
Forced shutdown
Stopping the database with the force option will not shut down the database cleanly and should only be used if the database cannot be stopped normally. The following table describes what happens during a normal (controlled) shutdown versus a forced shutdown.
| Normal shutdown | Forced shutdown | |
|---|---|---|
|
Goal |
Graceful termination with audit trail |
Immediate termination to overcome a critical failure |
|
Usage |
Standard operating procedure |
Last resort when normal shutdown is blocked |
|
Duration |
Variable, includes a grace period (up to several minutes for large systems) |
Immediate |
|
Active transactions |
Aborted using standard mechanisms (session kill) and rolled back internally by the database |
Abruptly terminated with no cleanup/rollback recorded |
|
Auditing and logging |
System statistics and a shutdown record are flushed and written to auditing system tables (clear audit trail) |
No auditing entry is written, equivalent to a complete system crash |
| Connections |
Rejected with a |
Immediately terminated, no new connections can be made |