Top
ETERNUS SF AdvancedCopy Manager V16.9A Operation Guide
FUJITSU Storage

B.3.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.3.1.1 Collecting DB Information

Overview

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.3.1.2 Backup

Overview

swst_db2_vg_bk, run using AdvancedCopy Manager, backs up processing data using a 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.1.1 Backup Procedure".

Format

swst_db2_vg_bk  {-a | -i} volumeGroupName

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

volumeGroupName

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 a 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