Page 1 of 2 12 LastLast
Results 1 to 5 of 6

Thread: Restarting SQL after install & run more SQL scripts

  1. #1
    Join Date
    Jul 2008
    Posts
    44

    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

  2. #2
    Join Date
    Jul 2008
    Posts
    44
    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…
    Last edited by {shielder}; 07-12-2010 at 10:32 AM. Reason: clarity

  3. #3
    Join Date
    Jul 2003
    Location
    Austin, TX
    Posts
    4,410
    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.
    Christopher Painter
    ISWIX, LLC.
    Visit iswix.com for contact information

  4. #4
    Join Date
    Jul 2008
    Posts
    44
    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…

  5. #5
    Join Date
    Jul 2003
    Location
    Austin, TX
    Posts
    4,410
    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.
    Christopher Painter
    ISWIX, LLC.
    Visit iswix.com for contact information

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •