Sunday, September 22, 2013

The SQL Server (MSSQLSERVER) service terminated with service-specific error %%17058.

While trying to failover the SQL server to another node, it refused to start and this error was getting logged in the Event Viewer

The SQL Server (MSSQLSERVER) service terminated with service-specific error %%17058.
The problem turned out to be with ERRORLOG being set to read only.

After I cleared the read only attribute from MSSQL\LOG\ERRORLOG the service started successfully.

Tuesday, April 2, 2013

Top SQL Queries

select
highest_cpu_queries.plan_handle,
highest_cpu_queries.total_worker_time,
highest_cpu_queries.total_logical_reads,
highest_cpu_queries.total_logical_writes,
highest_cpu_queries.execution_count,
q.dbid,
q.objectid,
q.number,
q.encrypted,
q.[text]
from
(select top 20
qs.plan_handle,
qs.total_worker_time,
qs.total_logical_reads,
qs.total_logical_writes,
qs.execution_count
from
sys.dm_exec_query_stats qs
order by qs.total_worker_time desc) as highest_cpu_queries
cross apply sys.dm_exec_sql_text(plan_handle) as q
order by highest_cpu_queries.total_worker_time desc
--order by highest_cpu_queries.total_logical_reads desc
--order by highest_cpu_queries.total_logical_writes desc
--order by highest_cpu_queries.execution_count desc

--select top 10 * from sys.dm_exec_query_stats qs

Thursday, March 28, 2013

Converting IIS logs time from UTC to local time

If you notice that the time logged in IIS logs does not match your server's local time, this is because IIS logs time in UTC (GMT) to conform with the W3C log format so if you are in a different time zone for example UTC -3 you will find the time 3 hours ahead in the logs.

To change that, you can choose a different log format from the IIS manager or you can convert the log file using Log Parser.

Download and install Log Parser then run the following command

LogParser.exe "SELECT DATE,TO_LOCALTIME(time) AS time,s-ip,cs-method,cs-uri-stem,cs-uri-query,s-port,cs-username,c-ip,cs(User-Agent),sc-status,sc-substatus,sc-win32-status,time-taken INTO c:\ayman\output.log FROM c:\ayman\input.log" -i:IISW3C -o:W3C

 

Wednesday, March 27, 2013

Check for TempDB PAGELATCH waits

SELECT

session_id,

wait_type,

wait_duration_ms,

blocking_session_id,

resource_description,

ResourceType = CASE

WHEN PageID = 1 OR PageID % 8088 = 0 THEN 'Is PFS Page'

WHEN PageID = 2 OR PageID % 511232 = 0 THEN 'Is GAM Page'

WHEN PageID = 3 OR (PageID - 1) % 511232 = 0 THEN 'Is SGAM Page'

ELSE 'Is Not PFS, GAM, or SGAM page'

END

FROM ( SELECT

session_id,

wait_type,

wait_duration_ms,

blocking_session_id,

resource_description,

CAST(RIGHT(resource_description, LEN(resource_description)

- CHARINDEX(':', resource_description, 3)) AS INT) AS PageID

FROM sys.dm_os_waiting_tasks

WHERE wait_type LIKE 'PAGE%LATCH_%'

AND resource_description LIKE '2:%') AS tab;

Tuesday, March 26, 2013

This Web Part requires at least Microsoft Internet Explorer 7.0

After installing internet explorer 10, PWA broke with this error message

This Web Part requires at least Microsoft Internet Explorer 7.0. For more information, contact your Project Server Administrator.


Adding the website to the compatibility view list solves the problem. Tools -> Compatibility view settings

 

Thursday, January 10, 2013

Configuring OpenVas on BackTrack 5 R3

BackTrack is a pentest linux distribution, download live cd from here, it contains the open source security scanner OpenVAS.
Below are the configuration steps required after booting BackTrack 5 R3 to get OpenVAS running.

ERROR: The number of NVTs in the OpenVAS Manager database is too low

I was setting up OpenVas on BackTrack 5 R3 and got stuck at his error.

ERROR: The number of NVTs in the OpenVAS Manager database is too low