# Execute Script in multiple databases \[automation designer\]

**URL:** <https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [September 10, 2025, 8:39am UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324 "2025-09-10T08:39:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![WaHe](https://avatars.discourse-cdn.com/v4/letter/w/a88e4f/32.png) [@WaHe](https://forums.toadworld.com/u/WaHe)\
**Post date:** [September 10, 2025, 8:39am UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/1 "2025-09-10T08:39:01Z")

</div>

Hi,

how can I run a script under different databases with Automation Designer? I tried it with Connection Iterator, but the scipt runs always on the default/actual connection.

 ![image](https://global.discourse-cdn.com/quest/original/3X/3/b/3b4b4e016e7db6486649ee12dd22bae89401fea6.png)

Best regards

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 10, 2025, 12:05pm UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/2 "2025-09-10T12:05:12Z")

</div>

Right-click and run the connection iterator iterator action, not the script action.

Or, you can right-click on the app and run that, as shown below. That will run everything listed on the right.

 ![image](https://global.discourse-cdn.com/quest/original/3X/3/f/3f7144ca26507b557b19a599df8df69a01a5bcc4.png)

---

<div class="post-metadata">

**Author:** ![WaHe](https://avatars.discourse-cdn.com/v4/letter/w/a88e4f/32.png) [@WaHe](https://forums.toadworld.com/u/WaHe)\
**Post date:** [September 10, 2025, 12:21pm UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/3 "2025-09-10T12:21:39Z")

</div>

> [@JohnDorlon](#):
>
> d on the right.

Hi John, thanks for the quick reply. I always run the app, but the script is still only executed on one database.  
We're using Taod 16.3. Is there maybe any configuration I did wrong?

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 10, 2025, 12:28pm UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/4 "2025-09-10T12:28:15Z")

</div>

Are you sure that the script is only running on one database?

Maybe you have an output file set up, but it is being overwritten by each run of the script action.

There are a few ways to prevent that. Here is one:

 ![image](https://global.discourse-cdn.com/quest/original/3X/7/7/7727613e92ce0e6e3f3f59828beff8b7f0467c2c.png)

For what it's worth, I just tested it on 16.3 and it worked as expected. If you post screen shots of your script action details, I'll try again.

---

<div class="post-metadata">

**Author:** ![WaHe](https://avatars.discourse-cdn.com/v4/letter/w/a88e4f/32.png) [@WaHe](https://forums.toadworld.com/u/WaHe)\
**Post date:** [September 11, 2025, 7:17am UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/5 "2025-09-11T07:17:11Z")

</div>

The output is stored in a separate folder for each database. Unfortunately, the output file is the same in both folders.

 ![image](https://global.discourse-cdn.com/quest/original/3X/b/e/bea622e928b40e2b6acade542df364ad83733d60.png)

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 11, 2025, 12:30pm UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/6 "2025-09-11T12:30:58Z")

</div>

Oh, you have nested iterators. That was a bug 2025 R1 and prior (connection iterators only passing connection to child actions, not grandchild or lower). It was fixed in version 2025 R2.

If you change your app so that the Execute Script is directly under the connection iterator (so it is a child action and not a grandchild), the script will run in the correct connection.

---

<div class="post-metadata">

**Author:** ![WaHe](https://avatars.discourse-cdn.com/v4/letter/w/a88e4f/32.png) [@WaHe](https://forums.toadworld.com/u/WaHe)\
**Post date:** [September 11, 2025, 1:02pm UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/7 "2025-09-11T13:02:34Z")

</div>

Ah, ok. We need to slowly update our version. 😅

Is there a way to get the connection data from the connection iterator, such as CI.DB\_Name or similar?

Thanks

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [September 11, 2025, 1:49pm UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/8 "2025-09-11T13:49:16Z")

</div>

> Is there a way to get the connection data from the connection iterator, such as CI.DB\_Name or similar?

Not really, no. And I wouldn't trust anything happening, connection wise, at any action not directly under the connection iterator.

But you could do this instead. ACTIVESESSIONDB is TNSName for the current connection. Which may be different from what you are getting from your query iterator, but hopefully it can work for you.

There is also ACTIVESESSIONUSER which is the logon user name.

 ![image](https://global.discourse-cdn.com/quest/original/3X/5/8/58d6dbf6b8e47ee51a3cd755de84a8a9c8aef521.png)

---

<div class="post-metadata">

**Author:** ![WaHe](https://avatars.discourse-cdn.com/v4/letter/w/a88e4f/32.png) [@WaHe](https://forums.toadworld.com/u/WaHe)\
**Post date:** [September 12, 2025, 6:05am UTC](https://forums.toadworld.com/t/execute-script-in-multiple-databases-automation-designer/61324/9 "2025-09-12T06:05:23Z")

</div>

That might bring me closer to the solution. Thanks.
