OLAHALLENGREN OUTPUT FILE PATH INFO

The below parameter you need to change in the Ola script and Execute his maintenance script.
SET @OutputFileDirectory = 'G:\Backups\Siva' 

This path will be automatically generated by Ola script.
G:\Backups\Siva\DatabaseBackup_FULL_$(ESCAPE_SQUOTE(JOBID))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt
The below powershell query will change teh output file path of FULL,DIFF,LOG,INDEX and INTEGRITY check backups. Backup jobs are created by Ollahallengren script.
cls
$InstanceName = 'RAMESH\PROD'
$FullPath='D:\ramesh\mahesh\USER_DATABASES_FULL_$(ESCAPE_SQUOTE(JOBID))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt'
$DIFFPath='D:\ramesh\mahesh\USER_DATABASES_DIFF_$(ESCAPE_SQUOTE(JOBID))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt'
$LOGPath='D:\ramesh\mahesh\USER_DATABASES_LOG_$(ESCAPE_SQUOTE(JOBID))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt'
$IndexPath='D:\ramesh\mahesh\USER_DATABASES_INDEXES_$(ESCAPE_SQUOTE(JOBID))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt'
$IntegrityPath = 'D:\ramesh\mahesh\USER_DATABASES_INTEGRITY_$(ESCAPE_SQUOTE(JOBID))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt'

$JobList=Get-DbaAgentJob `
-SqlInstance $InstanceName|Select Name|Where-Object {($_.Name -like '*USER_DATABASES*')-and($_.Name -like '*FULL*')}
$JobList|
ForEach-Object{
$IndJob = $_
Set-DbaAgentJobOutputFile `
-SqlInstance $InstanceName `
-Job $IndJob.Name `
-OutputFile $FullPath `
-Verbose
}
$JobList=Get-DbaAgentJob `
-SqlInstance $InstanceName|Select Name|Where-Object {($_.Name -like '*USER_DATABASES*')-and($_.Name -like '*DIFF*')}
$JobList|
ForEach-Object{
$IndJob = $_
Set-DbaAgentJobOutputFile `
-SqlInstance $InstanceName `
-Job $IndJob.Name `
-OutputFile $DIFFPath `
-Verbose
}
$JobList=Get-DbaAgentJob `
-SqlInstance $InstanceName|Select Name|Where-Object {($_.Name -like '*USER_DATABASES*')-and($_.Name -like '*LOG*')}
$JobList|
ForEach-Object{
$IndJob = $_
Set-DbaAgentJobOutputFile `
-SqlInstance $InstanceName `
-Job $IndJob.Name `
-OutputFile $LOGPath `
-Verbose
}
$JobList=Get-DbaAgentJob `
-SqlInstance $InstanceName|Select Name|Where-Object {($_.Name -like '*USER_DATABASES*')-and($_.Name -like '*Index*')}
$JobList|
ForEach-Object{
$IndJob = $_
Set-DbaAgentJobOutputFile `
-SqlInstance $InstanceName `
-Job $IndJob.Name `
-OutputFile $IndexPath `
-Verbose
}
$JobList=Get-DbaAgentJob `
-SqlInstance $InstanceName|Select Name|Where-Object {($_.Name -like '*USER_DATABASES*')-and($_.Name -like '*integrity*')}
$JobList|
ForEach-Object{
$IndJob = $_
Set-DbaAgentJobOutputFile `
-SqlInstance $InstanceName `
-Job $IndJob.Name `
-OutputFile $IntegrityPath `
-Verbose
}

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server