Running several "Query SQL Database for Data" - Advanced Installer Community
visualsi
Posts: 40
Joined: Fri Oct 14, 2011 4:16 pm

Running several "Query SQL Database for Data"

Hi,

What we would like to accomplish is to test to see which scripts have been run against a user's database. During support issues, they may be given a temporary update SQL script that will later be folded into the next release. We have a table in their DB that keeps track of which updates have been applied and we want to find out at the beginning of the install what their DB looks like.

We have tried to schedule several (18 as of now) "Query SQL Database fo Data" custom actions that query for the value and assign the value to an internal installer property and then test these properties when determining if we should install the script.

The problem is that on many of the faster machines, about 4-8 of them execute (in somewhat random order), then the machine freezes. I have tried placing them in several different places in the installation sequence and the only thing that changes is how many of them get executed before the machine freezes and the ones that are skipped in the sequence. I've used a SQL profiler and all that gets executed are the few random checks. I've played with lock avoidance hints and that doesn't change anything.

My objective is to "run any script that has not been run on THIS database where "THIS" is determined by examining the database during the installation process and comparing it to a "available updates" for that database.

Any ideas:
  • why the queries are not running in order and then freezing?
  • if there is a way to accomplish the objective - what is built-in assumes that everyone must take the same "update order"
  • I know that the if-then-else versioning could be put into the scripts themselves but we have 10's of thousands of lines of SQL scripts in multiple products that are constantly changing - it would be impossible to manage such an effort
Any constructive help would be appreciated.

We use the AE 10.2 Enterprise Edition on Windows Server 2003-Windows Server 2012 and SQL Server 2005-2012.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Running several "Query SQL Database for Data"

Hello,

I'm not sure why this happens. Please keep in mind that an SQL Query will be executed during installation process when its associated "Query SQL database for data" custom action it is triggered in the install execution stage or when the custom action is launched by a published event. So, you can set the execution order for your SQL Queries by scheduling their associated custom actions accordingly during "Wizard Dialogs Stage" and "Install Execution Stage" from "Custom Actions" page or by calling their custom actions as a published event added on installation dialogs from "Dialogs" page.

Also, depending on your scripts complexity their execution may require a longer time. Can you please try to manually run the related scripts on target machine and see if they run successfully?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
visualsi
Posts: 40
Joined: Fri Oct 14, 2011 4:16 pm

Re: Running several "Query SQL Database for Data"

Hi,

Yes, we tried them manually before putting them in the custom action. They are a very simple "select one field from a table" and we put the value into an installer property. I've also made installer versions that put these actions in every different part of the sequence possible to see if there was any difference in the result and watched it working with the SQL profiler as it ran. The result was similar for all versions (after the database information was available, of course) - a random few of the actions were executed, then the server (well, everything running on the console) would freeze. If we ran the same script on an older, slower machine, it would work correctly.

Because the users wouldn't wait for a resolution, we had to assume that this feature in the installer software just doesn't work and implemented it another way, by making each of the 18 (and counting) SQL scripts implement what the installer couldn't do. Not ideal, but it got the job done.

In the future, we will just assume that custom actions are unreliable and find ways to avoid them - it's just a matter of being practical.

Return to “Common Problems”