Top
ETERNUS SF AdvancedCopy Manager V16.9.1 Operation Guide
FUJITSU Storage

B.2.1 Overview of Sample Scripts

The sample shell scripts provided are summarized below. The sample shell scripts for the backup management function are stored in the "/etc/opt/FJSVswsts/samp" directory, and the sample shell scripts for the replication management function are stored in the "/etc/opt/FJSVswsrp/samp" directory.

Table B.1 Sample Shell Script for Oracle

No.

Type

Shell Script Name for the Backup Management Function

Shell Script Name for Replication Management Function

Associated Transaction

Associated Resource Type

1

Collection of DB information

swst_or_iv

swsrp_or_iv

Oracle transaction

-

2

Backup

swst_or_fs_bk

-

Oracle transaction, general file transaction

File system

3

Backup

swst_or_rd_bk

-

Oracle transaction

Raw device

4

Backup

-

swsrp_or_lv_bk

Oracle transaction

Logical volume

B.2.1.1 Collecting DB Information

The sample shell script for the backup management function (swst_or_iv) or for the replication management function (swsrp_or_iv) outputs the Oracle database information. The output file names and their contents are:

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

Sample Shell Script for the Backup Management Function

Sample Shell Script for the Replication Management Function

Format
swsrp_or_iv
Usage Example
# swsrp_or_iv
swsrp_or_iv completed.
Result Example
spdata.lst
TABLESPACE-NAME               DEVICE-NAME
-------------------- -------------------------------------------------- 
SYSAUX               /oracle/ora/oradata/sysaux01.dbf
SYSTEM               /oracle/ora/oradata/system01.dbf
UNDOTBS1             /oracle/ora/oradata/undotbs01.dbf
USERS                /oracle/ora/oradata/users01.dbf
spdata.bgn
alter tablespace SYSAUX begin backup;
alter tablespace SYSTEM begin backup;
alter tablespace UNDOTBS1 begin backup;
alter tablespace USERS begin backup;
spdata.end
alter tablespace SYSAUX end backup;
alter tablespace SYSTEM end backup;
alter tablespace UNDOTBS1 end backup;
alter tablespace USERS end backup;
spcont.lst
NAME                  TYPE    VALUE
----------------------------------- ------- ------------------------------
control_files                       string  /oracle/ora/oradata/control
splog.lst
NAME                  TYPE    VALUE
----------------------------------- ------- ------------------------------
log_archive_dest                    string  /oracle/ora/oradata/archive
Processing Outline
#!/bin/sh
reterr() --- An error message is output before an error is returned.
sqldata()
{
sqlplus AAA/BBB <<!
SELECT --- Acquire Oracle table space information.
}
sqllog()
{
sqlplus AAA/BBB <<!
show --- Acquire Oracle log information.
}
sqlcont()
{
sqlplus AAA/BBB <<!
show --- Acquire Oracle control information.
}

# main()

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

# 1) Acquisition of Oracle table space information
sqldata() invocation --- Acquire Oracle table space information.

# 2) Acquisition of Oracle log information
sqllog() invocation --- Acquire Oracle log information.

# 3) Acquisition of Oracle control information
sqlcont() invocation --- Acquire Oracle control information.

exit 0

B.2.1.2 File System Backup

Overview

The sample shell script for the backup management function (swst_or_fs_bk) uses AdvancedCopy Manager to back up processing data stored in an Oracle database on a file system.
Processing data is copied to the backup volumes of AdvancedCopy Manager.

This shell script corresponds to steps 2 to 4 in "B.1.1 Backup Procedure".

Format

swst_or_fs_bk {-a | -i} mountPointName

Options

-a

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

-i

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

Operands

mountPointName

Specify the name of the mount point targeted for backup.

Example of Using swst_or_fs_bk

While processing is active, back up "/gyoumu_db" in which an Oracle database is located.

# swst_or_fs_bk -a /gyoumu_db
swst_or_fs_bk completed. ( /gyoumu_db -> /dev/dsk/c1t3d0s2/gyoumu_db_SW at 23:00 on 1999.11.01 )

Processing Outline of swst_or_fs_bk

#!/bin/sh
usage() --- Command syntax is output before an error is returned.
reterr() --- An error message is output before an error is returned.
chkmp() --- Check for a mount point
get_mp_blk() --- Conversion from a mount point to a device
getfs() --- Conversion from a mount point to a file system type
sqlbegin()
{
sqlplus AAA/BBB <<!
alter system switch logfile;
alter system flush shared_pool;
alter tablespace CCC begin backup; --- Notify Oracle of the start of backup.
}
sqlend()
{
sqlplus AAA/BBB <<!
alter tablespace CCC end backup; --- Notify Oracle of the stopping of backup.
}
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 mount point check

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

# 1) Notification issued to Oracle of the start of backup
if [ "-a" operand specification ]
then
sqlbegin() invocation --- Notify Oracle of the start of backup.
Error handling
fi

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

# 3) Notification issued to Oracle of the stopping of backup
if [ "-a" operand specification ]
then
sqlend() invocation --- Notify Oracle of the stopping of backup.
Error handling
fi

# 4) Acquisition of the backup (copy) destination of AdvancedCopy Manager
BDBLK="`getbd $UDBLK`" --- Fetch a backup volume as a character device.
BDDATE="`getdate $UDBLK`"--- Fetch the backup date.
BDTIME="`gettime $UDBLK`"--- Fetch the backup time.

exit 0

B.2.1.3 Raw Device Backup

Overview

The sample shell script for the backup management function (swst_or_rd_bk) uses AdvancedCopy Manager to back up the transaction data of an Oracle database onto a raw device.
The transaction data is copied to the work disks prepared by users.

This shell script corresponds to steps 2 to 4 in "B.1.1 Backup Procedure".

Format

swst_or_rd_bk {-a | -i} rawdeviceName

Options

-a

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

-i

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

Operands

rawDeviceName

Specify the name of the raw device targeted for backup.

Example of Using swst_or_rd_bk

While live processing is active, back up "/dev/rdsk/c0t0d0s0" in which an Oracle database is located.

# swst_or_rd_bk -a /dev/rdsk/c0t0d0s6
swst_or_rd_bk completed. ( /dev/rdsk/c0t0d0s6 -> /dev/rdsk/c1t3d0s2 at 23:01 on 1999.11.01 )

Processing Outline of swst_or_rd_bk

#!/bin/sh

usage() --- Command syntax is output before an error is returned.
reterr() --- An error message is output before an error is returned.
get_chr_blk() --- Conversion from a character device to a block device
get_blk_chr() --- Conversion from a block device to a character device
sqlbegin()
{
sqlplus AAA/BBB <<!
alter system switch logfile;
alter system flush shared_pool;
alter tablespace CCC begin backup; --- Notify Oracle of the start of backup.
}
sqlend()
{
sqlplus AAA/BBB <<!
alter tablespace CCC end backup; --- Notify Oracle of the stopping of backup.
}
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) Notification issued to Oracle of the start of backup
if [ "-a" operand specification ]
then
sqlbegin() invocation --- Notify Oracle of the start of backup.
Error handling
fi

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

# 3) Notification issued to Oracle of the stopping of backup
if [ "-a" operand specification ]
then
sqlend() invocation --- Notify Oracle of the stopping of backup.
Error handling
fi

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

exit 0

B.2.1.4 Logical Volume Backup

Overview

The sample shell script for the replication management function (swsrp_or_lv_bk) uses AdvancedCopy Manager to back up the transaction data of an Oracle database onto a logical volume.
The transaction data is copied to the work disks prepared by users.

This shell script corresponds to steps 2 to 4 in "B.1.1 Backup Procedure".

Format

swsrp_or_lv_bk {-a | -i} fromVolumeName toVolumeName

Options

-a

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

-i

Specify when an Oracle database is stopped. The start of backup processing is not declared to the Oracle server.

Operands

fromVolumeName

Specify the name of the backup source volume (replication source volume that was set with the swsrpsetvol command).

toVolumeName

Specify the name of the backup destination volume (replication destination volume that was set with the swsrpsetvol command).

Example of Using swsrp_or_lv_bk

Back up logical volume "/dev/dsk/c0t0d0s0" where the Oracle database is located to logical volume "/dev/dsk/c1t3d0s2@TARG-SV" that is connected to a different server while in operation.

# swsrp_or_lv_bk -a /dev/dsk/c0t0d0s0 /dev/dsk/c1t3d0s2@TARG-SV
swsrp_or_lv_bk completed. ( /dev/dsk/c0t0d0s0 -> /dev/dsk/c1t3d0s2@TARG-SV at 23:01 on 1999.11.01 )

Processing Outline of swsrp_or_lv_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()
{
sqlplus AAA/BBB <<!
alter system switch logfile;
alter system flush shared_pool;
alter tablespace CCC begin backup; --- Notify Oracle of the start of backup.
}
sqlend()
{
sqlplus AAA/BBB <<!
alter tablespace CCC end backup; --- Notify Oracle of the stopping of backup.
}
getbvol() --- 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/FJSVswsrp/bin

# 1) Notification issued to Oracle of the start of backup
if [ "-a" operand specification ]
then
sqlbegin() invocation --- Notify Oracle of the start of backup.
Error handling
fi

# 2) Disk backup (copy) by AdvancedCopy Manager command
swsrpmake $FROM_VOL $TO_VOL --- Copy the disk.
Error handling

# 3) Notification issued to Oracle of the stopping of backup
if [ "-a" operand specification ]
then
sqlend() invocation --- Notify Oracle of the stopping of backup.
Error handling
fi

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

exit 0