SQL Restore databse error

João Resende (1141504) 6 Reputation points
2021-10-20T16:29:30.987+00:00

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??

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,640 questions
0 comments No comments
{count} vote

6 answers

Sort by: Most helpful
  1. Olaf Helper 40,656 Reputation points
    2021-10-26T09:58:56.78+00:00

    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 person found this answer helpful.

  2. Erland Sommarskog 100.8K Reputation points MVP
    2021-10-20T21:34:49.967+00:00

    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.


  3. YufeiShao-msft 7,051 Reputation points
    2021-10-21T06:04:20.347+00:00

    Hi @João Resende (1141504)

    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://learn.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://learn.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.


  4. João Resende (1141504) 6 Reputation points
    2021-10-26T09:11:03.417+00:00

    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.

    0 comments No comments

  5. Olaf Helper 40,656 Reputation points
    2021-10-26T09:16:21.123+00:00

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

    select @@version
    
    0 comments No comments