Monday, August 13, 2012

Unable to recover your SQL server database due to incomplete transaction

Microsoft SQL server database is the mostly used database among other relational databases like Oracle, MySQL, Access, SQL Anywhere and many more. Database administrator can make backup of his/her database to avoid any data loss. If you don't have maintained the backup of your database then I will strongly recommend you to do it now because corruption in database can happen at any time any reasons.

Suppose you have made a database and the name of database is myfirstdatabase. You have successfully maintained the backup of your database and want to restore it from the backup. You can do it with the help of RESTORE command but during the restore process you have canceled the restoring process and after the refreshing the database you have got bellow error message the states “the database can not be recovered because the log was not restored”. Now your database is in restoring state and you will be unable to do any operation on the database.

Msg 4333, Level 16, State 1, Line 1
The database cannot be recovered because the log was not restored.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Here are the steps that you have done on your database:

Create database myfirstdatabase
Make backup myfirstdatabase.bak
Restore database myfirstdatabase
Got error message 4333 & 3013

How to Bring database online? You have canceled the restoring process in the middle of restore so the entire database was not restored. To bring your database online you have to use WITH RECOVERY option with your database restore command and the command should be.

Restore Database myfirstdatabase
From disk = 'myfirstdatabase.bak'
WITH RECOVERY

Note: This time don't kill or cancel the restoring process in the middle. Keep patient and wait for the complete restoration. Now you will be able to restore your database successfully.

No comments:

Post a Comment