How to use Save As from command line prompt to export files automatically? Useful for setting up batch files or scheduled runs of Toad to execute a script and save the results to a file.
For version 9.0.1 and below:
1. Launch Toad for Oracle, type your query in the SQL Editor window.
2. Execute your query so that the results display in the Data Grid.
3. Right mouse click the Data Grid and select Save As.
4. Configure the options to your liking then click the "Save As" icon (floppy disk).
5. Name and save the script file.
6. Open the script file and read through the directions how to execute it. The following steps will show you a basic execution.
a. Shut down Toad.
b. Create a batch file or run the command line:
c:\toad\toad.exe Connect=system/manager@mydb EXP=c:\thisfile.txt
Where c:\Toad\Toad.exe is the path to your Toad executable, system/manager is your login and password, mydb is your database instance, and c:\thisfile.txt is your script file. Or use the following to use multipe export jobs:
c:\toad\Toad.exe connect=system/manager@myoradb CMDFILE=c:\command_file.txt
Where command_file.txt is a file that contains lines similar to the direct option, such as: EXP=c:\exp_file.txt
c. The output file will be named and saved according to how it was set up in the Save As screen.
For version 9.1 and above:
1. Launch Toad for Oracle, type your query in the SQL Editor window.
2. Execute your query so that the results display in the Data Grid.
3. Right mouse click the Data Grid and select Save As/Export Dataset.
4. Enter the desired export options, including the export format, the output export path, and file name.
5. In the lower lefthand corner, click "schedule action" icon.
6. Fill out the "App" field for the action set name, the "Name" field for the action name, and hit OK.
7. The "Schedule Toad Action" window will open. Click "back" to verify the action parameter. Click "cancel" once this is noted and to close this window.
Sample: -a "set1->export1"
8. Leave or close Toad.
9. In Command Prompt, to run the export, enter:
"C:\Program Files\Quest Software\Toad for Oracle\Toad.exe" -c <username>/<password>/<db name> -a "Set1"
Please ensure the above path is the location of Toad.exe and database information is entered properly.
Please note that multiple export jobs (actions) can be added to "Set1" Action Set. Executing the above statement will run all export jobs within this one action set. Multiple Action Sets can be created. To run only one particular export in an action set containing multiple exports modify the statement to specify the action name:
-a "Set1->export1".
-- Where "export1" is the name of the specific action.
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy