question

srivivek avatar image
srivivek asked

effect of Truncate on Logshipping

I am planning to implement logshipping between Prod and DR servers. I heard that we should not use the truncate command on a DB which is using logshipping,Is it True? Will it break logshipping. [I have tested logshipping by truncating the table, and i see the table is truncated on the secondary DB and logshipping is running smooth.] What are the things that I shouldn't do while a DB is logshipping.
logshippingtruncate
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tim avatar image
Tim answered
I haven't experienced any issues with truncating tables with log shipping, however if you truncate your transaction log you will break log shipping. Quite possibly that is what someone else was warning you against.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image
KenJ answered
Besides truncating the transaction log that @TRAD mentioned, a few things that come right to mind are... * Don't place the primary database in the SIMPLE recovery model. * If the paths to the database files are different between the primary and secondary, don't [add files][1] * If you use Change Data Capture, you have to recreate CDC if you recover the secondary. KEEP_CDC and NORECOVERY are [mutually exclusive][2] restore options. * If you log ship a replicated database, the failover is not [straightforward][3] from a replication perspective [1]: http://ask.sqlservercentral.com/questions/2931/adding-a-datafile-to-a-log-shipping-primary [2]: http://connect.microsoft.com/SQLServer/feedback/details/587277/keep-cdc-conflicts-with-norecovery-and-standby-options#details [3]: http://msdn.microsoft.com/en-us/library/ms151224.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Håkan Winther avatar image
Håkan Winther answered
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Manikreddy avatar image
Manikreddy answered
Truncating table will not effect on logshipping database, it will propapages the changes to secondary. Truncate command is a minimally logged command which notes in the transactional log about dellocated data pages for that perticular table and the same will be shipped to secondary so you can perform traction of table. But trucation of log will breaks up the logshipping you need to reinitialize the secondary.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.