Sha256: c345627c02161742da13dc24a2bbd61d197f9c49d0b6400fb68c136254b6add1

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

--RESTORE FILELISTONLY FROM  DISK = 'G:\MSSQL\Backup\#{db_name}.bak' ;
--"BACKUP LOG [demodb] TO  DISK = N'var/opt/mssql/data/demodb_LogBackup_2016-11-14_18-09-53.bak' WITH NOFORMAT, NOINIT,  NAME = N'demodb_LogBackup_2016-11-14_18-09-53', NOSKIP, NOREWIND, NOUNLOAD,  NORECOVERY ,  STATS = 5"
-- for #{db_name}Dev


-- differential
-- docker exec -it mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -d master
-- RESTORE DATABASE [#{db_name}Dev] FROM  DISK = N'/root/backups/1.bak' WITH  FILE = 1, NORECOVERY, REPLACE;
-- RESTORE DATABASE [#{db_name}Dev] FROM  DISK = N'/root/backups/2.bak' WITH  FILE = 1, RECOVERY;

IF ( EXISTs (SELECT name FROM master.dbo.sysdatabases WHERE name = '$(DB_NAME)2Dev'))
 drop DATABASE $(DB_NAME)2Dev
 create DATABASE $(DB_NAME)2Dev

ALTER DATABASE $(DB_NAME)2Dev
SET SINGLE_USER WITH ROLLBACK AFTER 5 --this will give your current connections 60 seconds to complete
go
RESTORE DATABASE [$(DB_NAME)2Dev] FROM  DISK = N'/root/backups/$(DB_NAME)2Dev.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 5;
GO
ALTER DATABASE $(DB_NAME)2Dev SET MULTI_USER
GO
USE master ;
ALTER DATABASE $(DB_NAME)2Dev SET RECOVERY SIMPLE;
GO
DBCC SHRINKDATABASE ($(DB_NAME)2Dev, TRUNCATEONLY);
--GO
--DBCC SHRINKDATABASE ($(DB_NAME)2Dev, 10);
GO

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
container-backup-0.1.0 scripts/mssql/init.sql