Bak File Backup Restore Docker Azure SQL Edge in M1 Apple - sql-server

I try to restore a .bak file Azure Sql Edge container with Azure Data Studio. I have Apple M1 chipset. I am using docker for mssql:
mcr.microsoft.com/azure-sql-edge latest 5dba915af82f 8 weeks ago 1.83GB
I need to install Mssql and restore a database with .bak file. But I get below error:
Restore FilelistOnly from disk = N'/var/opt/mssql/backup/test.bak'
Restore Database test From disk = N'/var/opt/mssql/backup/test.bak' WITH REPLACE, RECOVERY, MOVE 'test_data' TO '/var/opt/mssql/data/test.mdf', MOVE 'test_Log' TO '/var/opt/mssql/data/test.ldf'
Msg 12824, Level 16, State 1, Line 2 The sp_configure value
'contained database authentication' must be set to 1 in order to
restore a contained database. You may need to use RECONFIGURE to set
the value_in_use.
I try to
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO
I am getting:
Msg 15392, Level 16, State 1, Procedure sp_configure, Line 166 The
specified option 'contained database authentication' is not supported
by this edition of SQL Server and cannot be changed using
sp_configure.
How to restore my backup on azure sql edge?

You're running Azure SQL Edge, which is a special edition intended for IoT scenarios.
Per the docs
Additionally, a database created on Microsoft SQL Server or Azure SQL
can be restored on Azure SQL Edge, provided the database does not
contain any of the features not supported by Azure SQL Edge.
Backup and Restore - Azure SQL Edge
And Contained Databases are not supported in Azure SQL Edge.
So either start with a backup of a non-contained database, or use one of the "regular" SQL Server Editions on Docker.

Regular SQL docker editions for M1 Apple Silicon is still not supported. Azure SQL Edge not usefull for this activity. So can not import bak or bacpac files to local sql via M1 macs!

Related

How to restore Azure Sql server

i'm working on Azure and while deploying my terraform release somehow i made a mistake which deleted my ressources, i managed to restore my web app but failed to restore my Sql servers that contains my Databases. does anyone knows how to restore sql sevrer on azure ? if its possible of course.
All what i can found on internet is how to restore Sql DataBase but not the sql server as described here
If you deleted the Azure SQL server, all the resources, include databases and backup will be deleted. You can not restore the it by yourself.
Reference Deleted database restore:
In this case, you should call Azure Support in 7 days, they can help you restore the Azure SQL server and the databases.
Create the support on Portal, you could follow these steps:
Step1:
Step2
Step3
Hope this helps.

Backup and Restore SQL Server database from higher version to lower version

I'm looking for a way to create a command line script to backup SQL Server 2016 which can be restored in a older version SQL Server 2012.
We have a daily backup from our SQL Server 2016 using the
BACKUP DATABASE XXXX TO DISK = "C:\BACKUP.BAK"
and this back up is provided to a 3rd party which is running an older SQL Server 2012.
When they use SMSS they get an error stating an error about the incompatible version.
I've tried using ALTER DATBASE XXXX SET COMPATIBILITY_LEVEL = 110 ( targeting even a lower than SQL Server 2012 version)... thinking it can be loaded in their 2012 but when they try to load it, it still states that the backup file is in 2016 (v13.xxx) ?!
Sample backup script
USE MYDB;
ALTER DATABASE MYDB SET SINGLE_USER
GO
-- TARGETING SQL Server SQL Server 2012
ALTER DATABASE MYDB SET COMPATIBILITY_LEVEL = 110
GO
BACKUP DATABASE MYDB
TO DISK = 'C:\TEMP\MYDB.BAK'
ALTER DATABASE MYDB SET MULTI_USER
GO
Can anyone let me know what Im doing wrong?
Thanks
You just simply CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server down to an older version - the internal file structures are just too different to support backwards compatibility. And the "database compatibility level" also doesn't help.
You can either get around this problem by
using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances
otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool
or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.

Backup and restore database along with user/group/roles and permissions in sql server 2005

We are having some problem in server hosting SQL server 2005. We are required to take backup of all the databases and restore the same once the
window 2003 server and sql server 2005
is reinstalled.
We also need to restore all the users/groups/roles and permissions as it is which were there earlier.
Please guide the steps.
The database securables are backed up with the database.
What you will have to do is to script and recreate the logins. If the logins are SQL Server logins (not the windows logins, ie), the trick is to create them with the same SIDs as before to avoid orphaned database users (this can bi fixed manually, but it's much easier to recreate the same-SID logins).
Here's the article on MS support describing the procedure in detail:
https://support.microsoft.com/en-us/kb/918992

Compatibility level for SQL Server database

My database hoster allows to restore SQL Server databases with a compatibility level of 90 (SQL Server 2005). My database is created locally with a compatibility level of 100 (SQL Server 2008).
So, I generated script of my database (version 2008) and run in SQL Server 2005, backup and restore to my database hoster, it works. Currently I do likes it.
And then I found ALTER DATABASE that can change compatibility level of database likes
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = { 90 | 100 | 110 }
90 = SQL Server 2005
100 = SQL Server 2008 and SQL Server 2008 R2
110 = SQL Server 2012
I turn my database compatibility level using this script in SQL Server 2008, backup my database and restore to my database hoster. But it doesn't work. I want to know why? Is there a better way to fix it ?
You can NEVER restore a database from a newer version of SQL Server (like your 2008 version) onto an older SQL Server (2005) instance.
No matter what you try, no trick, no hack, no workaround - it just cannot be done.
The compatibility level doesn't make any difference either. It just makes your newer database (like on 2008) behave as if it were an older one (like 2005) - so the features you can use are limited to what the older database supported.
But internally - it's still a 2008 database and it cannot be restored to a 2005 instance.
You can't go back to version compatibility of sql server better to go through scripts.
Make a new database
Import the tables in the new database
Then generate the script of procedures and functions and run this script on the new database

Can’t restore SQL Server 2000 backup to SQL Server 2008

I have a backup file taken from a SQL Server 2000 database and I'm trying to restore it to a 2008 database. However, I'm getting this error:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) The media family on device 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup\customers.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)
I am the one who originally took the backup (years ago). It was a hosted SQL Server. If I remember correctly, I got the backup using some sort of online "control panel"
SQL 2000 SP4 database can be upgraded on-the-fly to SQL 2008 (including restore-upgrade). See Version and Edition Upgrades. If you get that message most likely the media is corrupted.
In SQL Server 2008, follow these steps
Create New database with the same name as in SQL Server 2000
After writing database name, go to Options tab
In Compatibility Level dropdown select 'SQL Server 2000 (80)
After creating database, go to Task and select restore
After selecting restore resource go to options tab and select 'Overwrite the existing database (With Replace)
Your database will be restored

Resources