Site sponsored by: Idera Try Idera’s new SQL admin toolset
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share you SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Policy Based Management in SQL Server 2008
Inside SQL Server Cluster Setup and Troubleshooting Techniques - Part I ...
Configure and Manage Policy Based Management in SQL Server 2008 ...
Using Column Sets with Sparse Columns

More     
 
Latest FAQ's

Cannot Start SQL Server Service
Users are able to connect to report manager but not able ...
Errors when SQL Server Snapshot Replication is Running
How to Display Server Name or IP Address in a Reporting ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> general dba >> Monitor Your Database Servers with DTS, Part ...

Monitor Your Database Servers with DTS, Part 3: Space Monitoring of SQL Servers

By : Neeraj Nagpal
Mar 04, 2006

Page 2 / 3

A sample space monitoring report is shown below.

Report Generation Date
----------------------
Dec 13 2005 4:53PM

The following SQL Server databases have less than 10% free data space
------------------------------------------------------------------------

Server Name   Database   Total space(MB)   Free space(MB)   % Free space
-----------   --------   ---------------   --------------   ------------
Server1       dbamaint   2.0               0.1              5.000000
Server5       dbamaint   2.0               0.1              5.000000
Server10      gpdb       3000.0            145.1            4.836666
Server20      BWQ        42694.8           517.4            9.211857

How Do You Add a New Server to the Script?

  1. Execute the following script on the server that has to be monitored.

    if not exists(select * from master..sysdatabases where name='dbamaint')
    create database dbamaint
    go
    alter database dbamaint
    set RECOVERY SIMPLE
    go

    use dbamaint
    go

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[filespacestats]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[filespacestats]
    GO

    CREATE TABLE [dbo].[filespacestats] (
    [server_name] [sysname] NOT NULL ,
    [dbname] [sysname] NOT NULL ,
    [flag] [bit] NULL ,
    [Fileid] [tinyint] NULL ,
    [FileGroup] [tinyint] NULL ,
    [total_space] [decimal](7, 1) NULL ,
    [usedspace] [decimal](7, 1) NULL ,
    [freespace] [decimal](7, 1) NULL ,
    [freepct] [decimal](7, 1) NULL ,
    [Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [FileName] [sysname] NULL ,
    [report_date] [datetime] NULL
    ) ON [PRIMARY]
    GO

    ALTER TABLE [dbo].[filespacestats] ADD
    CONSTRAINT [DF__filespace__repor__1332DBDC] DEFAULT (getdate()) FOR [report_date]
    GO


    This would create the database "dbamaint" on the server and the table "filespacestats" in "dbamaint."
  2. Login to the SQLSRVCNTREP server and open SQL Server Enterprise Manager Console. Navigate to the Data Transformation Services (DTS) > Local Packages tab. Double click the SPACE_MON package to edit it. After opening the DTS package, create a connection to the target server.

  3. Enter the details for the new server as shown below. Select the authentication method to connect to the database. Select the "dbamaint" database. Click on OK to proceed.

  4. Now we need to create a "Transform Data task" as shown below.



    Once the icon is clicked, it prompts you to select the source server. Please select the newly created connection as the source server. Select the destination server as SQLSRVCNTREP. A link will be established between the two servers. Right click on the link and select Properties to see the Transform Data Task Properties as shown below.



    Select the SQL Query option and paste the following query to the SQL space provided there.

    select * from dbamaint.dbo.filespacestats order by flag ,report_date desc


<< Prev Page     Next Page>>    








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved