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,
 cpu_time,
 ((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:

SELECT *
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],
[rs].[restore_date],
[bs].[backup_start_date],
[bs].[backup_finish_date],
[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

Source:

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
SELECT DB_NAME(4) DatabaseID;

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

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

Sourcehttp://blog.sqlauthority.com/2011/01/13/sql-server-a-quick-note-on-db_id-and-db_name-get-current-database-id-get-current-database-name/

Adding a new port to a HP Network Team

Problem

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

Solution

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: http://fullsocrates.wordpress.com/2012/07/25/iisreset-vs-recycling-application-pools/

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

RESOLUTION

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.

Source

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

Problem

You scheduled a task, but it failed to run with Error Value: 2147943645
Task-Scheduler-Failed-2147943645_001

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
Keywords:
User: SYSTEM
Computer: [removed]
Description:
Task Scheduler failed to start “\ServerReboot” task for user “DOMAIN\user”. Additional Data: Error Value: 2147943645.

Solution

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:
Task-Scheduler-Failed-2147943645_002

Moving tempdb file location for SQL Server 2008 R2

Problem

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

Solution

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

  1. Execute the following query:
    USE master; GO
    ALTER DATABASE tempdb
    MODIFY FILE (NAME = tempdev, FILENAME = '[new_path]\tempdb.mdf');
    GO
    ALTER DATABASE tempdb
    MODIFY FILE (NAME = templog, FILENAME = '[new_path]\templog.ldf');
    GO
  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

Reference

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: http://h20000.www2.hp.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=3716247&lang=en&cc=us&taskId=135&prodTypeId=18964&prodSeriesId=3716246

The current version (9.10) for Windows Server 2008 R2 is here: http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareIndex.jsp?lang=en&cc=us&prodNameId=3716247&prodTypeId=18964&prodSeriesId=3716246&swLang=8&taskId=135&swEnvOID=4064

Web Interface Logon and Application Launch Process for XenApp

Here’s a useful video explaining the logon process for XenApp via Web Interface: http://support.citrix.com/article/CTX129589