Use the follwing SQL:
USE
DatabaseName
GO
-- Get Backup History for required database
SELECT TOP 100
s.database_name,
m.physical_device_name,
CAST(CAST(s.backup_size / 1000000 AS INT) AS VARCHAR(14)) + ' ' + 'MB' AS bkSize,
CAST(DATEDIFF(second, s.backup_start_date,
s.backup_finish_date) AS VARCHAR(4)) + ' ' + 'Seconds' TimeTaken,
s.backup_start_date,
CAST(s.first_lsn AS VARCHAR(50)) AS first_lsn,
CAST(s.last_lsn AS VARCHAR(50)) AS last_lsn,
CASE s.[type]
WHEN 'D' THEN 'Full'
WHEN 'I' THEN 'Differential'
WHEN 'L' THEN 'Transaction Log'
END AS BackupType,
s.server_name,
s.recovery_model
FROM msdb.dbo.backupset s
INNER JOIN msdb.dbo.backupmediafamily m ON s.media_set_id = m.media_set_id
WHERE s.database_name = DB_NAME() -- Remove this line for all the database
ORDER BY backup_start_date DESC, backup_finish_date
GO
Taken from Pinal D: http://blog.sqlauthority.com/2010/11/10/sql-server-get-database-backup-history-for-a-single-database/
Friday, 26 June 2015
Subscribe to:
Post Comments (Atom)
Updating massive amount of rows whilst avoiding blocking
The following SQL is a good means to split an update on a massive table into smaller chunks, whilst reducing blocking. The method is to upda...
-
Microsoft Distributed Transaction Coordinator (abbreviated to MSDTC, or DTC) is usually very quick and simple to set up. However, it isn...
-
Migrations between SQL Servers can be laborious, and doing them manually leaves a lot of room for human error. Scripting a migration using t...
-
Scheduling SSIS packages from SQL Agent can produce the following error on a new installation of SQL Server: “Connecting to the Integration...
No comments:
Post a Comment