ETERNUS SF AdvancedCopy Manager Operator's Guide 13.0 -AIX- |
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 or DB2 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.
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
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.
Oracle 9i (V 9.2.0.1.0)
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_rd_bk |
Oracle transaction |
Raw device |
When a database exists on a file system, it cannot back up during starting of the business which uses the database.
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.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
spredolog.lst: REDO Log file information of an Oracle database
The above files are used as references for creating shell scripts used for backup processing.
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 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 |
Processing outline
#!/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 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 4 in "Backup procedure."
Start
swst_or_vg_bk {-a | -i} <volume group 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. volume group name: Specify the name of the volume group targeted for backup. |
Example of using swst_or_vg_bk
While business 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 ) |
Processing outline of swst_or_vg_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 /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 |
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 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_vg_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
3) Notification issued to Oracle of the stopping of backup
The above procedures 1) and 3) refer to the spdata.lst file, spdata.bgn file, spdata.end file, splog.lst file, spredolog.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.
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.
Sample scripts provided for AdvancedCopy Manager are created assuming that the following versions of DB2 are used. If you use any other version, correct the sample scripts as required.
DB2 (v8.1.1.64)
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_db2_iv |
DB2 transaction |
- |
2 |
Backup |
swst_db2_vg_bk |
DB2 transaction |
Raw device |
When a database exists on a file system, it cannot back up during starting of the business which uses the database.
swst_db2_iv outputs the information of an DB2 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
The above files are used as references for creating shell scripts used for backup processing.
Start
swst_db2_iv |
Usage example
# swst_db2_iv swst_db2_iv completed. |
Result example
spdata.lst TABLESPACE-NAME DEVICE-NAME -------------------- -------------------------------------------------- SYSCATSPACE /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SQLT0000.0 TEMPSPACE1 /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SQLT0001.0 USERSPACE1 /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SQLT0002.0 ACMTS34 /dev/rlvol34001 SYSTOOLSPACE /work/ACM_DB2/db2inst1/database/db2inst1/NODE0000/SQL00001/SYSTOOLSPACE |
Processing outline
#!/bin/sh reterr() --- An error message is output before an error is returned. sqldata() { db2 list tablespaces ----------------------------------- Acquisition of table space name and table space ID db2 list tablespace containers for <table space ID> --- Acquisition of device name } # main() # 0) Environmental variable setting PATH=$PATH:/usr/bin:/usr/sbin # 1) Acquisition of DB2 table space information db2 connect to acmtest1 --- Connect the DB2 sqldata db2 terminate ------------- Terminate the DB2 exit 0 |
swst_db2_vg_bk run AdvancedCopy Manager to back up business data using an DB2 database on a raw device.
Business data is copied to work disks prepared by users.
These scripts applies to steps 2 to 4 in "Backup procedure."
Start
swst_db2_vg_bk {-a | -i} <volume group name> |
Explanation of operands
-a: Specify when business using an DB2 database is active. The start of backup processing is declared to the Oracle server. -i: Specify when business using an DB2 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. |
Example of using swst_db2_vg_bk
While business is active, back up /dev/vg01 in which an DB2 database is located. # swst_db2_vg_bk -a /dev/vg01 swst_db2_vg_bk completed. (/dev/vg01 -> /dev/vg02 at 23:01 on 2005.10.01 ) |
Processing outline of swst_db2_vg_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() { db2 set write suspend for db --- Suspend the DB2 database. sync } sqlend() { db2 set write resume for db ---- Resume the DB2 database. } 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) Suspend if [ "-a" operand specification ] then db2 connect to <database name> sqlbegin() ----- Suspend the database. fi # 2) Disk backup (copy) by AdvancedCopy Manager command swstbackup $SRC --- Copy the disk. # 3) Resume if [ "-a" operand specification ] then sqlend() --- I/O of DB2 is put into the state of suspend. db2 terminate -------- Terminate the database. 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 |
Update the procedures below of swst_db2_iv to adjust them for actual operations. The following numbers correspond to those in the scripts.
0) Environmental variable setting
1) Acquisition of DB2 table space 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 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_db2_vg_bk to adjust them for actual operations. The following numbers correspond to those in the scripts.
0) Environmental variable setting
1) Notification issued to DB2 of the start of backup
3) Notification issued to DB2 of the stopping of backup
The above procedures 1) and 3) refer to the spdata.lst fil created by swst_db2_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.
Store Oracle data files and files other than data files on separate disks or in separate slices.
Database
Back up by the BACKUP DATABASE command of DB2.
db2 => backup database DB name to target;
[Database structure]
Drive/directory : The drive or directory specified by the CREATE DATABASE command
DB2 instance name : The owner name of a DB2 instance
Partition number of a database
Database ID
Default log directory of a database
Catalog table space
Temporarily table space
User table space
User table space
The user table space should be created on a RAW device rather than at file system level.
In case of table space, the table space container is also a part of the backup, and hence please use the provided sample shell scripts.
Using AdvancedCopy Manager the backup operation is performed.
The table spaces targeted for backup, should be selected within the AdvancedCopy Manger's backup unit.
For example, in case the unit of backup of AdvancedCopy Manger is a LUN, then 1 table space should lie on 1 LUN.
After DB2 database has stopped, restore the database, and restart it. To recover the database to the latest state, use the recovery function of DB2.
When performing the restore of data, please use the following order
Database
User table space
Contents
Index
![]() ![]() |