SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Backup log to disk='null' with copy_only


Backup log to disk='null' with copy_only

Author
Message
coolchaitu
coolchaitu
SSCertifiable
SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)

Group: General Forum Members
Points: 7089 Visits: 1506
Good morning Experts,
Can I use the below command? Is it safe?
Backup log to disk='nul' with copy_only
As i am using copy_only , it will not break the log chain, correct? And later, I can shrink this log file, correct?
bmg002
bmg002
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18569 Visits: 2499
It will not break the log chain (which I think is your goal), but it won't affect shrinking the log file. In order to shrink the log file (not recommended) you need to have the log backed up (ie remove the copy_only).
I do not recommend doing a backup to null though. You will not be able to recover in the event of an emergency.

What I would recommend (if you do need to shrink the log) is to do a tlog backup and then shrink the log file. Shrinking the log file will affect performance of the system though both during and possibly after if the log needs to grow again.
coolchaitu
coolchaitu
SSCertifiable
SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)SSCertifiable (7.1K reputation)

Group: General Forum Members
Points: 7089 Visits: 1506
bmg002 - Monday, November 6, 2017 2:45 PM
It will not break the log chain (which I think is your goal), but it won't affect shrinking the log file. In order to shrink the log file (not recommended) you need to have the log backed up (ie remove the copy_only).
I do not recommend doing a backup to null though. You will not be able to recover in the event of an emergency.

What I would recommend (if you do need to shrink the log) is to do a tlog backup and then shrink the log file. Shrinking the log file will affect performance of the system though both during and possibly after if the log needs to grow again.

So, using "with copy_only" does not backup the tlog?

bmg002
bmg002
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18569 Visits: 2499
using "copy_only" makes a backup of the tlog but it does not do a truncate of the log when it completes. According to Microsoft:
opy-only log backups (full recovery model and bulk-logged recovery model only)

A copy-only log backup preserves the existing log archive point and, therefore, does not affect the sequencing of regular log backups. Copy-only log backups are typically unnecessary. Instead, you can create a new routine log backup (using WITH NORECOVERY) and use that backup together with any previous log backups that are required for the restore sequence. However, a copy-only log backup can sometimes be useful for performing an online restore. For an example of this, see Example: Online Restore of a Read-Write File (Full Recovery Model).

The transaction log is never truncated after a copy-only backup.

https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/copy-only-backups-sql-server

It does still do a backup of the tlog when running "BACKUP LOG".
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search