0% found this document useful (0 votes)
560 views8 pages

Backup Database Command: db2 List Utilities Show Detail

This document provides instructions for taking an offline backup of a DB2 database. It begins by checking for any running applications connected to the database and stopping them. It then issues db2stop and db2start commands to stop and restart the database. The backup is then taken using the db2 backup db command, specifying the database name and target backup directory. It provides additional parameters that can be specified with the backup command like incremental, compression options, number of buffers, and parallelism level.

Uploaded by

Bineet Lal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
560 views8 pages

Backup Database Command: db2 List Utilities Show Detail

This document provides instructions for taking an offline backup of a DB2 database. It begins by checking for any running applications connected to the database and stopping them. It then issues db2stop and db2start commands to stop and restart the database. The backup is then taken using the db2 backup db command, specifying the database name and target backup directory. It provides additional parameters that can be specified with the backup command like incremental, compression options, number of buffers, and parallelism level.

Uploaded by

Bineet Lal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Db2OfflineBackup

check any applications connect to DB

by
db2 list applications show detail

if any running ( check for db2bp process)


db2 force applications all

db2stop force

and

db2start

take backup by using following command ( from DB2 server as instance owner)

db2 backup db <dbname> to <target directory>

from db2 command window , if NT/Unix

db2 list utilities show detail

BACKUP DATABASE Command

Creates a backup copy of a database or a table space.

Scope

This command only affects the database partition on which it is executed.

Authorization

One of the following:

 sysadm
 sysctrl
 sysmaint

Required connection
Database. This command automatically establishes a connection to the specified
database.

Note:
If a connection to the specified database already exists, that connection will be terminated
and a new connection established specifically for the backup operation. The connection is
terminated at the completion of the backup operation.
Command syntax
>>-BACKUP--+-DATABASE-+--database-alias------------------------->
'-DB-------'

>--+-------------------------------------+---------------------->
'-USER--username--+-----------------+-'
'-USING--password-'

>--+---------------------------------------+--+--------+-------->
| .-,---------------. | '-ONLINE-'
| V | |
'-TABLESPACE--(----tablespace-name-+--)-'

>--+------------------------+----------------------------------->
'-INCREMENTAL--+-------+-'
'-DELTA-'

>--
+-----------------------------------------------------------------------
------------------+-->
+-USE--+-TSM--+--+-------------------------------+--
+------------------------------+------+
| '-XBSA-' '-2 OPTIONS--+-2 "options-string"-+-' '-OPEN--num-
sessions--SESSIONS-' |
| '-2 @--2 file-name-----'
|
| .-,-------.
|
| V |
|
+-TO----+-dir-+-
+-----------------------------------------------------------------------
--+
| '-dev-'
|
'-LOAD--library-name--+-------------------------------+--
+------------------------------+-'
'-2 OPTIONS--+-2 "options-string"-+-' '-OPEN--
num-sessions--SESSIONS-'
'-2 @--2 file-name-----'

>--+----------------------------+--+---------------------+------>
'-WITH--num-buffers--BUFFERS-' '-BUFFER--buffer-size-'

>--+----------------+------------------------------------------->
'-PARALLELISM--n-'
>--+------------------------------------------------------------------
+-->
'-4 COMPRESS--+-----------------------------+--+-------------------
+-'
'-4 COMPRLIB--4 name--+---------+-' '-4 COMPROPTS--4
string-'
'-4 EXCLUDE-'

.-7 EXCLUDE LOGS-.


>--+------------------------------------+--+--------------+----->
'-2 UTIL_IMPACT_PRIORITY--+----------+-' '-7 INCLUDE LOGS-'
'-2 priority-'

>--+-------------------+---------------------------------------><
'-WITHOUT PROMPTING-'

Command parameters
DATABASE database-alias
Specifies the alias of the database to back up.
USER username
Identifies the user name under which to back up the database.
USING password
The password used to authenticate the user name. If the password is omitted, the
user is prompted to enter it.
TABLESPACE tablespace-name
A list of names used to specify the table spaces to be backed up.
ONLINE
Specifies online backup. The default is offline backup. Online backups are only
available for databases configured with logretain or userexit enabled. During an
online backup, DB2 obtains IN (Intent None) locks on all tables existing in SMS
table spaces as they are processed and S (Share) locks on LOB data in SMS table
spaces.
INCREMENTAL
Specifies a cumulative (incremental) backup image. An incremental backup
image is a copy of all database data that has changed since the most recent
successful, full backup operation.
DELTA
Specifies a non-cumulative (delta) backup image. A delta backup image is a copy
of all database data that has changed since the most recent successful backup
operation of any type.
USE TSM
Specifies that the backup is to use Tivoli Storage Manager output.
USE XBSA
Specifies that the XBSA interface is to be used. Backup Services APIs (XBSA)
are an open application programming interface for applications or facilities
needing data storage management for backup or archiving purposes.
22
OPTIONS
2
277
"options-string"
7
Specifies options to be used for the backup [Link] string will 7 be passed
to the vendor support library, for example TSM, exactly as it was 7 entered,
without the quotes. 7 7 7
Note:
7
Specifying this option overrides the value specified by the VENDOROPT 7
database configuration parameter.
7
277
@file-name
7
Specifies that the options to be used for the backup operation are contained 7 in a
file located on the DB2 server. The string will be passed to the vendor support
library, for example 7 TSM. The file must be a fully qualified file name. 7
222
OPEN num-sessions SESSIONS
The number of I/O sessions to be created between DB2 and TSM or another
backup vendor product.
Note:
This parameter has no effect when backing up to tape, disk, or other local device.
TO dir/dev
A list of directory or tape device names. The full path on which the directory
resides must be specified. If USE TSM, TO, and LOAD are omitted, the default
target directory for the backup image is the current working directory of the client
computer. This target directory or device must exist on the database server. This
parameter can be repeated to specify the target directories and devices that the
backup image will span. If more than one target is specified (target1, target2, and
target3, for example), target1 will be opened first. The media header and special
files (including the configuration file, table space table, and history file) are
placed in target1. All remaining targets are opened, and are then used in parallel
during the backup operation. Because there is no general tape support on
Windows operating systems, each type of tape device requires a unique device
driver. To back up to the FAT file system on Windows operating systems, users
must conform to the 8.3 naming restriction.

Use of tape devices or floppy disks might generate messages and prompts for user
input. Valid response options are:

c
Continue. Continue using the device that generated the warning message (for
example, when a new tape has been mounted)
d
Device terminate. Stop using only the device that generated the warning message
(for example, when there are no more tapes)
t
Terminate. Abort the backup operation.

If the tape system does not support the ability to uniquely reference a backup
image, it is recommended that multiple backup copies of the same database not be
kept on the same tape.

LOAD library-name
The name of the shared library (DLL on Windows operating systems) containing
the vendor backup and restore I/O functions to be used. It can contain the full
path. If the full path is not given, it will default to the path on which the user exit
program resides.
77
WITH num-buffers BUFFERS
7
The number of buffers to be used. DB2 will automatically choose 7 an optimal
value for this parameter unless you explicitly enter a value. 7 However, when
creating 7 a backup to multiple locations, a larger number of buffers can be used
to 7 improve performance. 7
77
BUFFER buffer-size
7
The size, in 4 KB pages, of the buffer used when building the backup 7 image.
DB2 will automatically choose 7 an optimal value for this parameter unless you
explicitly enter a value. 7 The minimum value for this parameter is 8 pages. 7 7

If using tape with variable block size, reduce the buffer 7 size to within the range
that the tape device supports. Otherwise, the backup 7 operation might succeed,
but the resulting image might not be recoverable.

When using tape devices on SCO UnixWare 7, specify a buffer size of 16.

With most versions of Linux, using DB2's default buffer size for backup
operations 7 to a SCSI tape device results in error SQL2025N, reason code 75. To
prevent 7 the overflow of Linux internal SCSI buffers, use this formula:

7
bufferpages <= ST_MAX_BUFFERS * ST_BUFFER_BLOCKS / 4
where bufferpages is the value you want to use with the BUFFER 7 parameter,
and ST_MAX_BUFFERS and ST_BUFFER_BLOCKS are 7 defined in the Linux kernel
under the drivers/scsi directory.

7
77
PARALLELISM n
7
Determines the number of table spaces which can be read in parallel 7 by the
backup utility. DB2 will automatically choose 7 an optimal value for this
parameter unless you explicitly enter a value. 7
22
UTIL_IMPACT_PRIORITY priority
2
Specifies that the backup will run in throttled mode, with the priority 2 specified.
Throttling allows you to regulate the performance impact of the 2 backup
operation. Priority can be any number between 1 and 100, with 1 representing 2
the lowest priority, and 100 representing the highest priority. If the
UTIL_IMPACT_PRIORITY 2 keyword is specified with no priority, the backup
will run with the default 2 priority of 50. If UTIL_IMPACT_PRIORITY is not
specified, the backup will 2 run in unthrottled mode. An impact policy must be
defined by setting the util_impact_lim configuration parameter for 2 a backup to
run in throttled mode. 2
44
COMPRESS
4
Indicates that the backup is to be compressed. 4 4 4
COMPRLIB name
4
Indicates the name of the library to be used to perform the compression. 4 The
name must be a fully qualified path referring to a file on the server. 4 If this
parameter is not specified, the default DB2 compression library will 4 be used. If
the specified library cannot be loaded, the backup will fail. 4
4
EXCLUDE
4
Indicates that the compression library will not be stored in the backup 4 image. 4
4
COMPROPTS string
4
Describes a block of binary data that will be passed to the initialization 4 routine
in the compression library. DB2 will pass this string directly from 4 the client to
the server, so any issues of byte reversal or code page conversion 4 will have to
be handled by the compression library. If the first character 4 of the data block is
'@', the remainder of the data will be interpreted by 4 DB2 as the name of a file
residing on the server. DB2 will then replace 4 the contents of string with the
contents of this file and will pass this 4 new value to the initialization routine
instead. The maximum length for string is 1024 bytes. 4
44
77
EXCLUDE LOGS
7
Specifies that the backup image should not include any log files. 7 7 7
Note:
7
When performing an offline backup operation, logs are excluded whether or 7 not
this option is specified.
7
77
INCLUDE LOGS
7
Specifies that the backup image should include the range of 7 log files required to
restore and roll forward this image to some consistent 7 point in time. This option
is not valid for an offline backup. 7
WITHOUT PROMPTING
Specifies that the backup will run unattended, and that any actions which
normally require user intervention will return an error message.
Examples
1. In the following example, the database WSDB is defined on all 4 partitions,
numbered 0 through 3. The path /dev3/backup is accessible from all partitions.
Partition 0 is the catalog partition, and needs to be backed-up separately since this
is an offline backup. To perform an offline backup of all the WSDB database
partitions to /dev3/backup, issue the following commands from one of the
database partitions:
2. db2_all '<<+0< db2 BACKUP DATABASE wsdb TO /dev3/backup'
db2_all '|<<-0< db2 BACKUP DATABASE wsdb TO /dev3/backup'

In the second command, the db2_all utility will issue the same backup command
to each database partition in turn (except partition 0). All four database partition
backup images will be stored in the /dev3/backup directory.

3. 7 In the following example database SAMPLE is backed up to a TSM server 7


using two concurrent TSM client sessions. 7 DB2 calculates the optimal buffer
size for this environment. 7 7

db2 backup database sample use tsm open 2 sessions with 4


buffers
4. In the following example, a table space-level backup of table spaces (syscatspace,
userspace1) of database payroll is done to tapes.
5.
6. db2 backup database payroll tablespace (syscatspace,
userspace1) to
/dev/rmt0, /dev/rmt1 with 8 buffers without prompting
7. 3 The USE TSM OPTIONS keywords can be used to specify the TSM
information 3 to use for the backup operation. The following example shows how
to 3 use the USE TSM OPTIONS keywords to specify a fully qualified file name:
33

db2 backup db sample use TSM options @/u/dmcinnis/[Link]

3 The file [Link] contains the following 3 information: -fromnode=bar


-fromowner=dmcinnis

8. Following is a sample weekly incremental backup strategy for a recoverable


database. It includes a weekly full database backup operation, a daily non-
cumulative (delta) backup operation, and a mid-week cumulative (incremental)
backup operation:
9. (Sun) db2 backup db sample use tsm
10. (Mon) db2 backup db sample online incremental delta use tsm
11. (Tue) db2 backup db sample online incremental delta use tsm
12. (Wed) db2 backup db sample online incremental use tsm
13. (Thu) db2 backup db sample online incremental delta use tsm
14. (Fri) db2 backup db sample online incremental delta use tsm
(Sat) db2 backup db sample online incremental use tsm
15. 7 In the following example, three identical target directories are 7 specified for a
backup operation on database SAMPLE. You might 7 want to do this if the target
file system is made up of multiple physical 7 disks. 7 7

db2 backup database sample to /dev3/backup, /dev3/backup,


/dev3/backup

7 The data will be concurrently backed up to the three target directories, 7 and
three backup images will be generated with extensions .001, 7 .002, and .003.

Related reference
 RESTORE DATABASE Command
 ROLLFORWARD DATABASE Command

This topic can be found in: Command Reference.

Db2 list history backup all for pp1

Common questions

Powered by AI

The USE TSM parameter in a DB2 backup command indicates that the backup is to be managed using Tivoli Storage Manager (TSM). This allows the backup to utilize TSM's storage and archiving capabilities, providing a more integrated and potentially automated backup solution. It directs the backup operation to use the TSM settings and infrastructure available, which can enhance the manageability and efficiency of storing backup images .

The use of the COMPRESSION feature in DB2 backup operations offers reduced storage requirements and faster transmission of backup data by decreasing the size of backup images. This can significantly enhance backup performance and efficiency, particularly in environments with bandwidth constraints or expensive storage solutions . However, compression introduces additional CPU overhead during the backup process, potentially impacting the performance of the system if not properly managed. Additionally, using custom compression libraries may complicate backup setups and require handling library-specific issues such as compatibility and data integrity .

A non-cumulative (delta) backup in DB2 captures only the data changes since the last backup of any type, resulting in smaller and faster backups but potentially increasing the complexity during data restoration. In contrast, a cumulative (incremental) backup contains all changes since the last full backup, providing a simpler restoration path as fewer backup files are needed to recover the complete dataset. However, incremental backups usually require more storage space and longer processing time than delta backups due to the greater volume of data involved. Both methods involve trade-offs between backup speed, storage efficiency, and restoration complexity .

The TABLESPACE parameter in the BACKUP DATABASE command allows a focused backup of specific table spaces rather than the entire database. This targeted approach supports efficient backup strategies by reducing the scope, time, and resource consumption of the backup process, making it ideal for large databases where full backups are impractical. However, managing multiple table space backups can complicate recovery processes, as dependencies between table spaces must be carefully maintained to ensure consistency and data integrity during restoration .

The WITHOUT PROMPTING option is critical during automated or scheduled DB2 backup processes where human intervention is not feasible or desired. This setting allows backups to proceed uninterrupted by bypassing prompts for user confirmation when an action or decision is normally required. It ensures that the operation either runs smoothly to completion or fails with an error if an issue arises, helping maintain the automation integrity and reducing the risk of incomplete backups due to unattended alerts .

Online backups in DB2 require the database to be configured with 'logretain' or 'userexit' enabled, which allows for the backup to occur while the database continues to be accessible and operational . Offline backups, on the other hand, are the default mode and do not require these configurations, as the database is not accessible during this backup process . While online backups require 'IN' (Intent None) and 'S' (Share) locks on certain data, offline backups do not face such locking because they are performed when the database is inactive .

The 'INCREMENTAL' keyword in DB2 specifies a cumulative backup operation that copies all database data changed since the last full backup. This form of backup is beneficial as it reduces both the time and storage space needed compared to full backups by only targeting modified data. It requires a comprehensive history of previous backups to fully restore the data, which can add complexity to the recovery process .

The PARALLELISM parameter in DB2 backups determines the number of table spaces that can be processed simultaneously during a backup operation. Utilizing parallelism can significantly enhance the performance and speed of the backup process by enabling concurrent reading of multiple table spaces. However, it requires careful tuning to match system resource capacity, as excessive parallel operations might lead to resource contention and degrade overall system performance .

The UTIL_IMPACT_PRIORITY parameter in DB2 specifies the priority level for a throttled backup operation, thus controlling its performance impact on the system. The priority is set as a number between 1 (lowest) and 100 (highest). A higher priority means the backup process will use more system resources, potentially affecting other ongoing operations . If this parameter is not specified, the backup runs unthrottled, which means no specific impact control is enforced. An impact policy must be defined to utilize this feature .

When configuring BUFFER and WITH num-buffers parameters for a DB2 backup, it is crucial to consider the system architecture and the type of storage media in use. DB2 automatically selects optimal values, but manual settings can optimize performance, particularly when backing up to multiple locations. The BUFFER parameter should match the block size the storage medium supports to avoid unrecoverable images. For example, specific settings are recommended for using SCSI tape devices to prevent overflow errors . With num-buffers should be increased for backup to multiple locations to improve throughput and execution speed .

You might also like