在 Oracle SQL Developer 上同时运行 2 个查询?
我需要从 Oracle DB 检索大量数据,为此我需要运行 20 多个查询。有没有办法在同一连接上一次运行多个查询?
我尝试使用 / 来分隔查询,但这只是打开多个选项卡,并且查询仍然按顺序运行,尽管我不必一一启动它们。
I need to retrieve quite a bit of data from our oracle DB and to do so I need to run 20+ queries. Is there any way to run more than one query at a time on the same connection?
I tried using / to separate the queries, but that simply opens multiple tabs and queries still run sequentially, although I don't have to start them one by one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
按 ctrl+shift+N 将打开一个新的非共享工作表,该工作表可以并行运行查询。在这种情况下,您必须在每个选项卡中粘贴查询并手动运行它们,但在仅测试几个查询时它很方便。
Pressing ctrl+shift+N will open a new unshared worksheet that can run queries in parallel. In that case you have to paste a query in each tab and run them manually though, but it is handy when just testing a few queries.
在 SqlDeveloper 首选项中:
Tools >首选项>数据库>工作表
选中新建工作表以使用非共享连接
选项。这将允许您同时执行多个查询,每个查询都在每个选项卡中。另请参阅屏幕截图。In SqlDeveloper preferences:
Tools > Preferences > Database > Worksheet
check the option forNew Worksheet to use unshared connction
. This will allow you to execute multiple queries at the same time, each in each tab. See a screenshot too.不,每个查询都需要一个单独的会话。
No, you will need a separate session per query.
假设您喜欢危险的生活,您可以使用编译指示 AUTONOMOUS_TRANSACTION 从一个脚本运行多个“线程”。例如:
Assuming you like to live dangerously, you can run multiple "threads" from one script using the pragma AUTONOMOUS_TRANSACTION. For example:
@Tony是正确的,每个查询必须在自己的会话中运行才能并行运行。您使用什么工具?在 PL/SQL Developer 中,我可以打开一个数据库连接,然后在该连接中打开多个会话并“并行”运行多个查询 - 我确实必须手动执行每个查询,但如果它们每个都需要很长时间,也许这会为您提供所需的东西,或在您使用的任何工具中提供类似的东西。
@Tony is correct, each query must run in its own session to run in parallel. What tool are you using? In PL/SQL Developer, I can open a DB connection, then open multiple sessions within that connection and run several queries in "parallel" - I do have to execute each one manually, but if they each take a long time, perhaps that will get you what you need, or something similar in whatever tool it is you're using.
因此,最简单的解决方案是使用其余 Oracle 软件附带的 SQL Plus。这是一个笨重的工具,但可以满足我的需要,同时我可以自由地使用 SQL Developer 进行其他查询。
So the simplest solution to this was to use SQL Plus that came with the rest of Oracle software. It's a clunky tool, but does what I needed, while I'm free to use SQL Developer for other queries.