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: Backup and Restore Database and files
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
‎Oct 16, 2009
04:40 AM
Backup and Restore Database and files
Hi,
How can I backup and Restore MySQL Database and files while doing a major upgrade?
Regards
Yaseen D M
How can I backup and Restore MySQL Database and files while doing a major upgrade?
Regards
Yaseen D M
(8) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 16, 2009
05:56 AM
This is really more of an administrators job and I would be tempted to leave this out of the installation. Mainly because the backup might not have space and it might need to be burnt to external drive a dvd or whatever.
Create a good guide and a dialoge warning the administrator to make this backup before proceeding
But if you need to do it you'll need to create your own sql script or vbscript conditioned to run on upgrade
Create a good guide and a dialoge warning the administrator to make this backup before proceeding
But if you need to do it you'll need to create your own sql script or vbscript conditioned to run on upgrade
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 16, 2009
09:31 AM
The problem with me is i created a major upgrade.
I have to retain the database and the data in it since based on some rule the tables are getting created and data is stored in those tables. and also i have to update the database with some default data required for Major upgrade after restoring the database. Major upgrade uninstalls the previous version product and installs the new version. while uninstalling the installer drops the database as per the rule set in the SQL Script option since we want to drop the database if the user tries to uninstall the product manually.
Is there any alternative for this?
Regards
I have to retain the database and the data in it since based on some rule the tables are getting created and data is stored in those tables. and also i have to update the database with some default data required for Major upgrade after restoring the database. Major upgrade uninstalls the previous version product and installs the new version. while uninstalling the installer drops the database as per the rule set in the SQL Script option since we want to drop the database if the user tries to uninstall the product manually.
Is there any alternative for this?
Regards
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 16, 2009
11:40 AM
Ok i think maybe you should look into how to prevent the db from dropping on upgrade. Before we can answer that we need to know what type of project you are using
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 17, 2009
03:18 AM
I am using Basic MSI Project
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 19, 2009
06:21 AM
Ok I think I understand what's going on, I was in a similar position to you with one of my packages too.
The problem is that you most likely have created a drop database script for uninstall purposes and so you ticked the option 'run script during uninstall' The problem is, that also runs during a major upgrade. What you needed to do was in the same screen as 'run script during uninstall' there is an option to specify a conditional statement. And there you should have put Not UPGRADINGPRODUCTCODE UPGRADINGPRODUCTCODE is just a property that's created to show the product code of the product that is upgrading it but we just want to check it's existance to determine if it's just plain being uninstalled or whether it's being uninstalled as part of an upgrade.
Now the problem you have now, is that you need to add that to the product that is already installed. Not you current release. With database installation, patching is not always an option because you don't want your scripts running again. What you need to do is to modify a copy of your previous installation and then in your current installation, as a custom action you need to replace the cache copy so that it can uninstall correctly. Here is the script i created to do that (note that i store the cached version in the support files):
Option Explicit
On Error Resume Next
Const strProductCode = "{0366564F-64AE-44E8-8F4B-098D2C22231C}"
Dim objInstaller: Set objInstaller = CreateObject("WindowsInstaller.Installer")
Dim strMSICacheFile: strMSICacheFile = objInstaller.productInfo(strProductCode, "LocalPackage")
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile Session.Property("SUPPORTDIR") & "\MyPatchedPackage.MSI", strMSICacheFile, True
You need to make sure that this runs before the RemoveExistingProducts action
Good luck 🙂
The problem is that you most likely have created a drop database script for uninstall purposes and so you ticked the option 'run script during uninstall' The problem is, that also runs during a major upgrade. What you needed to do was in the same screen as 'run script during uninstall' there is an option to specify a conditional statement. And there you should have put Not UPGRADINGPRODUCTCODE UPGRADINGPRODUCTCODE is just a property that's created to show the product code of the product that is upgrading it but we just want to check it's existance to determine if it's just plain being uninstalled or whether it's being uninstalled as part of an upgrade.
Now the problem you have now, is that you need to add that to the product that is already installed. Not you current release. With database installation, patching is not always an option because you don't want your scripts running again. What you need to do is to modify a copy of your previous installation and then in your current installation, as a custom action you need to replace the cache copy so that it can uninstall correctly. Here is the script i created to do that (note that i store the cached version in the support files):
Option Explicit
On Error Resume Next
Const strProductCode = "{0366564F-64AE-44E8-8F4B-098D2C22231C}"
Dim objInstaller: Set objInstaller = CreateObject("WindowsInstaller.Installer")
Dim strMSICacheFile: strMSICacheFile = objInstaller.productInfo(strProductCode, "LocalPackage")
Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile Session.Property("SUPPORTDIR") & "\MyPatchedPackage.MSI", strMSICacheFile, True
You need to make sure that this runs before the RemoveExistingProducts action
Good luck 🙂
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 19, 2009
10:26 PM
I didn't understand this script. Does this stops the uninstallation of Database? or i have to handle the uninstallation of database here?
Can you please explain exactly what this script does?
If this is the complete script to handle the databas uninstallation then i tried but still the database gets deleted.
Can you please explain exactly what this script does?
If this is the complete script to handle the databas uninstallation then i tried but still the database gets deleted.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 20, 2009
02:47 AM
I got it working with the help of following forum
http://www.symantec.com/connect/forums/retaining-data-and-upgradingproductcode-major-upgrade
Thanx for your gr8 help it really helped me a lot in finding the problem and the solution, I have more idea about Uninstall process handling from Installshield now.
Thanx and Regards
Yaseen D M
http://www.symantec.com/connect/forums/retaining-data-and-upgradingproductcode-major-upgrade
Thanx for your gr8 help it really helped me a lot in finding the problem and the solution, I have more idea about Uninstall process handling from Installshield now.
Thanx and Regards
Yaseen D M
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 20, 2009
04:11 AM
Ok sorry if i was misleading, i'll take it from the start. In your previous version's MSI you must have a SQL script that you use to drop (delete) the database on uninstall. You should be able to see this in the SQL scripts view if you still have the original project otherwise you'll have to look at the raw tables in the MSI that deal with sql scripts.
When you installed your previous version, windows installer caches that msi on the PC for use in repairs and uninstalls etc... Now your new upgrade comes along, finds the old version installed on the pc and performs and upgrade. To do this.. it runs the uninstall from the cached copy before it installs from your version.
So hopefully now you can see what happened during the upgrade.. Your uninstall of the old version probably kicked off a delete (drop) database script, then your new one comes and installs a fresh copy, or even worse, runs an upgrade script on a missing database.
The problem you have is that this bug doesn't exist in your current version, it exists in the previous version that's already cached and installed on the pc. You could create a patch for this product before you upgrade but this tends not to work too well for db installers in my experience because they need to be rerun. So what you need to do is get a copy of the previous installation, find the script that is dropping the database and set a condition on it so that it only uninstalls if you are doing a complete uninstall and not just upgrading it. The condition to do this is: Not UPGRADINGPRODUCTCODE.
Now you need to replace the cache copy with the new modified copy so that when your product calls the uninstall of the old one it actually calls the modified one with the bug fix instead.
To do this you need to put the previous modified MSI into your current installer so that it can drop it down to the machine's cache before it tries to uninstall using it. Simply place the modified msi into your current msi's support files. Then the script i sent you will place your previous bug fixed msi into the machine's cache. The script needs to run as a custom action before the RemoveExistingProducts action (the action that will perform the uninstall)
Please note the script needs to be modified so that it contains the correct product code of your previous version and the name of your previous bug fixed msi.
Please also note that the condition will need to be set in this version of your msi too so that this doesn't happen again in the next upgrade.
When you installed your previous version, windows installer caches that msi on the PC for use in repairs and uninstalls etc... Now your new upgrade comes along, finds the old version installed on the pc and performs and upgrade. To do this.. it runs the uninstall from the cached copy before it installs from your version.
So hopefully now you can see what happened during the upgrade.. Your uninstall of the old version probably kicked off a delete (drop) database script, then your new one comes and installs a fresh copy, or even worse, runs an upgrade script on a missing database.
The problem you have is that this bug doesn't exist in your current version, it exists in the previous version that's already cached and installed on the pc. You could create a patch for this product before you upgrade but this tends not to work too well for db installers in my experience because they need to be rerun. So what you need to do is get a copy of the previous installation, find the script that is dropping the database and set a condition on it so that it only uninstalls if you are doing a complete uninstall and not just upgrading it. The condition to do this is: Not UPGRADINGPRODUCTCODE.
Now you need to replace the cache copy with the new modified copy so that when your product calls the uninstall of the old one it actually calls the modified one with the bug fix instead.
To do this you need to put the previous modified MSI into your current installer so that it can drop it down to the machine's cache before it tries to uninstall using it. Simply place the modified msi into your current msi's support files. Then the script i sent you will place your previous bug fixed msi into the machine's cache. The script needs to run as a custom action before the RemoveExistingProducts action (the action that will perform the uninstall)
Please note the script needs to be modified so that it contains the correct product code of your previous version and the name of your previous bug fixed msi.
Please also note that the condition will need to be set in this version of your msi too so that this doesn't happen again in the next upgrade.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)