DECLARE @DBNAME VARCHAR(128) SET @DBNAME = 'DB_Name' SELECT TOP 5 A.database_name ,B.physical_device_name ,A.media_set_id ,A.backup_size ,A.backup_start_date ,A.backup_finish_date FROM msdb.dbo.backupset A INNER JOIN msdb.dbo.backupmediafamily B ON A.media_set_id = B.media_set_id WHERE A.Database_Name= @DBNAME ORDER BY A.backup_finish_date DESC
This blog contains information related to Microsoft SQL Server and Oracle Administration: Installation, Configuration, Maintenance and Troubleshooting.
9/12/2012
List of recent database backups
Usually we need to find list of recent database backups. When the backup was taken and where it was saved. Below script will get a 5 recent backups
Labels:
ALTER DATABASE MODIFY FILE,
Attach,
Audit,
Backup history,
Boston DBA,
database backups,
list of recent database backups,
SQL Server 2008,
SQLCMD,
sys.database_principals,
T-SQL,
Troubleshooting
Location:
Boston, MA, USA
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment