BACKUP LOG cannot be performed because there is no current database backup

Sql Server

Sql Server Problem Overview


I tried to restore a database but this message showed. How do I restore this database?

> Restore of database 'farhangi_db' failed.
> (Microsoft.SqlServer.Management.RelationalEngineTasks)
> ------------------------------ ADDITIONAL INFORMATION:
> > System.Data.SqlClient.SqlError: BACKUP LOG cannot be performed because
> there is no current database backup. (Microsoft.SqlServer.SmoExtended)

Sql Server Solutions


Solution 1 - Sql Server

Originally, I created a database and then restored the backup file to my new empty database:

> Right click on Databases > Restore Database > General : Device: [the > path of back up file] → OK

This was wrong. I shouldn't have first created the database.

Now, instead, I do this:

> Right click on Databases > Restore Database > General : Device: [the > path of back up file] → OK

Solution 2 - Sql Server

Another cause of this issue is when the Take tail-log backup before restore "Options" setting is enabled.

On the "Options" tab, Disable/uncheck Take tail-log backup before restore before restoring to a database that doesn't yet exist.

Solution 3 - Sql Server

Please see below image and apply changes in SqlServer :

first right click on Database --> Task --> Restore --> Select Backup File --> Finally Apply Change in Options Tab.

please apply changes in SqlServer

Solution 4 - Sql Server

  1. Make sure there is a new database.
  2. Make sure you have access to your database (user, password etc).
  3. Make sure there is a backup file with no error in it.

Solution 5 - Sql Server

In our case it was due to the Recovery Model on the primary database having been changed after we did the backup in preparation for setting up log shipping.

Ensuring the Recovery Model was set to Full Recovery before doing the backup and setting up log shipping resolved it for us.

Solution 6 - Sql Server

You can use following SQL to restore if you've already created database

RESTORE DATABASE [YourDB]
FROM DISK = 'C:\YourDB.bak'
WITH MOVE 'YourDB' TO 'C:\YourDB.mdf',
MOVE 'YourDB_Log' TO 'C:\YourDB.ldf', REPLACE

Solution 7 - Sql Server

Another cause for this is if you have the same database restored under a different name. Delete the existing one and then restoring solved it for me.

Solution 8 - Sql Server

I fixed my error on restoring to non-existing DB from SQL 2008 to SQL 2014 by putting a check mark on Relocating to the new SQL2014 folder location.

Solution 9 - Sql Server

I just deleted the existing DB that i wanted to override with the backup and restored it from backup and it worked without the error.

Solution 10 - Sql Server

I am not sure whether the database backup file, you trying to restore, is coming from the same environment as you trying to restore it onto.

Remember that destination path of .mdf and .ldf files lives with the backup file itself.

If this is not a case, that means the backup file is coming from a different environment from your current hosting one, make sure that .mdf and .ldf file path is the same (exists) as on your machine, relocate these otherwise. (Mostly a case of restoring db in Docker image)

The way how to do it: In Databases -> Restore database -> [Files] option -> (Check "Relocate all files to folder" - mostly default path is populated on your hosting environment already)

Solution 11 - Sql Server

In case the problem still exists go to Restoration Database page and Check "Restore all files to folder" in "Files" tab This might help

Solution 12 - Sql Server

In my case I am restoring a SQL Server 2008 R2 Database to SQL Server 2016 After selecting the file in the General tab, you should go to the Options tab and do 2 things:

> 1. You must activate Overwrite existing database > 2. You must deactivate end of record copy

Solution 13 - Sql Server

Simply you can use this method:

  1. If you have a database with same name: WIN+R -> services.msc -> SQL SERVER(MSSQLSERVER) -> Stop
  2. Go to your MySQL Data folder path and delete previews database files
  3. Start sql service
  4. Right click on database and select Restore database
  5. in Files tab change Data file folder and Log file folder
  6. Click on OK to restore your database

my problem was solved with this method BY...

Solution 14 - Sql Server

Click Right Click On Your Database The Press tasks>Back Up and take a back up from your database before restore your database i'm using this way to solve this Problem

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSamanView Question on Stackoverflow
Solution 1 - Sql ServerSamanView Answer on Stackoverflow
Solution 2 - Sql ServerPeachView Answer on Stackoverflow
Solution 3 - Sql ServerAmin GolmahalleView Answer on Stackoverflow
Solution 4 - Sql ServerOskarView Answer on Stackoverflow
Solution 5 - Sql ServerDaniel BowenView Answer on Stackoverflow
Solution 6 - Sql ServerHasanGView Answer on Stackoverflow
Solution 7 - Sql ServerLothorienDanAduaView Answer on Stackoverflow
Solution 8 - Sql ServerOscar GonzalezView Answer on Stackoverflow
Solution 9 - Sql ServerDongolo JenoView Answer on Stackoverflow
Solution 10 - Sql Serverst35lyView Answer on Stackoverflow
Solution 11 - Sql ServerSarathView Answer on Stackoverflow
Solution 12 - Sql ServerAnibal Roman CrespoView Answer on Stackoverflow
Solution 13 - Sql ServerMojtaba RezaeiView Answer on Stackoverflow
Solution 14 - Sql ServerAbkreno PronceView Answer on Stackoverflow