Restoring Database stuck in Restoring state

More
5 years 1 month ago - 5 years 1 month ago #21114 by imchaz
Running ETL Pro 6.3.7.18I have a SQL Script that I am using to restore a database.
See attached file called RestoreSQL.png

When I execute it from here, It restores my database without any issues.

But if I put the SQL Script Object in a Package, selecting "Execute Selected Package", it seems it runs properly.
See attached file RestoreDatabasePackage.png

But when I view the database in SSMS, it says its in Restoring state.
See attached file OUSF_MigrationRestore.PNG

What am I doing incorrectly that when it runs from the package, it puts the DB in the restoring state?
Attachments:
Last edit: 5 years 1 month ago by imchaz.

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #21115 by admin
Perhaps you also need to restore logs separately?

Please have a look at this detailed article

www.mssqltips.com/sqlservertip/5460/sql-...-in-restoring-state/

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #21116 by imchaz
I have seen that article and notice about the logs.

But I have used the restore script as I have outlined above and had never had any issues having the database coming back stuck in "Restoring State". When I run this as a stand alone SQL object or using SSMS via the restore script, I don't have any issues.

The issue happens when I put the SQL object in the Package and attempt to run it from there.

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #21117 by imchaz
Essentially what I found out is that when you restore the DB file it will create a checkpoint file in the the directory you are restoring from.
In my case it was called RestoreCheckpointDB7.CKP

This file is suppose to delete when finished restoring. But when I run the script from the package, it puts the database in a RESTORING state.

To work around this issue when running the script from the package I had to invoke a RESTART option on the .bak file I am restoring from.
See link here for reference.
docs.microsoft.com/en-us/sql/relational-...iew=sql-server-ver15

So I added another SQL Script object in my package after the SQL Restore Object
Example: Restore Database With Restart
Use [Master]
RESTORE DATABASE OUSF_Migration
FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER1\MSSQL\Backup\PendingDisbursement.bak'
WITH RESTART
GO

This seems to work and I can fully restore my database.

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save