LogShipping:Removing log shipping history after dr drill


Removing Job history after DR-DRILL:

1After removing log shipping of the database and its respective job but the job still runs, it showing latency job on another server

Command to monitor LogShipping:






select secondary_database as DBNAME

last_restored_date as [LAST RESTORE DATE]

DATEDIFF(minute

case

when

DATEDIFF(minute

, last_restored_date

, last_restored_date

,

,

, primary_server as [PRIMARY SERVER]

GETDATE()) AS LATENCY

,

,

GETDATE()) < 60

,then 'SYNCHRONIZED'

else 'UNSYNCHRONIZED'

end

as [LOGSHIPPING STATUS]

from msdb

go

sp_help_log_shipping_monitor

select secondary_database as DBNAME

case

when

DATEDIFF(minute

then 'SYNCHRONIZED'

else 'UNSYNCHRONIZED'

end

as [LOGSHIPPING STATUS]

from msdb

go
The following disabled job are useless:
Delete job manually:

-Do you want to delete the selected jobs?
Yes

Before doing any changes first back up log shipping tables:

To make backup of table
--select * into msdb..log_shipping_monitor_primary_cp
--from msdb..log_shipping_monitor_primary

To get primary job id:


select * from msdb..log_shipping_monitor_primary

To remove primary job history:

--DELETE FROM msdb..log_shipping_monitor_primary WHERE primary_id ='3D8CA04C-4675-499D-
97E2-F5F31793644B'


And verify backup table rows with original table rows:

Then check and verify last backup date time threshold on both servers:

The left server on above is having huge threshold and its backup job is removed already. To remove it we get primary id from following query:
Update table by removing the primary id of above job:

On secondary server check last copy & restore times also to verify that copy and restore job secondary id:

Backup table secondary:
--select * into msdb..log_shipping_monitor_secondary_cp
--FROM msdb..log_shipping_monitor_secondary

Verify backup:
SELECT *
FROM msdb..log_shipping_monitor_secondary_cp

To Get Secondary job id:

SELECT *
FROM msdb..log_shipping_monitor_secondary


To delete job history from secondary server:

--DELETE FROM msdb..log_shipping_monitor_secondary WHERE secondary_id ='23AD6087-4A91-4A5E-BE3C-9447145BB2E7'
Delete the job from secondary server by verifying its id:

Name

Azure Backup Database Clustering Crash Dumps DBCC Deadlock Link Server Log Shipping Maintenance Migration Mirroring Monitoring Performance Tuning Permissions Post Installations Prerequisites Replication Restore Database SQL Installations SQL on Linux SQL Uninstallations SSIS T-SQL Windows Server
false
ltr
item
hybriddba.blogspot.com: LogShipping:Removing log shipping history after dr drill
LogShipping:Removing log shipping history after dr drill
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnrh0JDH5-eLZR1V69yZyMKbbFNtrHyYCQRLZISjdseeIiAv9THpMvJ3zY4YzHje5b3k1cCTiBO3ujt7EKfMw314mykYuX8AIKxdUWBC4y_cmFVOM0CRH0hHKd5JwhP_KmHzGjWw9n3rp2/s1600/1580320194076639-0.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnrh0JDH5-eLZR1V69yZyMKbbFNtrHyYCQRLZISjdseeIiAv9THpMvJ3zY4YzHje5b3k1cCTiBO3ujt7EKfMw314mykYuX8AIKxdUWBC4y_cmFVOM0CRH0hHKd5JwhP_KmHzGjWw9n3rp2/s72-c/1580320194076639-0.png
hybriddba.blogspot.com
https://hybriddba.blogspot.com/2019/09/logshippingremoving-log-shipping.html
https://hybriddba.blogspot.com/
https://hybriddba.blogspot.com/
https://hybriddba.blogspot.com/2019/09/logshippingremoving-log-shipping.html
true
7679493960263860249
UTF-8
Not found any posts Not found any related posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU Tag ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Contents See also related Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy