SQL Server数据库上次更新日期时间

时间:2015-04-09 09:45:46

标签: sql sql-server database sql-scripts

是否有任何sql脚本可以找出上次更新SQL Server中的数据库的时间?

我想知道对数据库元数据所做更改的最后更新日期时间,而不是表中的实际数据。 特别是在:

  • 从数据库创建/删除任何新表。
  • 在数据库的表中添加/删除任何新列。
  • 在数据库中添加/更改任何新视图/存储过程/函数。

3 个答案:

答案 0 :(得分:21)

查看sys.objects就足够了,试试这个查询

 select * from sys.objects
order by modify_date desc

答案 1 :(得分:4)

这将返回上次修改日期时间+更新项目名称+描述更新内容(表格,存储过程等)

SELECT TOP 1 name, modify_date, type_desc
FROM  sys.objects
ORDER BY modify_date DESC

答案 2 :(得分:0)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manager name="Manager1" exportDate="2020-01-13-05:00" comment=" configuration from 0.0.0.0">
  <ChannelSet>
    <ChannelEntry>
      <ChannelAttributesEntry name="/Pub/Sub/commands" TTL="0" capacity="0" EID="15" clusterWide="true" jmsEngine="true" mergeEngine="false" type="RELIABLE_TYPE"/>
      <StorePropertiesEntry CacheOnReload="false" Priority="1"/>
      <ChannelPermissionSet>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="true" getLastEID="false" purgeEvents="false" subscribe="false" publish="false" useNamedSubcription="false" groupname="Admin Group"/>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" getLastEID="true" purgeEvents="false" subscribe="false" publish="true" useNamedSubcription="false" groupname="Web Group"/>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" getLastEID="true" purgeEvents="false" subscribe="true" publish="false" useNamedSubcription="false" groupname="Messenger Group"/>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="true" getLastEID="false" purgeEvents="false" subscribe="false" publish="false" useNamedSubcription="false" groupname="Retry Service Group"/>
      </ChannelPermissionSet>
    </ChannelEntry>
    <ChannelEntry>
      <StorePropertiesEntry CacheOnReload="false" Priority="1"/>
      <ChannelPermissionSet>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="true" getLastEID="false" purgeEvents="false" subscribe="false" publish="false" useNamedSubcription="false" groupname="Admin Group"/>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" getLastEID="true" purgeEvents="false" subscribe="true" publish="false" useNamedSubcription="true" groupname="Highland Group"/>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" getLastEID="true" purgeEvents="false" subscribe="false" publish="true" useNamedSubcription="false" groupname="Aus Group"/>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" getLastEID="true" purgeEvents="false" subscribe="false" publish="true" useNamedSubcription="false" groupname="Q Group"/>
        <ChannelGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="true" getLastEID="false" purgeEvents="false" subscribe="false" publish="false" useNamedSubcription="false" groupname="Retry Service Group"/>
      </ChannelPermissionSet>
    </ChannelEntry>
    <QueueSet>
      <QueueEntry>
        <ChannelAttributesEntry name="/3m/receive/events" TTL="0" capacity="0" EID="0" clusterWide="true" jmsEngine="false" mergeEngine="false" type="PERSISTENT_TYPE"/>
        <StorePropertiesEntry HonorCapacityWhenFull="false" CacheOnReload="false"/>
        <QueuePermissionSet>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="true" purge="false" peek="false" push="false" pop="false" groupname="Admin Group"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="false" push="true" pop="false" groupname="SBGroup"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="true" push="false" pop="false" groupname="SMS Admin"/>
          <QueueACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="false" push="true" pop="false" host="*" name="lijhlkjnlkjhlk"/>
          <QueueACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="true" push="true" pop="false" host="*" name="eeff456987987"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="false" push="false" pop="true" groupname="3m Group"/>
        </QueuePermissionSet>
      </QueueEntry>
      <QueueEntry>
        <ChannelAttributesEntry name="/7m/receive/fault/events" TTL="0" capacity="0" EID="0" clusterWide="true" jmsEngine="false" mergeEngine="false" type="PERSISTENT_TYPE"/>
        <StorePropertiesEntry CacheOnReload="false"/>
        <QueuePermissionSet>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="true" purge="false" peek="false" push="false" pop="false" groupname="Admin Group"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="false" push="true" pop="false" groupname="SBGroup"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="true" push="false" pop="false" groupname="SMS Admin"/>
        </QueuePermissionSet>
      </QueueEntry>
      <QueueEntry>
        <ChannelAttributesEntry name="/Orchestration/bigData/fault/gen" TTL="0" capacity="0" EID="0" clusterWide="true" jmsEngine="false" mergeEngine="false" type="PERSISTENT_TYPE"/>
        <StorePropertiesEntry CacheOnReload="false"/>
        <QueuePermissionSet>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="true" purge="false" peek="false" push="false" pop="false" groupname="Admin Group"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="false" push="true" pop="false" groupname="SBGroup"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="true" push="false" pop="false" groupname="SMS Admin"/>
          <QueueGroupACLEntry listACLEntries="false" modifyACLEntries="false" fullControl="false" purge="false" peek="false" push="true" pop="false" groupname="Big Data Group"/>
        </QueuePermissionSet>
      </QueueEntry>
    </QueueSet>
  </ChannelSet>
</Manager>