Tchater maintenant avec le support
Tchattez avec un ingénieur du support

Toad for SQL Server 7.4.1 - Installation Guide

Use File Automation Activities

You can use the following activities in automation scripts.

Tip: You can save an activity and its settings as a template to reuse in other scripts. Right-click the activity in the design window and select Save As Template. After you create the first template, a Templates toolbox displays.

Activity Description

Copy File

Copy or move one or more files to another location (for example, to a shared folder where they can be accessed by your business community).

Review the following for additional information:

  • Source file—Select the file to copy.

    In this field, you can also use the asterisk (*) and question mark (?) wildcard characters, as well as variables, in the file name to help you select one or more files (in the same directory) to copy. To use this method:

    1. Specify the file directory by browsing to and selecting one of the files.
    2. Then modify the file name in the Source file field using wildcard characters and/or variables.
  • Copy to folder—Select the destination folder into which you want to copy or move the file or files.
  • Copy name—To rename the copied or moved file, enter a new name.

    Note: This field is only applicable when copying a single source file.

  • Suffix—Select a suffix to append to the file name. Select from the list of existing suffixes, or click to select a variable or build a new suffix using the expression editor.

  • Delete source file—Select to move the file from the source folder to the destination folder. Deselect to copy the file to the destination folder.
  • Retry—Specify the number of times to retry the copy action if an error or timeout occurs.
  • Wait—Specify the number of seconds to wait between retries.

Delete File

Delete one or more files from one or more specified locations. You can also use this activity to delete files that are created previously in the script.

Files to delete—Click Add Files to select one or more files to delete. In the File Collection Editor, do one or both of the following:

  • To delete files created previously in the script, select a file in the left pane and click Add.

    Note: When a file name is displayed for selection in the left pane, any variable names that are used in the file name are visible (#MyVariable#), but suffixes are not visible.

  • To select other existing files, click to browse to and select the files.

    In this field, you can also use the asterisk (*) and question mark (?) wildcard characters, as well as variables, in the file name to help you select one or more files (in the same directory) to delete. To use this method:

    1. Specify the file directory by browsing to and selecting one of the files.
    2. Then modify the file name in the Files to Delete pane using wildcard characters and/or variables.

    Note: As an example of using wildcards and variables, using the file name MonthlyReport_#var#*.xls, where #var# is Feb, would delete all reports whose file name begins with "MonthlyReport_Feb" in the same directory.

Log Comment

Writes a comment to the scripts's log.

Log message—Enter the text of the comment you want to insert into the log when this activity executes.

Zip/Unzip Files

Create a zip file (compressed folder) and add files to it. You can add files created previously in the script to the zip file. Use this activity to zip multiple files and then attach the zip file to an email using the Email activity.

You can also use this activity to unzip a zip file.

Review the following for additional information:

Zip Tab

  • Archive name—Select a location and name for the zip file. You can use a variable in this field by entering the hash symbol before and after the variable name (#VariableName#).
  • Suffix—Select a suffix to append to the file name. Select from the list of existing suffixes, or click to select a variable or build a new suffix using the expression editor.

  • Password—Enter a password if you want to password protect the zip file.
  • Hide password—Select this option to mask password during input.
  • Encryption—Select whether to create a zip file without encryption (Standard) or to encrypt the zip file.

    Note: If you encrypt the zip file, you must have a zip utility that can support 128-bit or 256-bit decryption.

  • Zip all files in this directory—Select a directory. All files in the directory will be added to the zip file. You can use both this field and the Source files field to select files to add to the zip file.
  • Source files—Click Add Files to select one or more files to add to the zip file. In the File Collection Editor, do one or both of the following:
    • To add files created previously in the script, select a file in the left pane and click Add.

      Note: When a file name is displayed for selection in the left pane, any variable names that are used in the file name are visible (#MyVariable#), but suffixes are not visible.

    • To select other existing files, click to browse to and select the files.

      In this field, you can also use the asterisk (*) and question mark (?) wildcard characters, as well as variables, in the file name to help you select one or more files (in the same directory) to add. To use this method:

      1. Specify the file directory by browsing to and selecting one of the files.
      2. Then modify the file name in the Files to Archive pane using wildcard characters and/or variables.

Unzip Tab

  • Archive name—Select a zip file.
  • Password—If password-protected, enter the password.
  • Extract to folder—Select a location to extract the files to.

To learn how to use the Zip/Unzip Files activity, see the following:

Find and Replace

This activity opens one or more files and performs find and replace actions inside the files. You can write the results to a different location and file name.

Review the following for additional information:

  • Find/Replace—You can have multiple Find/Replace tasks within one activity. You can specify a different source file, save file, and action for each Find/Replace task.
  • Source file—Select the file in which to perform the find and replace action for the selected Find/Replace task.

    In this field, you can also use the asterisk (*) and question mark (?) wildcard characters in the file name to help you select one or more files (in the same directory). To use this method:

    1. Specify the file directory by browsing to and selecting one of the files.
    2. Then modify the file name in the Source file field using the wildcard characters.
  • Find—Enter the content to find.
  • Replace with—Select the type of replacement content: a value, contents from a file, or a variable value.
  • Set value—Enter the replacement value, select the replacement variable, or select a file containing replacement content.

  • Save file—Select a location and file name.

    The source file is selected by default.

  • Suffix—Select a suffix to append to the file name. Select from the list of existing suffixes, or click to select a variable or build a new suffix using the expression editor.

Note: Use drag and drop or up/down arrows to change the order of multiple Find/Replace tasks in one activity.

To learn how to use the Find and Replace activity, see the following:

FTP File

Upload or download one or more files using an FTP or SFTP connection. Review the following for additional information:

  • Select an FTP connection—Select an FTP connection or define a new connection.

    Note: You can define a new connection prior to using the FTP activity by selecting View | FTP Connections.

  • Transfer ONLY if—Select this option to set conditions for FTP transfer, and then select a condition from the list. If you select this option, the FTP activity only runs if the condition you specify is met.
    • Local directory exists—Select this option to transfer only if a local directory exists, then browse to and select the directory.
    • Local file exists—Select this option to transfer only if a local file exists, then enter the name of the local file.
    • Remote directory exists—Select this option to transfer only if a remote directory exists, then browse to and select the directory.
    • Remote file exists—Select this option to transfer only if a remote file exists, then enter the name of the remote file.
  • Define Operations—Click to specify the files and other options for the FTP upload or download task. Review the following for additional information:
    • Operation—Select Upload or Download.
    • Use file mask—Select this option if you want to select files by using a file mask. Then specify file mask filtering options in the File Mask fields at the bottom of the page.
    • Move files—Select this option to move the files from the source location to the target location instead of copying them.
  • Retry—Specify the number of times to retry the FTP connection if it fails.
  • Wait—Specify the number of seconds to wait between retries.

To learn how to use the FTP activity, see the following:

Publish Files

Publish one or more files to Intelligence Central. You can select files created by previous activities in this script or other existing files.

Review the following for additional information:

Files to Publish—Click Manage Files to select files created previously in this script or to browse for other files to publish. In the File Collection Editor do one or both of the following:

  • Select one or more previously-created files in the left pane and click Add.
  • Click and then browse to select an existing file.

Publishing Options—Click Publishing Wizard to select an Intelligence Central connection and specify publishing options. See Publish to Toad Intelligence Central for more information.

Notes: 

  • To disable an activity, right-click the activity in the design window and select Disabled. This is helpful if you want to disable an activity while testing other activities.
  • The Stop on Error option for each activity allows you to select whether to stop or continue execution if Toad encounters an error during that activity.
  • To prevent an error in one activity from causing a failure at the script level, clear the Generate Error check box (Activity Info tab) for that activity. See Automation Script Troubleshooting and Error-Handling.
  • Select the Log tab to review a script's execution log.
  • In the Suffix field, the drop-down list includes two predefined suffixes (Date and DateTime). The list also includes any suffixes you have created and saved since installing Toad. To delete a suffix from the list, select the suffix, click , delete the suffix in the Expression field, and click OK.
  • Automation does not support positional parameters denoted by a question mark.

Tips:

  • For activities in which you can add a suffix to the output file, click to build a suffix using the expression editor.
  • You can use the expression editor to select a variable created in a previous activity or select one of your stored bind variables.
  • To learn how to store a bind variable value, see Using Bind Variables.

 

Related Topics

Automate Tasks

Use Database Automation Activities

Using Variables in Automation

Documents connexes

The document was helpful.

Sélectionner une évaluation

I easily found the information I needed.

Sélectionner une évaluation