ETERNUS SF AdvancedCopy Manager Operator's Guide 13.0 -Microsoft(R) Windows(R) 2000- -Microsoft(R) Windows Server(TM) 2003- |
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 a sample scripts for backup. The manager of backup operation should correct the sample script according to the work and apply it to the actual backup operation.
This document and the sample script back up both the two drives on which all the physical data files in the table space in an instance to be backed up.
However, you can back up only a drive with a table space to be backed up by correcting the script.
Backup on AdvancedCopy Manager is performed in units of drives. If a drive with a data file in the table space to be backed up has data files in other table space, make an Oracle backup declaration for them also. To back up the SYSTEM table space shown in Figure B.1, for example, make Oracle backup declarations in all the five table spaces including other areas in the same volume.
A data file in the table space backed up without an Oracle backup declaration cannot be used for recovery because, even during backup, updating of the data file occurs to generate inconsistencies.
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
This chapter describes performing backup and restoration of an Oracle database using AdvancedCopy Manager.
The following shows an overview of the backup procedure.
Checking the work operation status
Check whether work is in operation or not.
Stopping work
If work is found to be in operation in Step 1, declare the start of online backup for the database and stop updating data files to make the disk partition that stores work data ready for online backup.
Backing up (copying) a disk partition
Using the backup function of AdvancedCopy Manager, back up (copy) a disk partition that stores work data.
Restarting work
If work is found to be in operation in Step 1, declare the end of online backup for the database and restart updating data files.
AdvancedCopy Manager provides a sample script that automatically performs Steps 2 through 5. For more information, see "Backup".
The following shows an overview of performing restoration from a backup disk.
Checking the work stop status
Check that work is stopped. If work is in operation, completely stop the work.
Performing restoration from a backup disk
Using the restoration function of AdvancedCopy Manager, restore data from a backup disk to a transaction volume.
This chapter describes samples scripts provided for AdvancedCopy Manager.
Samples scripts provided for AdvancedCopy Manager are stored under the "program-directory\etc\backup\sample" directory. Figure B.5 shows the correlation chart of sample scripts.
You are recommended to copy these sample scripts to an arbitrary folder before using them.
swst_or_iv.sql outputs the information of an Oracle database. This script outputs:
A list of table space names and storage destinations
Information of a log file of an Oracle database
Use the above database information as reference for creating a script that performs backup.
Start method
sqlplus user-name/password@connection-string-for-DB-to-be-backed-up @swst_or_iv |
Usage example
C:\>sqlplus system/manager@orcl @swst_or_iv <RETURN> |
Result example
SQL*Plus: Release 8.1.6.0.0 - Production on Tue, May 22 21:33:21 2001 (c) Copyright 1999 Oracle Corporation. All rights reserved. Oracle8i Release 8.1.6.0.0 - Production JServer Release 8.1.6.0.0 - Production Connected to: TABLESPACE-NAME DEVICE-NAME -------------------- -------------------------------------------------- INDX D:\ORACLE\ORADATA\CONTENTS\INDX01.DBF RBS D:\ORACLE\ORADATA\CONTENTS\RBS01.DBF SYSTEM D:\ORACLE\ORADATA\CONTENTS\SYSTEM01.DBF TEMP D:\ORACLE\ORADATA\CONTENTS\TEMP01.DBF TOOLS D:\ORACLE\ORADATA\CONTENTS\TOOLS01.DBF USERS E:\ORACLE\ORADATA\CONTENTS\USERS01.DBF SQL> show parameters log_archive_dest NAME TYPE ------------------------------------ -------------- VALUE ------------------------------ log_archive_dest string D:\Oracle\oradata\contents\arc hive log_archive_dest_1 string log_archive_dest_2 string log_archive_dest_3 string log_archive_dest_4 string log_archive_dest_5 string log_archive_dest_state_1 string enable log_archive_dest_state_2 string enable log_archive_dest_state_3 string enable log_archive_dest_state_4 string enable log_archive_dest_state_5 string enable SQL>EXIT Oracle8i Release 8.1.6.0.0 - Production JServer Release 8.1.6.0.0 - Disconnect Production |
The SQL*Plus tool comes in the following types, each of which corresponds to a version of Oracle.
Oracle version
Command-line-based version
Window-based version
Oracle7 Release7.3.x
PLUS33.EXE
PLUS33W.EXE
Oracle8 Release8.0.x
PLUS80.EXE
PLUS80W.EXE
Oracle8i Release8.1.x
SQLPLUS.EXE
SQLPLUSW.EXE
swst_or_bk_as.js backs up work data stored in an Oracle database on a file system, using AdvacncedCopy Manager.
Work data will be copied to a backup volume of AdvancedCopy Manager.
This script corresponds to Steps 2 through 5 described in "Backup procedure".
Start method
CSCRIPT.EXE swst_or_bk_as.js |
Usage example
C:\>CSRIPT.EXE swst_or_bk_as.js |
Result example
No result in particular will be output if the processing ends normally.
Processing overview
Main processing try { // create global objects var oracle_sid = "CONTENTS"; // [[[ **1** TARGET INSTANCE NAME ]]] var ScriptPathName = "C:\\SCRIPT"; // [[[ **2** SCRIPT PATH ]]] var BinPathName = "C:\\WIN32APP\\AdvancedCopyManager\\bin" // [[[ **3** SCRIPT PATH ]]] var OraclePathName = "D:\\Oracle\\Ora81\\bin"; // [[[ **4** ORACLE PATH ]]] var OracleServerManager9i = "sqlplus /nolog"; // [[[ ORACLE SERVER MANAGER Oracle9i ]]] var OracleServerManager8i = "svrmgrl"; // [[[ ORACLE SERVER MANAGER Oracle8i ]]] var OracleServerManager8 = "svrmgr30"; // [[[ ORACLE SERVER MANAGER Oracle8.x ]]] var OracleServerManager7 = "svrmgr23"; // [[[ ORACLE SERVER MANAGER Oracle7.x ]]] var OracleSM = OraclePathName + "\\" + OracleServerManager8i; // [[[ **5** PLEASE SELECT ]]] ----- One is chosen and described from above four. var FirstBusinessVolumeName = "g3d0p2"; // [[[ **6** First Business Volume Name ]]] var WorkBatchfile = ScriptPathName + "\\work" + FirstBusinessVolumeName + ".bat"; // [[[ Work Batchfile ]]] var ErrorLogfile = ScriptPathName + "\\error" + FirstBusinessVolumeName + ".log"; // [[[ Error Logfile ]]] // create Shell object var WshShell = WScript.CreateObject("WScript.Shell"); ***** The backup file processing start of a one-eyed drive ****** //[[[ First Drive - START - ]]] ExecSql("swst_first_st.sql", true); // [[[ ***7*** FileName ]]] if (CheckErrorLog != 0) { ExecSql(swst_first_ed.sql", false); // [[[ ***8*** FileName ]]] swstQuit (1); } var returnCode = WshShell.Run(BinPathName + "\\swstbackup g3d0p2 -Xdevmap " + ScriptPathName + "\\swst_devmap.txt", 0, true); // [[[ ***9*** DeviceName FileName ]]] ExecSql("swst_first_ed.sql", false); // [[[ ***10*** FileName ]]] if (returnCode != 0) { SwstQuit (2); } else if (CheckErrorLog() != 0) { SwstQuit (1); } //[[[ First Drive - END - ]]] ***** The backup file processing end of a one-eyed drive ****** ***** The backup file processing start of the second drive ****** //[[[ Second Drive - START - ]]] ExecSql("swst_second_st.sql", false); // [[[ ***11*** FileName ]]] if (CheckErrorLog != 0) { ExecSql("swst_second_ed.sql, false"); // [[[ ***12*** FileName ]]] swstQuit (1); } var returnCode = WshShell.Run(BinPathName + "\\swstbackup g3d0p3 -Xdevmap " + ScriptPathName + "\\swst_devmap.txt", 0, true); // [[[ ***13*** DeviceName FileName ]]] ExecSql("swst_second_ed.sql", false); // [[[ ***14*** FileName ]]] if (CheckErrorLog != 0) { SwstQuit (2); } else if (CheckErrorLog() != 0) { SwstQuit (1); } //[[[ Second Drive - END - ]]] ***** The backup file processing end of the second drive ****** An error log is deleted at the time of a normal end, and it is completed. var fs = WScript.CreateObject("Scripting.FileSystemObject"); var fs_d = fs.GetFile(ErrorLogfile); fs_d.Delete(true); SwstQuit(0); //Normal END } catch (e) { In an error, it ends, without deleting an error log file. swstQuit(3); //Abnomal END } function ExecSql(fileName, flg) The SQL script file name to perform is received and it performs by the server manager. The 2nd argument is the overwrite propriety flag of a log. function CheckErrorLog() It checks whether the inside of the log file acquired by the redirection after server manager execution is searched, and there is any error of an oracle. function swstQuit(exitStatus) Error processing |
Update a sample script so that it is appropriate for the actual operation.
swst_first_st.sql
Correct this script to declare the start of backup of each table space using a table space name referenced as described in "Collecting DB information".
Example: ALTER TABLESPACE xxxxx BEGIN BACKUP;Enter a table space name in xxxxx.
If different storage destination drives are used, declare this item in a different file created with an arbitrary name on each of the drives.
The user-name and the password described in the CONNECT sentence of the first line are corrected to the one of the user who has the ALTER authority.
swst_first_ed.sql
Correct this script to declare the end of backup of each table space using a table space name referenced as described in "Collecting DB information".
Example: ALTER TABLESPACE xxxxx END BACKUP;Enter a table space name in xxxxx.
If different storage destination drives are used, declare this item in a different file created with an arbitrary name on each of the drives.
The user-name and the password described in the CONNECT sentence of the first line are corrected to the one of the user who has the ALTER authority.
swst_xdevmap.txt
In one line, describe " AdvancedCopy Manager device names" of a transaction volume to be backed up (left) and a corresponding backup volume name (right) while separating them with a "half-size blank or tab character". If there are multiple backup targets, continue describing them using one line for each pair.
Example: g1d0p3 g1d1p3
Note: As the AdvancedCopy Manager device name of a transaction volume, use the volume name displayed in the Device row displayed in the line of a drive to be backed up using "swstexecstat", a AdvancedCopy Manager command.
Example: If the E drive should be backed up in the following diagram, the AdvancedCopy Manager device name of a transaction volume is "g1d1p4".
C:\>C:\Win32app\AdvancedCopyManager\bin\swstexecstat Server Device Last-Backup-Date Interval Status Mount-Point (Method) Execute Work1 g1d1p2 2000/12/11 12:20 OK IDLE C: (NTFS) ---- Work1 g1d1p3 2000/12/10 12:20 DELAY=1 EXEC D: (FAT) snapshot(22%) Work1 g1d1p4 2000/12/9 12:20 DELAY=2 EXEC E: (NTFS) snapshot(45%) : |
swst_or_bk_as.js
Correct this sample script (swst_or_bk_as.js) in the following positions:
An item number indicating a part to be corrected corresponds to an item number provided in a comment in the script.
Correct this item to the Oracle instance name of a backup target.
Correct this item to a directory where the sample script is stored.
Correct this item to AdvancedCopy Manager install-directory + "\\bin".
Correct this item to ORACLE-install-directory + "\\bin".
Select one of the three Oracle versions.
It rewrites it in the business volume name of the first drive for the backup.
Rewrite this item to an already created file name corresponding to "swst_first_st.sql".
Rewrite this item to an already created file name corresponding to "swst_first_ed.sql".
Rewrite this item to the transaction volume name of a drive to be backed up (a drive with a table space specified in Steps 7 and 8 above) and a file name corresponding to "swst_xdevmap.txt".
The same as Step 9 above.
Rewrite this item to an arbitrary file name provided for a different drive in "swst_first_st.sql".
Rewrite this item to an arbitrary file name provided for a different drive in "swst_first_ed.sql".
Rewrite this item to the name of a different transaction volume to be backed up than specified in Step 10 (a drive with a table space specified in Steps 12 and 13 above) and a file name corresponding to "swst_xdevmap.txt".
The same as Step 13 above.
This sample script assumes that physical file of an instance is stored over two drives. If the information of an instance referenced as described in "Collecting DB information" has only one drive, delete the two parts enclosed between the following lines. If more than two drives are used, copy the parts for the third and later drives and correct each of them.
//[[[ Second Drive - START - ]]]XXXXXXXXXXXXXX//[[[ Second Drive - END - ]]]
Change the svrmgrl command to the sqlplus command (nolog/option specification) for Oracle9i.
This script operates only on a storage server of AdvancedCopy Manager.
In the sample script (swst_or_bk_as.js) updated as described in "Updating a sample script", the AdvancedCopy Manager backup command (swstbackup) is excuted. The AdvancedCopy Manager backup command normally locks a volume to be backed up so that no file is updated while being backed up.
As explained above, only flushing of the file system buffer without locking of the backup target volume is necessary for execution of the AdvancedCopy Manager backup command with the backup target volume of the Oracle database specified as in "Updating sample scripts." Therefore, change preprocessing and postprocessing operations in the transaction volume locking specification file for backups. An example of settings is shown below. If a machine in the SP-series is not used, then the preprocessing and postprocessing operations can be changed by specifying the Xflush option in the swstbackup command.
Transaction volume locking specification file for backups
Use the restoration function of AdvancedCopy Manager to perform restoration.
To restore only part of the files on a transaction volume, use the restoration command (swstrestore) of AdvancedCopy Manager with the -r operand specified to restore backup data to a work drive. Use the copy command of the OS to copy only destroyed files from the work drive.
Store data files and other files of Oracle on different disks or in different partitions.
There are the following notes.
Initialization parameter file
Whenever a change is made, back up this file using the copy command, etc. of the OS.
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
Be sure to perform Oracle synchronous backup processing (begin backup/end backup) on all the table spaces to be backed up. No backup file created without synchronous processing can be used for recovery. Performing recovery using such a backup file is risky. If you do, an inconsistency may be generated in a database, which in turn can no longer be opened.
When placing a data file in a file system, disable automatic data file extension (AUTOEXTEND OFF).
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.
To recover an Oracle database to the latest status, first restore the Oracle database and replace the files in which the error occurred with restored files, using the recovery function of Oracle.
Example: recover tablespace
For information on the recovery function of Oracle databases, see "Oracle8i Backup and Recovery Guide" (if the database is Oracle8i).
Contents
Index
![]() ![]() |