7.3.4 db2bak (Creates a backup of a database)

Creates a backup of the current database contents. This script can be executed while the server is still running.

Syntax

db2bak [ backupDirectory]

For information on the equivalent Perl script, see “db2bak.pl (Creates a backup of a database)”.

7.3.5 db2ldif (Exports database contents to LDIF)

Exports the contents of the database to LDIF. This script can be executed while the server is still running, except with the -roption. To export the replication state information, shut down the server first, then run the db2ldif command with the -roption.

For information on the equivalent Perl script, see “db2ldif.pl (Exports database contents to LDIF)”.

For the shell scripts, the script runs the ns-slapdcommand-line utility with the db2ldif keyword. Ellipses (...) indicate that multiple occurrences are allowed.

Syntax

db2ldif [[ -nbackendInstance ] [ -sincludeSuffix ]] [ [ -xexcludeSuffix]] [ -r ] [ -C ] [ -u ] [ -U ] [ -m ] [ M ] [ -aoutputFile ] [ -1 ] [ -N ] [ -E ]

Options Either the -nor the -soption must be specified. By default, the output LDIF will be stored in one file. To specify the use of several files, use the option -M.

Table 7-7 db2ldif options

Option

Description

-1

Deletes, for reasons of backward compatibility, the first line of the LDIF file which gives

 

the version of the LDIF standard.

 

 

-aoutputFile

Gives the name of the output LDIF file.

 

 

-C

Uses only the main database file.

 

 

-E

Decrypts encrypted data during export. This option is used only if database encryption is

 

enabled.

 

 

-m

Sets minimal base-64 encoding.

 

 

-M

Uses multiple several files for storing the output LDIF, with each instance stored in

 

instance filename (where filename is the file name specified for -aoption).

 

 

-nbackendInstance

Gives the instance to be exported.

 

 

-N

Specifies that the entry IDs are not to be included in the LDIF output. The entry IDs are

 

necessary only if the output of the db2ldif command is to be used as input to the db2index

 

command.

 

 

-r

Exports the information required to initialize a replica when the LDIF is imported. Using

 

this option requires that the server be stopped first, then run the db2ldif command.

 

The LDIF file, which is created with the db2ldif command, can be imported using the

 

ldif2db command. When it is imported, if the -roption was used, then the database is

 

automatically initialized as a replica.

 

See “ldif2db (Import)” for information on importing an LDIF file.

 

 

-ssuffix_name

Names the suffixes to be included or the subtrees to be included if -nhas been used.

 

 

-u

Requests that the unique ID is not exported.

 

 

-U

Requests that the output LDIF is not folded.

 

 

-xsuffix_name

Names the suffixes to be excluded.

 

 

7.3 Shell scripts 219