Sample scripts that are provided for AdvancedCopy Manager are stored under the "<Environment directory>\etc\backup\sample" directory. The figure below shows the correlation chart of sample scripts.
Note
It is recommended that these sample scripts are copied to different folder before using them.
swst_or_iv.sql outputs the information from an Oracle database. This script outputs:
A list of table space names and storage destinations
Information from the log file of an Oracle database
Use the above database information as a reference for creating a script that performs backup.
sqlplus user-name/password@connection-string-for-DB-to-be-backed-up @swst_or_iv |
C:\>sqlplus system/manager@orcl @swst_or_iv |
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 |
Note
The SQL*Plus tool comes in the following executable files, each of which corresponds to a version of Oracle.
Oracle version | Command-line-based version | GUI 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 processing data stored in an Oracle database on a file system, using AdvancedCopy Manager.
Processing data will be copied to a backup volume of AdvancedCopy Manager.
This script corresponds to steps 2 through 5 described in "B.2.1 Backup procedure".
CSCRIPT.EXE swst_or_bk_as.js |
C:\>CSRIPT.EXE swst_or_bk_as.js |
No result will be output if the processing ends normally.
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 |