Top
ETERNUS SF AdvancedCopy Manager V15.1 Operation Guide
ETERNUS

B.3.1 Overview of sample scripts

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

Table B.1 Sample shell script for Oracle

No.

Type

Script name

Associated transaction

Associated resource type

1

Collection of DB information

swst_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


B.3.1.1 Collecting DB information

swst_or_iv outputs information about an Oracle database. The output file names and their contents are:

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

Note

For Oracle 9i or later, replace the "svrmgrl" command used in "swst_or_iv" with the sqlplus command.

Format
swst_or_iv
Usage example
# swst_or_iv
swst_or_iv completed.
Result example
spdata.lst
TABLESPACE-NAME               DEVICE-NAME
-------------------- --------------------------------------------------
ORA10                /ora1/ora0.dbf
ORA20                /ora2/ora0.dbf
RBS                  /oracle/ora/oradata/rbs01.dbf
SYSTEM               /oracle/ora/oradata/system01.dbf
TEMP                 /oracle/ora/oradata/temp01.dbf
TOOLS                /oracle/ora/oradata/tools01.dbf
USERS                /oracle/ora/oradata/users01.dbf
spdata.bgn
alter tablespace ORA10 begin backup;
alter tablespace ORA20 begin backup;
alter tablespace RBS begin backup;
alter tablespace SYSTEM begin backup;
alter tablespace TEMP begin backup;
alter tablespace TOOLS begin backup;
alter tablespace USERS begin backup;
spdata.end
alter tablespace ORA10 end backup;
alter tablespace ORA20 end backup;
alter tablespace RBS end backup;
alter tablespace SYSTEM end backup;
alter tablespace TEMP end backup;
alter tablespace TOOLS 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 svrmgrl <<!
show --- Acquire Oracle log information.
}
sqlcont()
{
sqlplus vrmgrl <<!
show --- Acquire Oracle control information.
}

# main()

# 0) Environmental variable setting
PATH=$PATH:/usr/bin:/usr/sbin:/opt/FJSVswsts/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.3.1.2 File system backup

swst_or_fs_bk, run using AdvancedCopy Manager, backs up processing data stored in an Oracle database on a file system.
Processing data is copied to the backup volumes of AdvancedCopy Manager. These scripts correspond to steps 2 to 5 in "B.3.2.1 DB information collection".

Format
swst_or_fs_bk {-a | -i} <mount-point-name>
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
mount-point-name

Specify the name of the mount point targeted for backup.

Example 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.3.1.3 Raw device backup

swst_or_rd_bk is run using AdvancedCopy Manager to back up live data using an Oracle database on a raw device.
Live data is copied to work disks prepared by users.
These scripts apply to steps 2 to 5 in "B.3.2.1 DB information collection".

Format
swst_or_rd_bk {-a | -i} <device name>
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
device name

Specify the name of the raw device targeted for backup.

Example 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