The sample shell scripts provided are summarized below. These scripts are stored in the /etc/opt/FJSVswsts/samp directory.
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 |
swst_or_iv outputs information about an Oracle database. The output file names and their contents are:
spdata.lst: List of table space names and storage destinations
spdata.bgn: Command in the following format:
Alter tablespace Table-space-name begin backup; |
spdata.end: Command in the following format:
Alter tablespace Table-space-name end backup; |
spcont.lst: Oracle database control file information
splog.lst: Oracle database log file information
spredolog.lst: REDO Log file information of an Oracle database
Use the database information above as a reference for creating shell scripts for backup processing.
swst_or_iv |
# swst_or_iv swst_or_iv completed. |
spdata.lst
TABLESPACE-NAME DEVICE-NAME
-------------------- ----------------------------------------------------------------------
ACMTS1 /dev/vg170/rlvol170
SYSAUX /var/adm/crash/u01/app/oracle/OraHome_1/oradata/acmtest1/sysaux01.dbf
SYSTEM /var/adm/crash/u01/app/oracle/OraHome_1/oradata/acmtest1/system01.dbf
UNDOTBS1 /var/adm/crash/u01/app/oracle/OraHome_1/oradata/acmtest1/undotbs01.dbf
USERS /var/adm/crash/u01/app/oracle/OraHome_1/oradata/acmtest1/users01.dbf
spdata.bgn
alter tablespace ACMTS1 begin backup;
alter tablespace SYSAUX begin backup;
alter tablespace SYSTEM begin backup;
alter tablespace UNDOTBS1 begin backup;
alter tablespace USERS begin backup;
spdata.end
alter tablespace ACMTS1 end backup;
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 /var/adm/crash/u01/app/oracle/
OraHome_1/oradata/acmtest1/con
trol01.ctl, /var/adm/crash/u01
/app/oracle/OraHome_1/oradata/
acmtest1/control02.ctl, /var/a
dm/crash/u01/app/oracle/OraHom
e_1/oradata/acmtest1/control03
.ctl
splog.lst
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /var/adm/crash/u01/app/oracle/
OraHome_1/flash_recovery_area
db_recovery_file_dest_size big integer 2G
spredolog.lst
GROUP# MEMBER
---------- ------------------------------------------------------------------------------
3 /var/adm/crash/u01/app/oracle/OraHome_1/oradata/acmtest1/redo03.log
2 /var/adm/crash/u01/app/oracle/OraHome_1/oradata/acmtest1/redo02.log
1 /var/adm/crash/u01/app/oracle/OraHome_1/oradata/acmtest1/redo01.log |
#!/bin/sh
reterr() --- An error message is output before an error is returned.
sqldata()
{
sqlplus /nolog <<!
connect / as sysdba
SELECT --- Acquire Oracle table space information.
}
sqllog()
{
sqlplus /nolog <<!
connect / as sysdba
show --- Acquire Oracle log information.
}
sqlcont()
{
sqlplus /nolog <<!
connect / as sysdba
show --- Acquire Oracle control information.
}
sqlredolog()
{
sqlplus /nolog <<!
connect / as sysdba
show --- Acquire Oracle REDO log 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
# 4) Acquisition of Oracle REDO log information
sqlredolog() invocation --- Acquire Oracle REDO log information
exit 0 |
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".
swst_or_fs_bk {-a | -i} <mount-point-name> |
-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. mount-point-name: Specify the name of the mount point targeted for backup. |
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/vg170 at 23:00 on 2005.10.01 ) |
#!/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 /nolog <<!
connect / as sysdba
alter system switch logfile;
alter system flush shared_pool;
alter tablespace CCC begin backup; --- Notify Oracle of the start of backup.
}
sqlend()
{
sqlplus /nolog <<!
connect / as sysdba
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 $VG --- 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 $VG`" --- Fetch a backup volume as a character device.
BDDATE="`getdate $VG`"--- Fetch the backup date.
BDTIME="`gettime $VG`"--- Fetch the backup time.
exit 0 |
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".
swst_or_rd_bk {-a | -i} <device name> |
-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. device name: Specify the name of the raw device targeted for backup. |
While the database is online, back up /dev/vg170 in which an Oracle database is located.
# swst_or_rd_bk -a /dev/vg170 swst_or_rd_bk completed. (/dev/vg170 -> /dev/vg171 at 23:01 on 2005.10.01 ) |
#!/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 /nolog <<!
connect / as sysdba
alter system switch logfile;
alter system flush shared_pool;
alter tablespace CCC begin backup; --- Notify Oracle of the start of backup.
}
sqlend()
{
sqlplus /nolog <<!
connect / as sysdba
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 |