Como verificar os logs de application pool shutdown e aumentar o idle timeout

Para verificar os logs de application pool shutdown, no Event Viewer do Windows, filtre os logs por source “WAS”.

Para aumentar o idle timeout de um application pool, no IIS Manager selecione Application Pools, selecione o pool que deseja configurar, clique em Advanced Settings e configure um valor maior para a propriedade Idle Time-out (minutes).

http://stackoverflow.com/questions/9984604/how-to-find-app-pool-recycles-in-event-log

http://technet.microsoft.com/en-us/library/cc771956%28v=ws.10%29.aspx

Como listar tabelas e Stored Procedures não utilizadas

Tabelas

USE banco
GO

SELECT t.[name] AS 'Table'
    ,SUM(i.user_seeks + i.user_scans + i.user_lookups) AS 'Total accesses'
    ,SUM(i.user_seeks) AS 'Seeks'
    ,SUM(i.user_scans) AS 'Scans'
    ,SUM(i.user_lookups) AS 'Lookups'
FROM sys.dm_db_index_usage_stats i
RIGHT JOIN sys.tables t
    ON (t.object_id = i.object_id)
GROUP BY i.object_id
    ,t.[name]
ORDER BY [Total accesses]

Stored Procedures

Note que a view dm_exec_procedure_stats retorna somente as procedures que estão em cache. Portanto, procedures que foram executadas recentemente mas saíram do cache podem aparecer como não executadas. Indico analisar várias vezes antes de apagar.

USE banco
GO

SELECT sc.[name]
    ,p.[name]
    ,st.last_execution_time
FROM sys.procedures AS p
JOIN sys.schemas AS sc
    ON p.[schema_id] = sc.[schema_id]
LEFT JOIN sys.dm_exec_procedure_stats AS st
    ON p.[object_id] = st.[object_id]
ORDER BY st.last_execution_time
    ,p.[name]

http://stackoverflow.com/questions/290773/identifying-unused-objects-in-microsoft-sql-server-2005
http://stackoverflow.com/questions/10421439/tsql-query-to-find-un-used-stored-procedures

Why should casting be avoided?

A cast (obviously enough) means you’re converting something from one type to another. When/if you do that, it raises the question “Why?” If you really want something to be a particular type, why didn’t you define it to be that type to start with? That’s not to say there’s never a reason to do such a conversion, but anytime it happens, it should prompt the question of whether you could re-design the code so the correct type was used throughout.

http://stackoverflow.com/questions/4167304/why-should-casting-be-avoided