abiram
Posts: 7
Joined: Wed Mar 12, 2008 5:51 am

Restore a database in Repair Mode

Hi,

we are restoring a database and running the sql scripts while installing . How do i restore database and run the sql scripts in repairing mode.

i tried for repair mode restoring database using custom action

installfiles > New custom action > exe with working directory

in path " The query for restoring database "

in Execution condiiotn : " InstallMode = Repair AND OSQL "


thanks
Abiram
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

In order to do this you can schedule your custom action under the "InstallExecuteSequence" -> "RegisterFonts" standard action in the "Custom Actions" page. The custom action must be set with the "Synchronous execution, check return code" option and it can use this condition:

Code: Select all

REMOVE<>"ALL"
If you want to run the custom action only during the Repair, you can use this condition:

Code: Select all

REMOVE<>"ALL" AND Installed
You can also condition the SQL Scripts to run during the repair by following these steps:
- go to the "SQL Scripts" page and select your SQL script
- make sure that the "at install" checkbox is checked for the "Run SQL Script" option
- save and close the project
- open the AIP file in a text editor and find this entry:

Code: Select all

<COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent">
- for the AI_SqlInstall action set the "Condition" attribute to:

Code: Select all

(VersionNT >= 500) AND (REMOVE<>"ALL")
- save the change and reopen the AIP
- do the same for the other scripts

You need to manually edit the AIP because Advanced Installer doesn't have a predefined option to run the script during a repair. However, I have added this feature on our TODO list and it will be available in a future version.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”