April 6, 2017 at 1:28 pm
Need scripts for below request:
a)Find the new databases created last 24hrs.
b) Find SQL servers uptime last 24hrs.
3) Job failures for particular job in last 24hrs.
Will be running the above requested queries in central management servers to get info across all servers.
April 6, 2017 at 2:06 pm
psred - Thursday, April 6, 2017 1:28 PMNeed scripts for below request:
a)Find the new databases created last 24hrs.
b) Find SQL servers uptime last 24hrs.
3) Job failures for particular job in last 24hrs.Will be running the above requested queries in central management servers to get info across all servers.
So, basically, you're asking people on this forum to do all of your work for you, without you providing any indication that you have even tried?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
April 6, 2017 at 2:31 pm
i'll help with the slightly more difficult one(#2)
for number 1, sys.databases has a create_date column.
for #2, i put this together, and it returns serveruptime, vs service uptime.select
DATEADD(second, -1 * ( ms_ticks / 1000),getdate()) as ServerRestartTime,
i.sqlserver_start_time As ServiceRestartTime,
DATEDIFF(dd,i.sqlserver_start_time,GETDATE()) AS ServiceUpTimeInDays,
DATEDIFF(dd,DATEADD(second, -1 * ( ms_ticks / 1000),getdate()),GETDATE()) AS ServerUpTimeInDays
from sys.dm_os_sys_info i;
for #3, there's plenty of searchable examples for failed jobs...search the submitted scripts section here for a huge array of examples
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply