码迷,mamicode.com
首页 > 其他好文 > 详细

Backup--查看备份还原需要的空间

时间:2014-08-11 20:36:52      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   ar   div   log   size   

--======================================================
--使用于SQL SERVER 2008 和SQL SERVER 2008 R2
DECLARE @DatabBaseBakPath NVARCHAR(500)
SET @DatabBaseBakPath=备份路径

DECLARE @BakFileList2008 TABLE 
    (    LogicalName nvarchar(128)
        ,PhysicalName nvarchar(260)
        ,Type char(1)
        ,FileGroupName nvarchar(128)
        ,SIZE numeric(20,0)
        ,MaxSize numeric(20,0)
        ,FileID bigint
        ,CreateLSN numeric(25,0)
        ,DropLSN numeric(25,0) NULL
        ,UniqueID uniqueidentifier
        ,ReadOnlyLSN numeric(25,0) NULL
        ,ReadWriteLSN numeric(25,0) NULL
        ,BackupSizeInBytes bigint
        ,SourceBlockSize int
        ,FileGroupID int
        ,LogGroupGUID uniqueidentifier NULL
        ,DifferentialBaseLSN numeric(25,0) NULL
        ,DifferentialBaseGUID uniqueidentifier
        ,IsReadOnly bit
        ,IsPresent bit
        ,TDEThumbprint varbinary(32)
      )    
    
INSERT INTO @BakFileList2008        
EXEC sp_executesql NRestore FileListOnly From Disk=@DatabBaseBakPath
,N@DatabBaseBakPath nvarchar(260)
,@DatabBaseBakPath 

SELECT * 
FROM @BakFileList2008

 

--======================================================
--使用于SQL SERVER 2005
DECLARE @DatabBaseBakPath NVARCHAR(500)
SET @DatabBaseBakPath=备份路径

DECLARE @BakFileList2005 TABLE 
    (
         LogicalName nvarchar(128)
        ,PhysicalName nvarchar(260)
        ,Type char(1)
        ,FileGroupName nvarchar(128)
        ,SIZE numeric(20,0)
        ,MaxSize numeric(20,0)
        ,FileID bigint
        ,CreateLSN numeric(25,0)
        ,DropLSN numeric(25,0) NULL
        ,UniqueID uniqueidentifier
        ,ReadOnlyLSN numeric(25,0) NULL
        ,ReadWriteLSN numeric(25,0) NULL
        ,BackupSizeInBytes bigint
        ,SourceBlockSize int
        ,FileGroupID int
        ,LogGroupGUID uniqueidentifier NULL
        ,DifferentialBaseLSN numeric(25,0) NULL
        ,DifferentialBaseGUID uniqueidentifier
        ,IsReadOnly bit
        ,IsPresent bit
    )    

INSERT INTO @BakFileList2005      
EXEC sp_executesql NRestore FileListOnly From Disk=@DatabBaseBakPath
,N@DatabBaseBakPath nvarchar(260)
,@DatabBaseBakPath 
  

SELECT * 
FROM @BakFileList2005

 

Backup--查看备份还原需要的空间,布布扣,bubuko.com

Backup--查看备份还原需要的空间

标签:style   blog   color   使用   ar   div   log   size   

原文地址:http://www.cnblogs.com/TeyGao/p/3905155.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!