我需要找到修改特定存储过程的人员的用户名。
如何确定存储过程在Oracle中的最后修改或编译时间?
给我关于时间的想法。但是我怎么知道修改它的用户?
这可以通过运行以下任何查询来实现。
SELECT [procedure] = QUOTENAME(OBJECT_SCHEMA_NAME([object_id])) + '.' + QUOTENAME(OBJECT_NAME([object_id])), last_execution_time, avg_execution_time = CONVERT(DECIMAL(30,2), total_worker_time * 1.0 / execution_count), max_worker_time FROM sys.dm_exec_procedure_stats WHERE database_id = DB_ID() ORDER BY avg_execution_time DESC;
- - - - - - 或者 - - - - - - - - - - - - - - - - - - - –
SELECT COALESCE(DB_NAME(t.[dbid]),'Unknown') AS [DB Name], ecp.objtype AS [Object Type], t.[text] AS [Adhoc Batch or Object Call], SUBSTRING(t.[text], (qs.[statement_start_offset]/2) + 1, ((CASE qs.[statement_end_offset] WHEN -1 THEN DATALENGTH(t.[text]) ELSE qs.[statement_end_offset] END - qs.[statement_start_offset])/2) + 1) AS [Executed Statement] ,qs.[last_execution_time] AS [Last Exec Time] ,qs.[creation_time] AS [Creation Time] FROM sys.dm_exec_query_stats AS qs JOIN sys.dm_exec_cached_plans ecp ON qs.plan_handle = ecp.plan_handle CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS t where ecp.objtype = 'Proc' order by [Last Exec Time] desc