服务器上每天有一个job执行数据库备份。(这个job有很多其他步骤,数据备份只是其中一步)
例如,会将备份的数据放在D\BackDB\DB.bat,有什么办法可以得知数据库最后备份完的时间。

解决方案 »

  1.   

    就看下这个D\BackDB\DB.bat的文件修改日期
      

  2.   


    可以通过下面语句只是该备份文档的备份信息
    Restore filelistonly from disk='d:\backup\BIL\BIL_Full071009.bak'
      

  3.   

      数据库的强项不是搞这个的。 这个 看看 http://www.cnblogs.com/RobotTech/archive/2008/02/13/1067905.html
      

  4.   

    我查看了连接,使用存储过程可以实现我要的结果。因为数据库不是我们的,所以我们只能查看,不能再数据中新增任何表以及存储过程。不知道是否有人可以将如下代码转换sql语句。/*
      获取文件最后访问日期
      @filepath   文件路径,如:   c:\1.txt
      @filedate   文件最后访问日期  调用示例:
      declare   @dt   varchar(20)
      exec   getFileLastAccessDate   'c:\1.txt',@dt   output
      select   @dt
    */
    create   procedure   getFileLastAccessDate
      @filepath   varchar(4000),
      @filedate   varchar(20)   output
    as
      declare   @obj   int,@file   int
      declare   @fileexists   varchar(10)
      exec   sp_oacreate   'Scripting.FileSystemObject',@obj   output
      exec   sp_oamethod   @obj,'FileExists',@fileexists   output,@filepath
      if   @fileexists='False'
      begin
        set   @filedate='文件不存在'
        return
      end
      exec   sp_oamethod   @obj,'GetFile',@file   output,@filepath
      exec   sp_oagetproperty   @file,'DateLastAccessed',@filedate   output