Each of the options mentioned by trvishi would work, but has their own quirks :
- sp_help_rep_agent would still return a line for each database that has a configured RepAgent, even if the secondary truncation pointer is invalid.
- dbcc gettrunc() requires you to run it in the current database.
You can also use the syslogshold table in the master database. This table indicates the oldest active transaction in all the databases. If a secondary truncation pointer is enabled, there is a second "permanent" entry in this table that indicates it :
Code:
select * from master..syslogshold
where name = '$replication_truncation_point'
This will indicate something similar to this :
Code:
dbid reserved spid page xactid masterxactid starttime name xloid
----------- ----------- ----------- ----------- ------ ------------ --------- ---- -----------
6 0 0 4622313 0x000000000000 0x000000000000 Jun 17 2009 11:41AM $replication_truncation_point 0
5 0 0 73273 0x000000000000 0x000000000000 Jun 17 2009 11:42AM $replication_truncation_point 0
Using this also has it's own quirk.. A secondary truncation pointer can be active for a database, even if the Replication agent for it has not been configured with 'sp_config_rep_agent'.
Should this be the case, it's good to know that anyway, as the database will likely run out of transaction log at some point if data in it is being updated. In this case, the truncation point can be removed using :
Code:
use <database>
go
dbcc settrunc ('ltm', 'ignore')
go
If you frequently load production databases into test / development environments like we do, you might want to disable them as a rule anyway as part of your load procedure / script.