# Scripted restart of tag provider?

**URL:** <https://forum.inductiveautomation.com/t/scripted-restart-of-tag-provider/73450>\
**Category:** Ignition\
**Created:** [May 9, 2023, 5:52am UTC](https://forum.inductiveautomation.com/t/scripted-restart-of-tag-provider/73450 "2023-05-09T05:52:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 9, 2023, 5:52am UTC](https://forum.inductiveautomation.com/t/scripted-restart-of-tag-provider/73450/1 "2023-05-09T05:52:34Z")

</div>

We have an issue where we're using pre-processsed partitions to store summarised tag history data, however we currently have issues we're looking into where the SQL database disconnects randomly and this disrupts the PPP table generation which requires a tag provider restart to fix.

Long story short, can someone provide a script that can restart a tag provider via script?

Edit:  
Ooo

```auto
system.util.getContext().tagManager.getTagProvider('default').shutdown()

```

seemd to work. It won't start back up again though with `startup()`, haha  
`.running` says it's `False` after `shutdown()` and `True` after `startup()`, but the tags don't show in the tag browser in the Designer 😕 The tag provider itself is also MIA too, but comes back if I re-save the tag provider from the GW webpage. Obviously I'm missing something...

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 9, 2023, 5:22pm UTC](https://forum.inductiveautomation.com/t/scripted-restart-of-tag-provider/73450/2 "2023-05-09T17:22:01Z")

</div>

I don't think you can perform the operation you're looking for safely, really. There's a private `instantiateProvider` method on the tag manager implementation class, and it requires you to pass in a settings record from the ORM. It calls a few methods on the provider, in addition to the startup method; that's probably what you're missing and why things aren't showing up quite correctly.

The, barely, safer way to do this would be to go to the PersistenceInterface from the context, retrieve the persistent record that identifies the provider you want (with an SQuery by name), and then call `PersistenceInterface.notifyRecordUpdated(thatRecord)`, which would kick off the listener in the tag manager and cause it to run the same re-initialization step that an edit -\> save does.

I would not go down this road, myself, and would instead lean on the support ticket I'm sure you already filed to get the PPP bug fixed. Right? 😉

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 9, 2023, 8:22pm UTC](https://forum.inductiveautomation.com/t/scripted-restart-of-tag-provider/73450/3 "2023-05-09T20:22:43Z")

</div>

> [@paul-griffith](#):
>
> would not go down this road, myself, and would instead lean on the support ticket I'm sure you already filed to get the PPP bug fixed. Right?

Haha, not me personally, but a colleague filed it. Not sure if he asked for it to be fixed though, I'll check. Definitely, that's the solution though, but this was the interim "fix" while trying to find the issue with the sql database, which seems elusive. I'm not too involved, just thought I'd see if tag provider restart was possible 😅

---

<div class="post-metadata">

**Author:** ![AaronJust](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aaronjust/32/47009_2.png) [@AaronJust](https://forum.inductiveautomation.com/u/AaronJust)\
**Post date:** [May 10, 2023, 12:03am UTC](https://forum.inductiveautomation.com/t/scripted-restart-of-tag-provider/73450/4 "2023-05-10T00:03:02Z")

</div>

This one's my "bug"

> [@Delays in Pre-Processed Partition Data Appearing in SQL](https://forum.inductiveautomation.com/t/delays-in-pre-processed-partition-data-appearing-in-sql/72506):
>
> Having an issue on a client's site where they have started using pre-processed partitions. The data is being imported into the SQL server quite quickly, but we have noticed delays in processing of the data for the pre-processed partitions. Worst case we had trends on SCADA that had no data outside of Sunday 3AM, and it wasn't until around Monday 1PM (46 hours later) that all of a sudden that data appeared in the pre-processed partition and therefore the SCADA trend. What is the mechanism that…

I'm certainly pushing for a "proper" mechanism to recover the PPP.
