Categoria: SqlServer
SELECT s.[name] AS [schema], t.[name] AS [table_name], p.[rows] AS [row_count], CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS [size_mb], CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS [used_mb], CAST(ROUND(((SUM(a.total_pages) – SUM(a.used_pages)) * 8) / 1024.00, 2) AS NUMERIC(36,...
ALTER DATABASE xxxxx SET EMERGENCY;GO ALTER DATABASE xxxxx set single_userGO DBCC CHECKDB (xxxxx , REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;GO ALTER DATABASE xxxxx set multi_userGO...
RESTORE DATABASE [database_name] WITH RECOVERY Referencia: https://www.mssqltips.com/sqlservertip/5460/sql-server-database-stuck-in-restoring-state/...
DBCC DROPCLEANBUFFERSDBCC FREEPROCCACHE...
SELECT session_id, wait_duration_ms, wait_type, blocking_session_id FROM sys.dm_os_waiting_tasks WHERE blocking_session_id <> 0...
SELECT sqltext.TEXT,req.session_id,req.status,req.command,req.cpu_time,req.total_elapsed_time,start_time,right(convert(varchar,dateadd(ms, datediff(ms, start_time, getdate()), ‘1900-01-01’),121), 12) as ‘batch_duration1’,wait_timeFROM sys.dm_exec_requests reqCROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext...