Find remaining time left for Backup or Restore using SQL Server

Execute the following query:

SELECT r. session_id,r .command, CONVERT(NUMERIC (6, 2),r .percent_complete)
 AS [Percent Complete],CONVERT( VARCHAR(20 ),DATEADD( ms,r .estimated_completion_time, GetDate()),20 ) AS [ETA Completion Time],
 CONVERT(NUMERIC (6, 2),r .total_elapsed_time/ 1000.0/60.0 ) AS [Elapsed Min],
 CONVERT(NUMERIC (6, 2),r .estimated_completion_time/ 1000.0/60.0 ) AS [ETA Min],
 CONVERT(NUMERIC (6, 2),r .estimated_completion_time/ 1000.0/60.0 /60.0) AS [ETA Hours],
 CONVERT(VARCHAR (100),( SELECT SUBSTRING (text, r.statement_start_offset /2,
 CASE WHEN r.statement_end_offset = - 1 THEN 1000 ELSE (r. statement_end_offset-r .statement_start_offset)/ 2 END)
 FROM sys .dm_exec_sql_text( sql_handle)))
 FROM sys .dm_exec_requests r WHERE command IN ('RESTORE DATABASE' ,'BACKUP DATABASE')

or this one:

SELECT percent_complete, start_time, status, command , estimated_completion_time as est_complete,
 (estimated_completion_time / 1000/60 /60/ 24) as Days ,
 ((estimated_completion_time / 1000/60 /60) % 24 ) as Hours,
 ((estimated_completion_time / 1000/60 ) % 60) as Mins,
 ((estimated_completion_time / 1000) % 60) as Secs,
 ((total_elapsed_time / 1000/60 ) % 60) as 'Total Elapsed Mins'
 FROM sys .dm_exec_requests
 WHERE percent_complete > 0
 ORDER BY start_time DESC

Check last database restore date/time using SQL Server

Use one of the following scripts.

The first script is quick and simple:

FROM MSDB..RestoreHistory WITH (nolock)
WHERE destination_database_name = DB_NAME()
ORDER BY restore_date DESC

The second script also shows the backup file used during the restore:

SELECT [rs].[destination_database_name],
[bs].[database_name] as [source_database_name],
[bmf].[physical_device_name] as [backup_file_used_for_restore]
FROM msdb..restorehistory rs
INNER JOIN msdb..backupset bs
ON [rs].[backup_set_id] = [bs].[backup_set_id]
INNER JOIN msdb..backupmediafamily bmf
ON [bs].[media_set_id] = [bmf].[media_set_id]
ORDER BY [rs].[restore_date] DESC


Get Current Database Names and IDs in SQL Server

-- Get Current DatabaseID
SELECT DB_ID() DatabaseID;

-- Get Current DatabaseName
SELECT DB_NAME() DatabaseName;

-- Get DatabaseName from DatabaseID

-- Get DatabaseID from DatabaseName
SELECT DB_ID('tempdb') DatabaseName;

-- Get all DatabaseName and DBID
SELECT name,database_id
FROM sys.databases;


Adding a new port to a HP Network Team


A port has died on your NIC and is showing as disconnected in your HP Network Team. The Network Team is no longer redundant.


You need to add a new port and drop the disconnected port, without affecting the overall settings:

[Read more…]

Differences between IISReset and Recycling Application Pools

I have just read an excellent post on the differences between IISReset and Recycling Application Pools.

Read the post here:

SNMP Enterprise Specific Trap (.11020)

Event ID 1182 Foundation Agent: A Change in the health status of the server has occurred.

cpqHoMibHealthStatusArrayChangeTrap – 11020 in CPQHOST.MIB


Multiple event ID 1182 messages do not affect the operation or functionality of the server and can be safely ignored.

A future release of the HP Insight Management Agents will prevent the same messages from being logged multiple times. Although it is unlikely, if the messages cause the Windows Event Log to fill up, the HP Insight Management Agents can be downgraded from version 9.10 to version 9.0 until the updated/future Insight Management Agents are released.

This advisory will be updated when additional information becomes available.


Task Scheduler failed to start task for user. Additional Data: Error Value: 2147943645


You scheduled a task, but it failed to run with Error Value: 2147943645

Log Name: Microsoft-Windows-TaskScheduler/Operational
Source: Microsoft-Windows-TaskScheduler
Date: 17/01/2013 04:00:00
Event ID: 101
Task Category: Task Start Failed
Level: Error
Computer: [removed]
Task Scheduler failed to start “\ServerReboot” task for user “DOMAIN\user”. Additional Data: Error Value: 2147943645.


This error occurs when the user which the task is run under only has permission to run it when logged in.

To allow the task to run when the user is logged on or not, select Run whether user is logged on or not, on the General Tab in the Task Properties:

Moving tempdb file location for SQL Server 2008 R2


You’ve ran out of disk space on the drive where the tempdb files are located.


You need to move the tempdb files to a new location with sufficient disk space.

  1. Execute the following query:
    USE master; GO
    MODIFY FILE (NAME = tempdev, FILENAME = '[new_path]\tempdb.mdf');
    MODIFY FILE (NAME = templog, FILENAME = '[new_path]\templog.ldf');
  2. Stop and restart the instance of SQL Server.
  3. Once the service has been restarted, verify the changes using this query:
    sp_helpdb tempdb


HP ProLiant Support Pack

ProLiant Support Packs (PSP) represent operating system (OS) specific bundles of optimized drivers, utilities, and management agents. These bundles are tested together to ensure proper installation and functionality. PSPs are released concurrently with HP’s SmartStart, and can also be released outside of the SmartStart cycle and made available on the HP ProLiant Support Pack download selection pages or at HP Insight Foundation website.

Each PSP consists of a deployment utility (HP Smart Update Manager), setup and software maintenance tools designed to provide an efficient way to manage routine software maintenance tasks. IT administrators can select PSP updates from a central software repository for deployment on local or remote servers, Windows or Linux. These deployment utilities remotely deploy driver and management agent updates to network attached servers and can be operated from an IT administrator’s workstation.

Downloads for each Operating System are here:

The current version (9.10) for Windows Server 2008 R2 is here:

Web Interface Logon and Application Launch Process for XenApp

Here’s a useful video explaining the logon process for XenApp via Web Interface: