K
K
kipishio kipishio2019-11-29 11:29:27
SQL
kipishio kipishio, 2019-11-29 11:29:27

How to compress and clean the log.ldf (transaction log) file from the database through SQL 2016 in the scheduler?

Hello.
Due to the large size of the log.ldf file, which has become approximately 150Gb and is the history of the SQL database transaction, it became necessary to reduce it
. The file allows you to return to any point in time and restore the database to a specified time.
Because Since full backups are configured in the scheduler and are done quite often, there is no particular need for this log, although it would be nice to always have a monthly version.
Tell me how to set up compression and cleaning of this file through the scheduler after a successfully made backup?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2019-11-29
@kipishio

DBCC SHRINKDATABASE (AdventureWorks2012, TRUNCATEONLY);

https://docs.microsoft.com/en-us/sql/t-sql/databas...

K
kipishio kipishio, 2019-11-29
@kipishio

your transaction log will only grow, no matter how many shrinks (DBCC SHRINKDATABASE/SHRINKFILE) you make.

I thought let it grow, but cut it off every time through the scheduler when the backup is completed.
I just don't know how to do it in the scheduler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question