question

JooResende1141504-4912 avatar image
0 Votes"
JooResende1141504-4912 asked Yufeishao-msft commented

SQL Restore databse error

142127-sql.png




Hello community

I just started learning SQL and I am already facing a problem. When I try to restore the database it keeps appearing this error and I can't import the database., as you can see in the image.
Do you have some idea how can I solve it??

sql-server-generalazure-sql-database
sql.png (54.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered AlbertoMorillo commented

I don't know why Alberto is talk about Azure. To me it seems that you are trying to restore the backup on your laptop.

The message makes me think that the backup file has been damaged somehow. But try this command:

RESTORE DATABASE AdventureWorks2019 FROM DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL.15.SQLEXPRESS\MSSQL\Backup\AdventureWorks2019.bak'
WITH MOVE 'AdventureWorks2019' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.15.SQLEXPRESS\MSSQL\Data\AdventureWorks2019.mdf',
     MOVE 'AdventureWorks2019_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.15.SQLEXPRESS\MSSQL\Data\AdventureWorks2019.ldf'

Maybe you get some error messages that gives us more information.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The tag misled me.

0 Votes 0 ·
Yufeishao-msft avatar image
0 Votes"
Yufeishao-msft answered Yufeishao-msft commented

Hi @JooResende1141504-4912

backup media verification failed

run the following code to verify the backup is not corrupted:

 RESTORE VERIFYONLY FROM DISK = 'D:\AdventureWorks.bak';
 GO

about possible media errors:
https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/possible-media-errors-during-backup-and-restore-sql-server?view=sql-server-ver15

and try to disable checksums during a restore operation

 RESTORE DATABASE AdventureWorks2012   
  FROM DISK = 'Z:\SQLServerBackups\AdvWorksData.bak'  
    WITH NO_CHECKSUM;  
 GO  

if backup file is really corrupted, you can use DBCC CHECKDB repair: https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-transact-sql?view=sql-server-ver15



If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.








· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If the reply above was helpful please mark as accepted answer so it can be helpful for other community members with same questions.

0 Votes 0 ·
JooResende1141504-4912 avatar image
0 Votes"
JooResende1141504-4912 answered

Hello,
Thank you for the help.
So, I tried all the steps above, and I still can't work with the 'AdventureWorks2019'. But I tried to import the 'AdventureWorks2012' just to see what happens and it worked just fine and I'm now doing the course with that database.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered

Which SQL Server version are you using? You get the info with

 select @@version
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JooResende1141504-4912 avatar image
0 Votes"
JooResende1141504-4912 answered Yufeishao-msft commented

Microsoft SQL Server 2016 (SP2-GDR) (KB4583460) - 13.0.5103.6 (X64) - i think now I understand . But I downloaded the latest version from the site.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Regardless of the recovery model of a database, a SQL Server backup cannot be restored to a SQL Server Database Engine version that is older than the version that created the backup, please download 2019 version, https://www.microsoft.com/en-us/sql-server/sql-server-downloads

0 Votes 0 ·
OlafHelper-2800 avatar image
1 Vote"
OlafHelper-2800 answered JooResende1141504-4912 commented

Microsoft SQL Server 2016

You can not restore a 2019 database on a lower SQL Server version like here 2016, that's impossible and cause the error you got.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I understood that. I believe the problem was related to the fact that I had older SQL versions installed at the same time. I installed the older versions and just restored the database from 2019 with no problem.

Thank you for your help.

0 Votes 0 ·