I stare at this query which is getting more confusing in a stored process.
I have a table that looks like this ...
AsofDate Database_Name Mirroring_Sate date time Database1 synced date time Database2 Suspended date time Database3 disconnected date time Database1 synced Date Time Database2 Synced Date Time Database3 Disconnected Date Time Database1 Synced Date Time Database2 Synced Date Time Database3 Disconnected
So I have a job that is available in this table The T-mirror runs for 3 databases every 15 minutes and records it. I need a query that will be for 3 consecutive tests for any one database name if the mirroring position is not equal to synchronize.
For example if the database 1 on 3, then 3.15 pm, then at 3.30 a disconnect state, it needs to know me. At this time what I am doing is looking at the entire table and if any other state in the synchronized state has a database of 3 or more, then I am taking an acine which is what I want. I only want to do this for the last 3 tests and that's all.
Here is my query as it stands.
if present (with dbo.U_MirroringStatus Selection 1 (NOLOCK) where mirroring_state_desc & lt; & gt; by having Database_Name having COUNT (*) & gt; synchronized 'group; = @MirroringStatusViolationCountForAlert )
Any help / advice would be great. thank you in advanced.
It probably will do something that you want:
if present Where (select from top 3 ms * with dbo.U_MirroringStatus (NOLOCK) Where is Database_Name = @DatabaseName by OrderAsOfDate DESC) Where is mrroring_state_desc from MS. & Gt; COUNT (*) & gt; Synchronize '; = @MirroringStatusViolationCountForAlert)
You specify this, you want this for a single database, due to which I said where
Comments
Post a Comment