ETERNUS SF AdvancedCopy Manager Operator's Guide 13.0 -Solaris- |
Contents
Index
![]() ![]() |
This appendix describes sample scripts for AdvancedCopy Manager.
A sample script allows you to back up data on a transaction volume by using AdvancedCopy Manager.
This section explains how the sample shell script is created for the backup management function. By using it as a reference when creating similar script for the replication management function, you can copy Oracle databases.
Use AdvancedCopy Manager to back up a transaction volume.
AdvancedCopy Manager provides some sample shell scripts for backup processing. The backup operation administrator must modify the sample shell scripts by adjusting them appropriately for the business at hand and then apply them to actual backup operations.
Sample scripts provided for AdvancedCopy Manager are created assuming that the following versions of Oracle are used. If you use any other version, correct the sample scripts as required.
Oracle8i Release 8.1.x
The following shows an overview of the backup procedure.
Checking the work operation status
Check whether work is in operation or not.
Business stoppage
For business in progress in 1, make contents of each transaction volume consistent.
Disk backup
Create backup copies of transaction volumes by using the backup function of AdvancedCopy Manager.
Business restart
For business in progress in 1, restart the business at hand.
The following shows an overview of performing restoration from a backup tape.
Checking the work stop status
Check that work is stopped. If work is in operation, completely stop the work.
Restore
Use the restoration function of AdvancedCopy Manager to perform restoration from the backup volume to the transaction volume.
Business restart
The sample shell scripts provided by AdvancedCopy Manager are summarized below. These sample shell 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 the information of an Oracle database. This script outputs:
Output file names and their contents are as follows:
spdata.lst: List of table space names and storage destinations
spdata.srt: Sorted results of spdata.lst using the storage destination as the key
spdata.bgn: Command in the following format:
tablespace: Table-space-name begin backup:
spdata.end: Command in the following format:
tablespace: Table-space-name end backup:
spcont.lst: Control file information of an Oracle database
splog.lst: Log file information of an Oracle database
The above files are used as references for creating shell scripts used for backup processing.
For Oracle 9i or later, replace the svrmgrl command used in swst_or_iv with the sqlplus command.
Start
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() { svrmgrl <<! show --- Acquire Oracle log information. } sqlcont() { svrmgrl <<! 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 |
swst_or_fs_bk run AdvancedCopy Manager to back up an Oracle database on the file system and business data using general files.
Business data is copied to the backup volumes of AdvancedCopy Manager. These scripts applies to steps 2 to 5 in "Backup procedure."
Start
swst_or_fs_bk {-a | -i} <mount-point-name> |
Explanation of operands
-a: Specify when business using an Oracle database is active. The start of backup processing is declared to the Oracle server. -i: Specify when business using 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. |
Example of using swst_or_fs_bk
While business 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 |
swst_or_rd_bk run AdvancedCopy Manager to back up business data using an Oracle database on a raw device.
Business data is copied to work disks prepared by users.
These scripts applies to steps 2 to 5 in "Backup procedure."
Start
swst_or_rd_bk {-a | -i} <device name> |
Explanation of operands
-a: Specify when business using an Oracle database is active. The start of backup processing is declared to the Oracle server. -i: Specify when business using 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 partition targeted for backup. |
Example of using swst_or_rd_bk
While business 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 |
Update the procedures below of swst_or_iv to adjust them for actual operations. The following numbers correspond to those in the scripts.
0) Environmental variable setting
1) Acquisition of Oracle table space information
2) Acquisition of Oracle log information
3) Acquisition of Oracle control information
The above procedures 1) to 3) change Oracle account information.
These scripts can operate only on business servers of AdvancedCopy Manager.
Set up backup volumes so that the mount point targeted for backup is backed up correctly in AdvancedCopy Manager.
The generations of the backup volumes to be managed are arbitrary.
Update the procedures below of swst_or_fs_bk to adjust them for actual operations. The following numbers correspond to those in the scripts.
0) Environmental variable setting
1) Notification issued to Oracle of the start of backup
2) Notification issued to Oracle of the stopping of backup
The above procedures 1) and 3) refer to the spdata.bgn file and spdata.end file created by swst_or_iv.
These scripts can operate only on business servers of AdvancedCopy Manager.
Set up backup volumes so that the raw devide targeted for backup is backed up correctly in AdvancedCopy Manager.
The generations of the backup volumes to be managed are arbitrary.
Update the procedures below of swst_or_rd_bk to adjust them for actual operations. The following numbers correspond to those in the scripts.
0) Environmental variable setting
1) Notification issued to Oracle of the start of backup
2) Notification issued to Oracle of the stopping of backup
The above procedures 1) and 3) refer to the spdata.lst file, spdata.srt file, spdata.bgn file, spdata.end file, splog.lst file, and spcont.lst file created by swst_or_iv.
These scripts can operate only on business servers of AdvancedCopy Manager.
After executing a shell script, a backup volume name and the processing time are output in a message. When restoring it, these information is needed. Thus, the backup volume name and processing time output in a message after execution of a shell script must be recorded and managed.
Use the restore function of AdvancedCopy Manager for restore processing.
Use the restore function of AdvancedCopy Manager for restore processing.
Store Oracle data files and files other than data files on separate disks or in separate slices.
Initialization parameter file
Every time a change occurs, the cp command of the OS is executed for backup.
Control files
You are recommended to use mirroring due to Oracle.
If a change is made in the DB environment, use the following command to create a trace file. If a control file is destroyed, execute the SQL statement in the trace file to recover the control file.
alter database backup control file to trace;
Data files
The recommended location of data files is on a raw device.
To store a data file on the file system, disable the automatic extended function of the data file (AUTOEXTEND OFF). Then, customization of the sample shell script is required to prevent unmounting during context processing.
Create backup copies in AdvancedCopy Manager.
The range of table spaces targeted for backup must be within the unit of synchronous backup processing (begin backup/end backup) in Oracle and the unit of backup in AdvancedCopy Manager. For example, if backup copies must be created in units of LUNs in AdvancedCopy Manager, place one table space in one LUN.
Archive all of the latest logs by executing the following command after backing up all table spaces in the system:
alter system archive log current;
REDO files
You are recommended to mirror online REDO log files and archive log files using Oracle or the OS.
No online REDO log file needs to be backed up.
For online backup operations, the target Oracle database must use an archive log.
After Oracle database has stopped, restore the database, and restart it. To recover the database to the latest state, use the recovery function of Oracle.
Contents
Index
![]() ![]() |