average percent of growth

  • Which script will you like to run?

  • i got this from this article http://www.mssqltips.com/tip.asp?tip=1426

    DECLARE @DBInfo TABLE

    ( ServerName VARCHAR(100),

    DatabaseName VARCHAR(100),

    FileSizeMB INT,

    LogicalFileName sysname,

    PhysicalFileName NVARCHAR(520),

    Status sysname,

    Updateability sysname,

    RecoveryMode sysname,

    FreeSpaceMB INT,

    FreeSpacePct VARCHAR(7),

    FreeSpacePages INT,

    PollDate datetime)

    DECLARE @command VARCHAR(5000)

    SELECT @command = 'Use [' + '?' + '] SELECT

    @@servername as ServerName,

    ' + '''' + '?' + '''' + ' AS DatabaseName,

    CAST(sysfiles.size/128.0 AS int) AS FileSize,

    sysfiles.name AS LogicalFileName, sysfiles.filename AS PhysicalFileName,

    CONVERT(sysname,DatabasePropertyEx(''?'',''Status'')) AS Status,

    CONVERT(sysname,DatabasePropertyEx(''?'',''Updateability'')) AS Updateability,

    CONVERT(sysname,DatabasePropertyEx(''?'',''Recovery'')) AS RecoveryMode,

    CAST(sysfiles.size/128.0 - CAST(FILEPROPERTY(sysfiles.name, ' + '''' +

    'SpaceUsed' + '''' + ' ) AS int)/128.0 AS int) AS FreeSpaceMB,

    CAST(100 * (CAST (((sysfiles.size/128.0 -CAST(FILEPROPERTY(sysfiles.name,

    ' + '''' + 'SpaceUsed' + '''' + ' ) AS int)/128.0)/(sysfiles.size/128.0))

    AS decimal(4,2))) AS varchar(8)) + ' + '''' + '%' + '''' + ' AS FreeSpacePct,

    GETDATE() as PollDate FROM dbo.sysfiles'

    INSERT INTO @DBInfo

    (ServerName,

    DatabaseName,

    FileSizeMB,

    LogicalFileName,

    PhysicalFileName,

    Status,

    Updateability,

    RecoveryMode,

    FreeSpaceMB,

    FreeSpacePct,

    PollDate)

    EXEC sp_MSForEachDB @command

    SELECT

    ServerName,

    DatabaseName,

    FileSizeMB,

    LogicalFileName,

    PhysicalFileName,

    Status,

    Updateability,

    RecoveryMode,

    FreeSpaceMB,

    FreeSpacePct,

    PollDate

    FROM @DBInfo

    ORDER BY

    ServerName,

    DatabaseName

    but i have multiple servers in which i would like to get this information from

  • I think that it should not be a problem you will have to use a for each loop like in the SSIS package from the artikel(http://qa.sqlservercentral.com/articles/Integration+Services/61774/). In the foreach loop you will read the server from a table an then apply the script. If you have any questions I will like to help.

    good luck!

  • hi Ignacio, i am trying to do what the article says to be able to get the information from the other servers but the problem is that my other servers are in the network but not a part of the domain, can you tell me of how to it?

  • I think you should try to connect using the ip address from the servers and an sql account. Let me know if that helps.

    Good luck!

  • in the article it says to create an ssis package, would you happen to you the steps? can i use the export/import wizard? do i put the code in a sp? how do i use it against my other servers?

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply