This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Restarting SQL after install & run more SQL scripts
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 06, 2010
02:38 PM
Restarting SQL after install & run more SQL scripts
My installscript MSI requirements:
(1) Install SQL Express 2005
(2) Run some scripts
(3) Restart SQL
(4) Run some more scripts
(5) Install my application
I suspect that I will need to use some built-in or custom actions to do this but I’m not sure how.
(1) I need a custom action that will Restart SQL
(2) I need to know how/where to place the Restart action
(3) How to have a second group of SQL scripts connect and execute after the restart
Thanks for the help
(1) Install SQL Express 2005
(2) Run some scripts
(3) Restart SQL
(4) Run some more scripts
(5) Install my application
I suspect that I will need to use some built-in or custom actions to do this but I’m not sure how.
(1) I need a custom action that will Restart SQL
(2) I need to know how/where to place the Restart action
(3) How to have a second group of SQL scripts connect and execute after the restart
Thanks for the help
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 12, 2010
10:28 AM
The background post on why I need to restart SQL is here.
The solution:
My install proceeds as a normal SQL install with scripts but finishes with an extra script at end of the install.
I created four custom actions, SQLstop, SQLstart, SQLscript, SQLscript64 and are sequenced in the Installation Execute folder just after ISSQLServerInstall.
SQLstop & SQLstart use the command line “net stop MSSQL$MYDBINSTANCE”, Deferred Execution
SQLscript & SQLscript64 (only difference is the program files (x86) path)
Command Line:
"c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\sqlcmd.exe" -S .\MYDBINSTANCE -d MyDB -E -i "C:\Program Files (x86)\MyCompany\MyApp\SqlCLRScript.sql"
In-Script Execution: Commit Execution in System Context
SQLscript & SQLscript64 use sqlcmd.exe to run a script from a file to complete my CLR install after the restart of SQL Server.
And finally, I used VersionNT64 as a condition for running the custom actions.
If you found this post helpful support the “Code{the final solution}” group. Click the "Like" button and help spread the word…
The solution:
My install proceeds as a normal SQL install with scripts but finishes with an extra script at end of the install.
I created four custom actions, SQLstop, SQLstart, SQLscript, SQLscript64 and are sequenced in the Installation Execute folder just after ISSQLServerInstall.
SQLstop & SQLstart use the command line “net stop MSSQL$MYDBINSTANCE”, Deferred Execution
SQLscript & SQLscript64 (only difference is the program files (x86) path)
Command Line:
"c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\sqlcmd.exe" -S .\MYDBINSTANCE -d MyDB -E -i "C:\Program Files (x86)\MyCompany\MyApp\SqlCLRScript.sql"
In-Script Execution: Commit Execution in System Context
SQLscript & SQLscript64 use sqlcmd.exe to run a script from a file to complete my CLR install after the restart of SQL Server.
And finally, I used VersionNT64 as a condition for running the custom actions.
If you found this post helpful support the “Code{the final solution}” group. Click the "Like" button and help spread the word…
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 12, 2010
11:13 AM
I know you can create a template.ini to feed into SQL Server Express setup to automate it when silent. I wonder if it exposes any settings that would enable CLR by default that way when you get to your install you can just run your scripts.
Also if the user doing access will have access to the database I think you could do this without any custom actions. You could create a script to execute during logon ( the dialog where you test your connection ) and then create a component that has ServiceControl actions to stop and start SQL for you. Then IS would execute your sql scripts later on.
Also if the user doing access will have access to the database I think you could do this without any custom actions. You could create a script to execute during logon ( the dialog where you test your connection ) and then create a component that has ServiceControl actions to stop and start SQL for you. Then IS would execute your sql scripts later on.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 12, 2010
11:25 AM
Thanks Christopher,
This was actually a continuation of an earlier post. See here. The whole problem started because WOW64 Servers “Require” a SQL restart to enable CLR. I’m not sure about your second suggestion but maybe.
Thanks again…
This was actually a continuation of an earlier post. See here. The whole problem started because WOW64 Servers “Require” a SQL restart to enable CLR. I’m not sure about your second suggestion but maybe.
Thanks again…
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 12, 2010
11:29 AM
Btw, have you ever played with the SAC utility (Surface Area Configuration)? You will find it in your 90\shared directory. You run a little GUI to configure SQL server and export it to an XML file. You can then write a custom action that calls 90\shared\sac.exe along with your XML file and a few switches and it'll reconfigure the instance for you. I don't believe you have to restart the instance when you go this route.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 12, 2010
11:37 AM
You may be right but this Microsoft post is what I went by. I also didn't see any workarounds on the web. Cheers!
http://msdn.microsoft.com/en-us/library/ms175193.aspx
http://msdn.microsoft.com/en-us/library/ms175193.aspx