September 21, 2010 at 11:34 am
Is there any possible way of finding recently updated/accessed database in particular database server?:unsure: If so can anyone share the scripts.I am new to this administaration
September 21, 2010 at 12:20 pm
Do you mean you want to know what database was most recently queried from (or to)?
In that case, you could do something like this:
SELECT TOP 10
dest.text,
deqs.last_execution_time,
d.name
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
JOIN sys.databases AS d
ON dest.dbid = d.database_id
ORDER BY last_execution_time DESC
But the real question is, what do you need it for? What are you trying to do?
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
September 21, 2010 at 1:07 pm
Grant,
Would the default trace be a good choice here to persist data across restarts?
-Dan B
September 21, 2010 at 1:23 pm
skrilla99 (9/21/2010)
Grant,Would the default trace be a good choice here to persist data across restarts?
-Dan B
I guess it depends on what's being looked for. The Default Trace doesn't store DML, so it wouldn't necessarily show the kind of stuff I offered earlier (not that what I showed was the be all, just an example). The Default trace will show DDL changes and some connection info... maybe... I'm just not sure what we're looking for here.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply