如何直接从 toad oracle 运行 sql 文件中的代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36723747/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:13:14  来源:igfitidea点击:

How to run code from sql file directly from toad oracle

sqloracletoad

提问by Photops

i have a *.sql file on my desktop. How can i create a job in toad for oracle so that it can directly pick up the file and run it everyday at a specific time. thank you

我的桌面上有一个 *.sql 文件。如何在 toad 中为 oracle 创建作业,以便它可以直接获取文件并每天在特定时间运行它。谢谢你

回答by Michael S.

What version of Toad? If it's a somewhat newer one, check out the Automation Designer. It's available from the Utilities menu.

什么版本的蟾蜍?如果它是一个较新的,请查看自动化设计器。它可以从“实用工具”菜单中找到。

  1. Create a new app on the left side, give it a meaningful name
  2. On the DB Misc tab double click the Execute Script action to add it to your app.
  3. Double click the new execute script action and add your file to it. Set other options within as desired.
  4. Click Apply and exit the script action properties dialog.
  5. Right click on your script action and choose Schedule. Work through the Windows Task Scheduler prompts and it will be setup for you.
  1. 在左侧创建一个新的应用程序,给它一个有意义的名字
  2. 在 DB Misc 选项卡上双击 Execute Script 操作以将其添加到您的应用程序。
  3. 双击新的执行脚本操作并将您的文件添加到其中。根据需要设置其他选项。
  4. 单击应用并退出脚本操作属性对话框。
  5. 右键单击您的脚本操作并选择计划。完成 Windows 任务计划程序提示,它将为您设置。

回答by Ashish Shetkar

well different version of the TOAD have different options the best way i would suggest you is - on the button "Execute as script"

不同版本的 TOAD 有不同的选项,我建议您的最佳方式是 - 在“作为脚本执行”按钮上

Execute as script --> Execute via SQL plus 

then the SQL-plus window will pop up and it will auto connect to your DB. Gather all your sql queries / script in the file and run below command

然后会弹出 SQL-plus 窗口,它会自动连接到您的数据库。收集文件中的所有 sql 查询/脚本并运行以下命令

@C:\Users\Desktop\script.sql

this will start executing the script from file directly and will give the log in the SQL plus window.

这将直接从文件开始执行脚本,并将在 SQL plus 窗口中提供日志。