Home > Database > Mysql Tutorial > body text

查询SQL Server 2005数据库中数据库的最后备份日期

WBOY
Release: 2016-06-07 14:57:10
Original
1033 people have browsed it

在备份过程中的操作,SQLServer2005更新下列表: msdb.dbo.backupfile, msdb.dbo.backupmediaset, msdb.dbo.backupmediafamilyand msdb.dbo.backupset. 在这里,我们正在做的得到我们的数据库名,上次备份日期和备份之间的联接sys.sysdatabase和msdb.dbo.back

在备份过程中的操作,SQL Server 2005更新下列表:

    msdb.dbo.backupfile,
    msdb.dbo.backupmediaset ,
    msdb.dbo.backupmediafamily and
    msdb.dbo.backupset.

在这里,我们正在做的得到我们的数据库名,上次备份日期和备份之间的联接sys.sysdatabase和msdb.dbo.backupset。 sys.sysdatabase质疑,因为它包含的Microsoft SQL Server实例中的每个数据库一行。
SELECT a.Name AS DatabaseName,COALESCE(CONVERT(VARCHAR(12),MAX(b.backup_finish_date),101),'Not Yet Taken') AS LastBackUpDate,COALESCE(CONVERT(VARCHAR(12),MAX(b.user_name),101),'NA') AS TakenBy
FROM
sys.sysdatabases a
LEFT OUTER JOIN
msdb.dbo.backupset b
ON b.database_name=a.name
GROUP BY a.Name
ORDER BY a.Name
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template