Posts

Showing posts from March, 2019

Getting the folder and sub folder information in a particular drive or path through power shell

The below Powershell query will extract the folder and sub folder info in the given path. I just mention here folder  names -path showing as "MainFolder" and "SubFolder". In this place you provide your needed folders. -Exclude:   This is a parameter to which we need to pass extension of files, which we are expecting not to show in the result set. Clear Get-ChildItem ` -Path \\MainFolder\Sub\Sub1 ` -Exclude *.dtsx,*.sql*,*.onepkg*,*.docx*,*.doc*,*.log* -Recurse| Where-Object {$_.Name -like "*Full_*"} #Will provide DIFF info #clear Get-ChildItem ` -Path \\MainFolder\Sub\Sub1 ` -Exclude *.dtsx,*.sql*,*.onepkg*,*.docx*,*.doc*,*.log* -Recurse| Where-Object {$_.Name -like "*Diff_*"} # The below query will handle above both the queries. clear Get-ChildItem ` -Path E:\SQLBackups\Backups  ` -Exclude *.dtsx , *.sql* , *.onepkg* , *.docx* , *.doc* , *.log* -Recurse | Where-Object {( $_ . Name -like &quo

Understanding Backup Preferences for Always on Availability Group Databases

SQL Server backups are resource intensive operation that strain on I/O and CPU(with backup compression). Always On Availability Group(AOAG) has a mechanism to offload SQL Server Backups and read operations from primary replica to reduce such workloads and utilize secondary replica in a better way. 1. Regular FULL BACKUPS are not allowed from secondary replicas.   But  COPY_ONLY  full backups are allowed on secondary replicas. That means you cannot run regular Full backup  from any of the secondary replica.  Remember that copy-only backups do not impact the log chain or clear the differential bitmap. 2. DIFF BACKUPS(Differential backups) are not supported on secondary replicas . If you need Differential backups for your availability databases don't chose backup preference as SECONDARY ONLY 3. Only regular log backups are supported on secondary replicas. COPY_ONLY log backups are not supported on secondary replicas. 4. Secondary replica must be in SYNCHRONIZED or SYNCHRONIZ