Sauvegardes avec MS SqlServer

SqlServer avec Docker

Dump

Restauration

Pour demander le contenu

RESTORE FILELISTONLY
    FROM DISK = '/var/opt/mssql/backup/mydb.bak'
RESTORE DATABASE MyDB
    FROM DISK = '/var/opt/mssql/backup/mydb.bak'
    WITH PARTIAL,
    MOVE 'MyDB' TO '/var/opt/mssql/data/MyDB.mdf',
    MOVE 'MyDB_log' TO '/var/opt/mssql/data/MyDB_log.ldf'

Gérer l’accès à la base de données

CREATE LOGIN rtower WITH PASSWORD = 'rqMep4TebukMPH#Q', DEFAULT_DATABASE = Monitoring;
GRANT CONNECT SQL TO rtower
USE Monitoring
DROP USER rtower
CREATE USER rtower FOR LOGIN rtower
GRANT CONNECT ON DATABASE::Monitoring TO rtower
GRANT SELECT, EXECUTE on SCHEMA::dbo TO rtower

Restauration Partielle

Dans la backup que je devais restaurer, il y avait un fichier FILESTREAM :

RESTORE DATABASE MyDB
    FILEGROUP = 'PRIMARY'
    FROM DISK = '/var/opt/mssql/backup/mydb.bak'
    WITH PARTIAL,
    MOVE 'MyDB' TO '/var/opt/mssql/data/MyDB.mdf',
    MOVE 'MyDB_log' TO '/var/opt/mssql/data/MyDB_log.ldf'

⇒ erreur à ignorer