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_vg_bk | Oracle transaction | Raw device |
Note
When a database exists on a file system, backup cannot be performed if the database is in use.
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
-------------------- --------------------------------------------------
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
ACMTS1 /dev/rlvol36001
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;
alter tablespace ACMTS1 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;
alter tablespace ACMTS1 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
spredolog.lst
GROUP# MEMBER
---------- ------------------------------------------------------------------------------
3 /work/u01/app/oracle/oradata/acmtest1/redo03.log
2 /work/u01/app/oracle/oradata/acmtest1/redo02.log
1 /work/u01/app/oracle/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_vg_bk, run using AdvancedCopy Manager, backs up live data using an Oracle database on a raw device.
Live 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."
swst_or_vg_bk {-a | -i} <volume group 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. volume group name: Specify the name of the volume group targeted for backup. |
While processing is active, back up /dev/vg01 in which an Oracle database is located.
# swst_or_vg_bk -a /dev/vg01 swst_or_vg_bk completed. (/dev/vg01 -> /dev/vg02 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.
BKDATE="`getdate $SRC`"
BKTIME="`gettime $SRC`"
exit 0 |