# How to run one command from editor on several instances

**URL:** <https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [March 24, 2023, 12:24am UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195 "2023-03-24T00:24:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpniel](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@mpniel](https://forums.toadworld.com/u/mpniel)\
**Post date:** [March 24, 2023, 12:24am UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/1 "2023-03-24T00:24:28Z")

</div>

In Toad 16, is it possible to run one command from editor on several instances, like in Microsoft SSMS ?

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [March 24, 2023, 5:03pm UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/2 "2023-03-24T17:03:34Z")

</div>

No. Execution is only performed on the active connection tied to that Editor. If this is something you need to do periodically with a relatively static set of SQL you should checkout the Script Manager and Automation Designer, both available from the Utilities menu. Both allow for execution of scripts across multiple databases.

---

<div class="post-metadata">

**Author:** ![Gary.Jerep](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gary.jerep/32/205_2.png) [@Gary.Jerep](https://forums.toadworld.com/u/Gary.Jerep)\
**Post date:** [March 24, 2023, 5:07pm UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/3 "2023-03-24T17:07:05Z")

</div>

Was just going to reply to the same effect... Best thing we can do for your use case of running multiple scripts/queries/commands on multiple connections...see screen snap below...

 ![image](https://global.discourse-cdn.com/quest/original/2X/d/d04d0d5c3b36b7df11df38169678b08a94764cfd.png)

---

<div class="post-metadata">

**Author:** ![Gary.Jerep](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gary.jerep/32/205_2.png) [@Gary.Jerep](https://forums.toadworld.com/u/Gary.Jerep)\
**Post date:** [March 24, 2023, 5:08pm UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/4 "2023-03-24T17:08:31Z")

</div>

And of course, as Michael just said, the Automation Designer is another place where you can loop through a list of connectors to execute script/command logic. Thanks for the reminder, Michael!

---

<div class="post-metadata">

**Author:** ![mpniel](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@mpniel](https://forums.toadworld.com/u/mpniel)\
**Post date:** [March 27, 2023, 3:03pm UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/5 "2023-03-27T15:03:10Z")

</div>

Did anyone try to test the Automation Designer to loop through a list of connectors to execute script/command logic?

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [March 27, 2023, 3:11pm UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/6 "2023-03-27T15:11:46Z")

</div>

Yes. You can create an app with a Connection Iterator (see the Control) tab and then you can place an Execute Script action (see the DB Misc tab) beneath it. Configure the Connection Iterator so that your connections are defined that you want to run your command against. Then setup the script action and run the app.

---

<div class="post-metadata">

**Author:** ![mpniel](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@mpniel](https://forums.toadworld.com/u/mpniel)\
**Post date:** [March 30, 2023, 5:03pm UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/7 "2023-03-30T17:03:03Z")

</div>

How can I read the output log script execution for each connection?

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [March 30, 2023, 5:12pm UTC](https://forums.toadworld.com/t/how-to-run-one-command-from-editor-on-several-instances/57195/8 "2023-03-30T17:12:47Z")

</div>

You can save the output to files. Here's an execute script action configured beneath a connection iterator that loops over 2 connections. It saves the results to a file containing the username and database. Rt-click on this edit and select "Variables" to see some additional variables available.

 ![image](https://global.discourse-cdn.com/quest/original/2X/a/a8903c0508228c3fb844d152f9985c41d5da5b62.png)
