Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux sqlcmd cannot restore an OLDER backup file created in SQL 2022 (16.0.4095.4) to a new server instance sql 2022 (16.0.4105.2) #505

Closed
HenkAJV opened this issue Feb 2, 2024 · 2 comments
Assignees

Comments

@HenkAJV
Copy link

HenkAJV commented Feb 2, 2024

SQL Linux : 2022
SQLCMD: 1.5.0 GO (OI also tried sqlcmd ODBC mssql-tools18 )
Scenario: Stared SQL server on Ubuntu Linux 20.04 singe-yuser mode
SQL command:
use [master]; RESTORE DATABASE [master] FROM DISK = N'/var/opt/mssql/data/master.bak' WITH FILE=1, MOVE N'master' to N'/var/opt/mssql/data/master.mdf', MOVE N'mastlog' to N'/var/opt/mssql/data/mastlog.ldf', NOUNLOAD, REPLACE, STATS=5; GO
output

Msg 3168, Level 16, State 1, Server redacted, Line 2
The backup of the system database on the device /var/opt/mssql/data/master.bak cannot be restored because it was created by a different version of the server (16.00.4095) than this server (16.00.4105).
Msg 3013, Level 16, State 1, Server redacted, Line 2
RESTORE DATABASE is terminating abnormally.

The SQL server difference between the earlier backup was one service pack, not even a different SQL server version. It did not make sense and I wanted to report it here in case this is an issue with the sqlcmd tool.

The assumption is that one can restore a backup made in earlier versions of SQL and restore it to later versions of SQL. Am I missing something?

image

@shueybubbles
Copy link
Collaborator

I sent this issue to the SQL backup owners for insight

@stuartpa
Copy link
Collaborator

The issue here is the database in question being restore is a "system" database, not a "user" database.

Explanation here:

"""
You can't restore a backup of a system database (master, model, or msdb) on a server build that differs from the build on which the backup was originally created.
"""

https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-3168-database-engine-error?view=sql-server-ver16

@stuartpa stuartpa self-assigned this Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants