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.
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 |
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:
spdata.lst: List of table space names and storage destinations
spdata.srt: Results of spdata.lst, with storage destination as the sort key
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
Use the database information above as a reference for creating shell scripts for backup processing.
Sample Shell Script for the Backup Management Function
Format
swst_or_iv
Usage Example
# swst_or_iv swst_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/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
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 |
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".
swst_or_fs_bk {-a | -i} mountPointName
Specify when an Oracle database is online. The start of backup processing is declared to the Oracle server.
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.
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/dsk/c1t3d0s2/gyoumu_db_SW at 23:00 on 1999.11.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 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
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".
swst_or_rd_bk {-a | -i} rawdeviceName
Specify when an Oracle database is online. The start of backup processing is declared to the Oracle server.
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.
Specify the name of the raw device targeted for backup.
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 )
#!/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
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
Specify when an Oracle database is online. The start of backup processing is declared to the Oracle server.
Specify when an Oracle database is stopped. The start of backup processing is not declared to the Oracle server.
Operands
Specify the name of the backup source volume (replication source volume that was set with the swsrpsetvol command).
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 |