Sample Exam Questions

From the objective of OSS-DB Exam Silver
- Operation and Management - Installation Method
(Template Database)

Sample Question


Choose one that is incorrect about database templates.

  1. When you run CREATE DATABASE, internally one of the template databases is copied.
  2.  If you do not specify a template database to use, template1 is used by default.
  3. By default, there are two template databases in the database cluster.
  4. Up to 5 template databases can be created in the database cluster.
  5. There is a flag to set whether the database is a template database, and you can not delete (DROP DATABASE) the database where the flag is set.

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

Answer and Explanation

The newly created database cluster created by initdb contains two template databases, template0 and template1.
If you create a new database with the CREATE DATABASE statement (or the createdb command), a copy of the template database will be internally created, but if you do not specify a template database to use at this time, template1 will be used.

The template database does not differ greatly from other databases in the database cluster except that the datistemplate of the database catalog pg_database is true. But if this attribute is set, all users with CREATEDB authority can create a database by referring to the template database. Also, if this attribute is set, you can not delete it with DROP DATABASE. Conversely, if the datistemplate is false, it is restricted to the owner of the database and the superuser that can create the database with it as a template, and it is also possible to delete the database.

There is no limit to the number of template databases that can be created in a database cluster.

Because it is a matter of choosing what is wrong, the correct answer is D.