今日二三事

  • 查詢執行個體內,資料庫曾做的備份

select * from
msdb.dbo.backupmediafamily 
   INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id 

 

  • 重設狀態為 suspect 的資料庫,設好後要重啟 SQL Server Services

exec sp_resetstatus ‘資料庫名稱’

 

  • 取得磁碟空間小於 n GBytes 的本機磁碟

CREATE PROC sp @g INT
AS
    DECLARE @t TABLE(drive CHAR(1),Spaces INT)
    INSERT @t EXEC master..xp_fixeddrives
    UPDATE @t SET Spaces=Spaces/1024
    SELECT * FROM @t WHERE Spaces<@g

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: