Just a question, out of perhaps laziness :)
Personally I always tend to forget to make a backup before a deployment.. anyone by chance already made a solution for this in the SF and cares to share it? ..
Just a question, out of perhaps laziness :)
Personally I always tend to forget to make a backup before a deployment.. anyone by chance already made a solution for this in the SF and cares to share it? ..
Hi Freddy,
We added a template with a piece of code to the ug_before_upgrade_always program object:
SET @name = (SELECT DB_NAME())
BACKUP DATABASE @name TO DISK = @filename
where the the @filename is composed of the settings we use on our server, the path can be determined using:
EXEC master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\MSSQLServer\MSSQLServer',N'BackupDirectory',
@path OUTPUT,
'no_output'
Thanks!
As we use containers, I did it as followed:
declare @database varchar(30) = (select DB_NAME())
declare @path varchar(150) = '/var/opt/mssql/backup/'
declare @target varchar(260) = @path + @database + '.bak'
BACKUP DATABASE @database
TO DISK = @target
WITH FORMAT;
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.