Sample Exam Questions

From the objective of OSS-DB Exam Silver
- Operation management - backup method

Sample Question


Please choose the incorrect statement about backing up the database using the pg_dump command.

  1. You can back up a single database in a database cluster, but not the entire database cluster using pg_dump.
  2. Options allow you to specify combinations such as (I) only the definition of the table (2) only the data in the table (3) both the table definition and the data.

  3. The format of the backup file can be in either text or binary format. The binary format allows  several different types such as TAR and compressed archive format.
  4.  In the text format backup file, SQL statements such as CREATE TABLE, GRANT, COPY are used.

  5. To restore from a backup file created with pg_dump, use the pg_restore command regardless of file format.

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

Answer and Explanation

pg_dump is a command used when PostgreSQL gets a database backup.

For one database in the database cluster, you can get backups of all or some tables. To back up the entire database cluster with a single command, use the command pg_dumpall.

By default, both table definitions and data are backed up, but with -s or --schema-only options only table definitions are backed up. Also, if you specify -a or --data-only option, only the data is backed up.

The format of the backup file is specified with the -F or --format option. The default is text format, but you can explicitly specify it as p or plain. The binary format specifies c (custom) in compressed archive format, d (directory) in directory format, t (tar) in TAR as an option. 

The directory format is an option added in PostgreSQL 9.1.

The text format backup is SQL, which describes CREATE TABLE that defines the table, GRANT to grant access authority, COPY to put data in the table, and so on.

When restoring from backup, use psql command for text format backup. For binary backups, use the pg_restore command in either custom / directory / tar format.


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