We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Phobos
Posts: 85
Joined: Fri Sep 08, 2006 11:52 am
Location: Germany

Restore SQL Database

Hi,

In the past I used some custom actions to restore a SQL database. Now, as AI directly supports SQL Script execution I want to use this instead. This is working, the connection to the SQL Server is established and my restore script is executed.
However, when I check the database on the SQL Server it cannot be used, as it is still in a restoring state. If I run my script manually it works fine, so I wonder if this behavior might be caused by AI somehow, or if I am missing something.
In the end, if I do the restore using custom actions it will work.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

After investigating your problem, we have found the following as probable cause of your trouble.

If you encountered Error 3154 during a restore operation, overwrite the existing database by reissuing the RESTORE DATABASE command using the
WITH REPLACE clause, or restore the backup set to a different database name.

The error 3154 indicates that you tried to restore database over an existing database, but the existing database was created by a different CREATE DATABASE statement than the database in the backup set.

For a database using the full or bulk-logged recovery model, SQL Server requires in most cases that you back up the tail of the log before restoring the database.

Restoring a database without first backing up the tail of the log results in an error, unless the RESTORE statement contains either the WITH REPLACE or WITH STOPAT clause.

You should try fixing your SQL script (used in Advanced Installer) as described above and let us know if you encounter further problems. It would be very helpful if you could send us the AIP file. If it contains private information please send a similar project reproducing the issue.

Attach also the SQL script file in question and the database restore backup file (or a similar test DB backup file).

As an alternative approach you could recreate your database on the target computer by using an SQL batch dump file generated with a backup automation tool, hence avoiding database transaction instructions such as RESTORE.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”