Top
ETERNUS SF AdvancedCopy Manager V15.0 Operation Guide

B.4.1 Overview of sample shell scripts

The sample shell scripts provided are summarized below. These scripts are stored in the /etc/opt/FJSVswsts/samp directory.

Table B.2 Sample shell script for DB2

No.

Type

Script name

Associated transaction

Associated resource type

1

Collection of DB information

swst_db2_iv

DB2 transaction

-

2

Backup

swst_db2_vg_bk

DB2 transaction

Raw device

Note

When a database exists on a file system, it cannot back up during starting of the business which uses the database.


B.4.1.1 Collecting DB information

swst_db2_iv outputs information about an DB2 database. The output file names and their contents are:

Use the database information above as a reference for creating shell scripts for backup processing.

Format
swst_db2_iv
Usage example
# swst_db2_iv 
swst_db2_iv completed.
Result example
spdata.lst
TABLESPACE-NAME      DEVICE-NAME
-------------------- --------------------------------------------------
SYSCATSPACE          /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SQLT0000.0
TEMPSPACE1           /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SQLT0001.0
USERSPACE1           /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SQLT0002.0
ACMTS34              /dev/rlvol34001
SYSTOOLSPACE         /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SYSTOOLSPACE
Processing outline
#!/bin/sh
reterr() --- An error message is output before an error is returned.
sqldata()
{
db2 list tablespaces ----------------------------------- Acquisition of table space name and table space ID
db2 list tablespace containers for <table space ID> --- Acquisition of device name
}

# main()

# 0) Environmental variable setting
PATH=$PATH:/usr/bin:/usr/sbin

# 1) Acquisition of DB2 table space information
        db2 connect to acmtest1 --- Connect the DB2
        sqldata
        db2 terminate ------------- Terminate the DB2

exit 0

B.4.1.2 Backup

swst_db2_vg_bk, run using AdvancedCopy Manager, backs up processing data using an DB2 database on a raw device.
Processing data is copied to work disks prepared by users.
These scripts correspond to steps 2 to 4 in "B.3.2.1 DB information collection".

Start
swst_db2_vg_bk  {-a | -i} <volume group name>
Options
-a

Specify when a DB2 database is online. The start of backup processing is declared to the Oracle server.

-i

Specify when a DB2 database is stopped or the file is a general file. The start of backup processing is not declared to the Oracle server.

Operands
volume group name

Specify the name of the volume group targeted for backup.

Example of using swst_db2_vg_bk

While processing is active, back up /dev/vg01 in which an DB2 database is located.

#  swst_db2_vg_bk  -a  /dev/vg01
swst_db2_vg_bk  completed. (/dev/vg01 -> /dev/vg02 at 23:01 on 2005.10.01 )
Processing outline of swst_db2_vg_bk
#!/bin/sh

usage() --- Command syntax is output before an error is returned.
reterr() --- An error message is output before an error is returned.
sqlbegin()
{
db2 set write suspend for db --- Suspend the DB2 database.
sync
}
sqlend()
{
db2 set write resume for db ---- Resume the DB2 database.
}
getbd() --- Fetch the name of the backup (copy) destination device of AdvancedCopy Manager.
getdate() --- Fetch the backup (copy) date of AdvancedCopy Manager.
gettime() --- Fetch the backup (copy) time of AdvancedCopy Manager.

# main()
Parameter analysis and raw device check

# 0) Environmental variable setting
PATH=$PATH:/usr/bin:/usr/sbin:/opt/FJSVswsts/bin

# 1) Suspend
if [ "-a" operand specification ]
then
db2 connect to <database name>
sqlbegin() ----- Suspend the database.
fi

# 2) Disk backup (copy) by AdvancedCopy Manager command
swstbackup $SRC --- Copy the disk.

# 3) Resume
if [ "-a" operand specification ]
then
sqlend() --- I/O of DB2 is put into the state of suspend.
db2 terminate -------- Terminate the database.
fi

# 4) Acquisition of the backup (copy) destination of AdvancedCopy Manager
DSTBLK="`getbd $SRC`" --- Fetch a backup volume.
BKDATE="`getdate $SRC`"
BKTIME="`gettime $SRC`"

exit 0