How to shrink transaction log on mirror database (Microsoft SQL Server).

Solution:

Applied to: Microsoft SQL Server 2008 R2 (but it’s similar for the other).

To shrink transaction log manually on mirror database (Microsoft SQL Server) you have to follow these steps:

  1. Verify mirroring database: database must be in Principal, Synchronized state.
  2. Execute query:
    USE Databasename
    BACKUP LOG Databasename TO DISK = N’D:\Backup\DatabaseName_log.bak’
    GO
    DBCC SHRINKFILE(‘DatabaseLogicalName_Log’, 1)
    GO
  3. After you executed the query you receive:
    Es. querybackupshrinkdatabase
  4. Re-Execute query until you receive CurrentSize = 128:
    querybackupshrinkdatabase128

Best Regards,

ITquadro – specialized Blog

ITquadro consulenti informatici specializzati in ambienti microsoft sql server. Ci trovate su Bologna ed Emilia-Romagna ma anche su Milano e Roma.