Sharepoint DR on Azure

Hi I'm trying to SharePoint Dr in Azure with SQL log Shipping.

now I followed this link to configure the Log Shipping but I failed : https://technet.microsoft.com/en-us/library/dn743677.aspx

my Environment is very Simple (1 Sharepoint 2013 including SQL 2012 on premise) ( One Azure VM Sharepoint 2013 including the SQL 2012) No SQL Always on.

I tried the below Script but it didn't work.

I only changed these parameter , 

Set @PrimServer ='Sharepoint1'
Set @SecServer ='Sharepoint2'
Set @SecInstance ='sharepoint2.adventureworks.com'
Set @Domain ='adventureworks.com'
Set @BkpDrive ='sharepoint1.adventureworks.com'
Set @DBName = 'WSS_Content'


SET NOCOUNT ON USE MSDB GO --@PrimServer : Primary Server name --@SecServer : DR/Secondary Server Name --@SecInstance : DR/Secondary FQDN --@Domain : Domain Name --@BkpDrive : Production Backup server Name --@DBName : DatabaseName DECLARE @LS_BackupJobIdAS uniqueidentifier, @LS_PrimaryIdAS uniqueidentifier , @SP_Add_RetCode As int DECLARE @Time as nvarchar(10),@SecInstance as nvarchar(250), @PrimServer as nvarchar(50),@SecServer as nvarchar(50), @Domain as nvarchar(50),@DBName as nvarchar(max),@BkpDrive as nvarchar(250),@CMD as nvarchar(max),@Counter int ---------------------------------------------------------------------------- IF OBJECT_ID ('tempdb.DBO.#LogShipping','U') IS NOT NULL DROP TABLE #LogShipping Create table #LogShipping ( LSDBs nvarchar(max)) Set @PrimServer ='SQL1' Set @SecServer ='SQL2' Set @SecInstance ='SQL2.corp.adventureworks.com' Set @Domain ='corp.adventureworks.com' Set @BkpDrive ='FS1.corp.adventureworks.com' Set @DBName = 'Social_DB' Set @Time = '0130' SET @DBName = UPPER(REPLACE(@DBName, ' ', '')) SET @DBName = '''' + REPLACE(@DBName, ',', ''', ''') + '''' Set @CMD = ' Select ' + '''DECLARE @SP_Add_RetCode As int, @LS_BackupJobIdAS uniqueidentifier, @LS_PrimaryIdAS uniqueidentifier EXEC @SP_Add_RetCode = master.dbo.sp_add_log_shipping_primary_database ' + CHAR(10) + '@database = '''''' + db.Name + ''''''' + CHAR(10) + ',@backup_directory = ''''\\' + @BkpDrive + '\LS\' + ''' + db.Name + ''''' + '''' + CHAR(10) + ',@backup_share = ' + '''''\\' + @BkpDrive + '\LS\' + ''' + db.Name + ''''' + '''' + CHAR(10) + ',@backup_job_name = ''''' + 'LSBackup_' + ''' + db.Name + ''''' + '''' + CHAR(10) + ',@backup_retention_period = 4320 ,@backup_compression = 1 ,@backup_threshold = 180 ,@threshold_alert_enabled = 1 ,@history_retention_period = 5760 ,@backup_job_id = @LS_BackupJobId OUTPUT ,@primary_id = @LS_PrimaryId OUTPUT ,@overwrite = 1 ' + 'IF (@@ERROR = 0 AND @SP_Add_RetCode = 0) BEGIN DECLARE @LS_BackUpScheduleUIDAs uniqueidentifier ,@LS_BackUpScheduleIDAS int EXEC msdb.dbo.sp_add_schedule @schedule_name = ''''' + 'LSBackupSchedule_'+ @PrimServer + '_' + ''' + db.Name + ''''' + '''' + CHAR(10) + ',@enabled = 1 ,@freq_type = 4 ,@freq_interval = 1 ,@freq_subday_type = 4 ,@freq_subday_interval = 13 ,@freq_recurrence_factor = 0 ,@active_start_date = 20090506 ,@active_end_date = 99991231 ,@active_start_time = ' + @Time + CHAR(10) + ',@active_end_time = 235900 ,@schedule_uid = @LS_BackUpScheduleUID OUTPUT ,@schedule_id = @LS_BackUpScheduleID OUTPUT EXEC msdb.dbo.sp_attach_schedule @job_id = @LS_BackupJobId ,@schedule_id = @LS_BackUpScheduleID EXEC msdb.dbo.sp_update_job @job_id = @LS_BackupJobId ,@enabled = 1 END EXEC master.dbo.sp_add_log_shipping_alert_job EXEC master.dbo.sp_add_log_shipping_primary_secondary @primary_database = ''' + ''''' + db.Name + ''''' + '''' + CHAR(10) + ',@secondary_server = ''''' + @SecInstance + '''''' + CHAR(10) + ',@secondary_database = ''' + ''''' + db.Name + ''''' + '''' + CHAR(10) + ',@overwrite = 1 ''' + ' [LSDBs] FROM sys.databases db where name in (' + @DBName + ')' + 'and db.name not in (''master'',''model'',''msdb'',''tempdb'',''metricsops'',''periscope'' ) and Not (exists (select lss.Secondary_database from msdb.dbo.log_shipping_Secondary_databases lss where db.Name = lss.Secondary_database) or exists (select lsp.primary_database from msdb.dbo.log_shipping_primary_databases lsp where db.Name = lsp.primary_database) )' Insert #LogShipping (LSDBs) Exec ( @CMD) Set @Counter = @@rowcount While (@counter > 0) Begin select top 1 @CMD = LSDBs from #LogShipping exec sp_executesql @CMD set @counter = @counter - 1 delete top (1) from #LogShipping End IF OBJECT_ID ('tempdb.DBO.#LogShipping','U') IS NOT NULL DROP TABLE #LogShipping -- ****** End: Script to be run at Primary: [DB1-PSMSQL-01] ******

August 26th, 2015 3:33am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics