Sample Exam Questions

From the objective of OSS-DB Exam Silver
S2.5 Basic server administration (Starting and stopping PostgreSQL)

Sample Question

2.30

Choose the wrong way to start or stop the PostgreSQL database.

 
  1. Start the database by executing the postgres command with the appropriate options.

  2. Start the database by running the pg_ctl command with the appropriate options.

  3. Shut down the database by executing the postgres command with the appropriate options.

  4. Shut down the database by running the pg_ctl command with the appropriate options.

  5. Shut down the database by sending an appropriate signal to the postgres process, such as with the kill command.

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

Answer and Explanation

To start a PostgreSQL database, you need to run the postgres command. However, complex options are usually required, such as running the process in the background, specifying the database cluster directory, and specifying the log file output.

Running the pg_ctl command with the start option indirectly executes the postgres command, allowing you to easily start the database. To shut down a database, send a signal to the postgres process acting as the supervisor.

The method of stopping depends on the type of signal sent, but SIGTERM is a smart shutdown, SIGINT is a fast shutdown, and SIGQUIT is an immediate shutdown.

On Linux and other systems, this can be accomplished by sending a signal to a process whose number is listed in postmaster.pid with the kill command, but more conveniently the pg_ctl command with the stop option can be executed to shut down the database.

The postgres command is a database startup command, and cannot be used for shutdown.

This is a question where you need to select the incorrect option, so the correct answer is C.