Forum Discussion

Deleted's avatar
Deleted
Apr 30, 2020

Transaction log backup using powershell

Hi,

 

I was looking at using PowerShell for backups of one of our SQL Servers.

 

Got it working fine but I notice something when backing up the transactions logs (database in Full recovery mode).

 

Extreme example: If the transaction log file itself is say 2GB but only 10MB is being used, a Maintenance Schedule backup will create a backup file only 10MB in size. A powershell backup will create a 500MB backup with compression on (2GB with compression off).

 

Is there a way for powershell command to only back up the used log space?

 

thanks

 

jc

1 Reply

  • olafhelper's avatar
    olafhelper
    Bronze Contributor

    PowerShell / SMO /SqlPs does nothing else then sending a plain T-SQL script to SQL Server, there is no difference in which way you perform a backup.

     

    How and when did you get the used size; before or after backup?

Resources