Sample Exam Questions

From the objective of OSS-DB Exam Silver
- Operation management - How to use standard attached tool

Sample Question

1.54

Choose two appropriate statements about stopping a database.

  1. You can stop a database by executing pg_ctl shutdown from the command line
  2. You can stop a database by executing pg_ctl stop from the command line

  3. You can stop a database by connecting to it with psql and running the \shutdown meta command
  4. If you do not specifically specify at the time of termination, the client connected to the database is automatically disconnected and the running transaction is rolled back

  5. Only the administrator user of the database (postgres in many circumstances) can execute to stop a database, it cannot be executed under the authority of the OS administrator user (Linux root)

※This sample exam is different from those that appear in the actual OSS-DB Exam.
2019/05/30

Answer and Explanation

The stopping of the  PostgreSQL database is performed by the database administrator user (postgres in many circumstances), by executing the following command from the command line.

pg_ctl stop

From Linux it is possible to stop it with the following command as the root user 

service postgresql-server stop

You may specify the stop mode in the pg_ctl command as below:

pg_ctl stop -m shutdown-mode

There are three shutdown-modes: smart, fast, and immediate.

In smart mode, where there are any connected clients, the database will wait for them to disconnect before stopping the database. 

Fast mode forces a disconnect of the connected client and rolls back the running transaction.

Immediate mode forcibly terminates the database process, in addition to disconnecting the connected client and rolling back the transaction, without checkpoints and other processing. For data that has not been reflected in the data file, recovery processing will work at restart, but immediate should be used only in emergencies.

Since the default for the stop mode is smart, unless you specify the option, the database shutdown processing will not be executed until the connected client is terminated.

 

Therefore, the correct answers are B and E.