首页 > 其他 > 详细

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

时间:2014-08-11 20:36:52      阅读:339      评论:0      收藏:0      [点我收藏+]
--======================================================
--使用于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--查看备份还原需要的空间

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!