Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

Database Backup

A database backup is the procedure of storing CUBRID database volumes, control files and log files, and it is executed by using the cubrid backupdb utility or the CUBRID Manager. DBA must regularly back up the database so that the database can be properly restored in the case of storage media or file errors. The restore environment must have the same operating system and the same version of CUBRID as the backup environment. For such a reason, you must perform a backup in a new environment immediately after migrating a database to a new version.

To recover all database pages, control files and the database to the state at the time of backup, the cubrid backupdb utility copies all necessary log records.

Syntax

cubrid backupdb [ options ] database_name

[ options ]

-D | -r | -l | -o | -S | -C | -t | -z | -e |

--destination-path | --remove-archive | --level | --output-file | --SA-mode | --CS-mode | --thread-count | --compress | --except-active-log | --no-check

  • cubrid : An integrated utility for the CUBRID service and database management.
  • backupdb : A utility for database backup. Performs an online, offline, compressed or parallel backup depending on the option used. This utility can only be executed by a user who has the backup authorization (e.g. DBA).
  • options : A short option starts with a single dash (-) while a full name option starts with a double dash (--). Options are case sensitive.
  • database_name : Specifies the name of the database to be backed up.
Return Value
  • 0 : Success
  • Non-zero : Failure
Option

The following table shows options that can be used with cubrid backupdb utility. Note that options are case sensitive.

Option

Description

-D
--destination-path

Specifies the directory path name or device name where backup volumes are to be created.
The default value is the location of log_path specified in the database location file (databases.txt) which was generated upon database creation.

-r
--remove-archive

Removes unnecessary archive logs after the backup is complete.

-l
--level

Configures the backup level to 0, 1 or 2.
The default value is a full backup (0).

-o
--output-file

Specifies the name of the file where progress information is to be outputted.

-S
--SA-mode

Performs a backup in standalone mode.
The default value is the one specified by the system parameter CUBRID_MODE.

-C
--CS-mode

Performs a backup in client/server mode.
The default value is the one specified by the system parameter CUBRID_MODE.

-t
--thread-count

Specifies the maximum number of threads allowed for a parallel backup.
The default value is the number of CPUs in the system.

-z
--compress

Performs a compressed backup.

-e
--except-active-log

Configures that active log volumes are not included in the backup.

--no-check

Does not perform a consistency check on a database before making a backup.

Performing a backup by specifying the directory in which backup files are to be stored (-D or --destination-path)

The following is an example that uses the -D option to store backup files in the specified directory. The backup file directory must be specified before performing this job. If the -D option is not specified, backup files are stored in the directory specified in the databases.txt file which stores database location information.

cubrid backupdb -D /home/cubrid/backup demodb

The following example stores backup files in the current directory by using the -D option. If you enter a period (.) following the -D option as an argument, the current directory is specified.

cubrid backupdb -D . demodb

Removing archive logs after a backup (-r or --remove-archive)

If the system parameter media_failure_support is configured to 1, when the active logs are full, they are written to a new archive log file. If a backup is performed in such a situation and backup volumes are created, backup logs created before the backup will not be used in subsequent backups. The -r option is used to remove archive log files that will not be used any more in subsequent backups after the current one is complete.

cubrid backupdb -r demodb

The -r option does not affect the restore because it removes only unnecessary archive logs before the backup, but full restore may not be possible if the administrator removes archive logs created after the backup as well; when you remove archive logs, you must check if those logs would be required in any subsequent restore.

If you perform an incremental backup (backup level 1 or 2) with the -r option, there is the risk that normal recovery of the database will be impossible later on. Therefore, it is recommended that the -r option only be used when a full backup is performed.

Performing a backup with the backup level specified (-l or --level)

The following example performs an incremental backup of the level specified by using the -l option. If the -l option is not specified, a full backup is performed. For more information on backup levels, see Incremental Backup.

cubrid backupdb -l 1 demodb

Saving backup progress information in the specified file (-o or --output-file)

The following example writes the progress of the database backup to the info_backup file by using the -o option.

cubrid backupdb -o info_backup demodb

The following is an example of showing the contents of the info_backup file. You can check the information on the number of threads, compression method, backup start time, the number of permanent volumes, backup progress and backup end time.

[ Database(demodb) Full Backup start ]

- num-threads: 1

- compression method: NONE

- backup start time: Mon Jul 21 16:51:51 2008

- number of permanent volumes: 1

- backup progress status

-----------------------------------------------------------------------------

 volume name                  | # of pages | backup progress status    | done

-----------------------------------------------------------------------------

 demodb_vinf                  |          1 | ######################### | done

 demodb                       |      25000 | ######################### | done

 demodb_lginf                 |          1 | ######################### | done

 demodb_lgat                  |      25000 | ######################### | done

-----------------------------------------------------------------------------

# backup end time: Mon Jul 21 16:51:53 2008

[Database(demodb) Full Backup end]

Performing a backup in standalone mode (-S or --SA-mode)

The following example performs a backup in standalone by using the -S option. The demodb database is backed up offline. If the -S option is not specified, the backup is performed in the mode specified by the CUBRID_MODE environment variable.

cubrid backupdb -S demodb

Performing a backup in client/server mode (-C or --CS-mode)

The following example performs a backup in client/server mode by using the -C option. The demodb database is backed up online. If the -C option is not specified, a backup is performed in the mode specified by the CUBRID_MODE environment variable.

cubrid backupdb -C demodb

Parallel backup (-t or --thread-count)

The following example performs a parallel backup with the number of threads specified by the administrator by using the -t option. Even when the argument of the -t option is not specified, a parallel backup is performed by automatically assigning as many threads as CPUs in the system.

cubrid backupdb -t 4 demodb

Compressed backup (-z or --compress)

The following example compresses the database and stores it in the backup file by using the -z option. The size of the backup file and the time required for backup can be reduced by using the -z option.

cubrid backupdb -z demodb

Enabling to exclude active log volumes (-e or --except-active-log)

The following example performs a backup, excluding active logs of the database by using the -e option. You can reduce the time required for backup by using the -e option. However, extra caution is required because active logs needed for completing a restore to the state of a certain point from the backup point are not included in the backup file, which may lead to an unsuccessful restore.

cubrid backupdb -e demodb

Disabling a database consistency check (--no-check)

The following example performs a backup without checking the consistency of the database by using the --no-check option.

cubrid backupdb --no-check demodb