Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
niks
Starting Member
9 Posts |
Posted - 2012-08-09 : 02:10:42
|
Dear,
I need script that i can configure as a daily alert, I need to compare database i replicated. I want to compare Raw count, i have one query as bellow but my problem it how to compare it from two differ database server. 1) Server Name : ABC Database is : XYZ 2) Server Name : DEF Database is : XYZ
i am hving script as bellow
use ABC
CREATE TABLE #temp ( table_name sysname , row_count INT, reserved_size VARCHAR(50), data_size VARCHAR(50), index_size VARCHAR(50), unused_size VARCHAR(50)) SET NOCOUNT ON INSERT #temp EXEC sp_msforeachtable 'sp_spaceused ''?''' SELECT a.table_name, a.row_count, COUNT(*) AS col_count, a.data_size FROM #temp a INNER JOIN information_schema.columns b ON a.table_name collate database_default = b.table_name collate database_default where a.table_name not in (SELECT
art.name as [Article] FROM dbo.syssubscriptions sub INNER JOIN sys.servers serv ON serv.server_id = sub.srvid INNER JOIN dbo.sysarticles art ON art.artid = sub.artid INNER JOIN dbo.syspublications pub ON pub.pubid = art.pubid ) GROUP BY a.table_name, a.row_count, a.data_size order by row_count
drop table #temp
Regds Niks |
|
|
|
|