Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009
    Posts
    22

    Red face Unanswered: New DBA in deep end

    I need to know if there are (dynamic?) scripts that will run on any database (i.e. with dynamic parameters that doesn’t require one changing anything, the script/stored proc should find the variables in the script from the variables it needs on each system).
    For eg. I need a scrypt as a start that I can run on a client system that will automatically find the system’s server, smtp, etc. .and whatever else’s needed and send an alert to my mail address for something like system usage over 80 percent.

    OR perhaps someone can let me know which system stored procedure will be able to do something similar

  2. #2
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    What constitutes system usage ?

    HD space ?
    CPU Utilization ?

    Products like SiteScope for one, and there are plenty of scripts available for monitoring other resources, and for email capabilities, set up DBMail or script it out via shell scripts and use SendEMail.exe, etc.

    There are many things out there to do what you want to do.

  3. #3
    Join Date
    Aug 2009
    Posts
    22
    Thanks PMASched, but I know how to setup DBMail etc via the SSMS GUI, but my boss wants me to do all through using the SQLCMD utility.
    I have to admit that I am very newly qualified (ie JUNIOR dba) and T-SQL very basically covered in the course. So much of the more complicated queries still leave me flabbergasted. Needless to say to write one query with input variables that'll find for eg the server name, smtp server etc., then find errors or diskspace running below 10% and then still send an email,is by my current point-of-view pretty advanced.. He basically wants me to find 'template' scripts with variables that can be used at any clients I need to go see without neccessitating the use of SSMS or any other GUI's.
    Any thoughts?

  4. #4
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Quote Originally Posted by Paradigm9
    Thanks PMASched, but I know how to setup DBMail etc via the SSMS GUI, but my boss wants me to do all through using the SQLCMD utility.
    I have to admit that I am very newly qualified (ie JUNIOR dba) and T-SQL very basically covered in the course. So much of the more complicated queries still leave me flabbergasted. Needless to say to write one query with input variables that'll find for eg the server name, smtp server etc., then find errors or diskspace running below 10% and then still send an email,is by my current point-of-view pretty advanced.. He basically wants me to find 'template' scripts with variables that can be used at any clients I need to go see without neccessitating the use of SSMS or any other GUI's.
    Any thoughts?

    you can pass a servername through sqlcmd, i.e.:

    simple example a file called DoAdmin.cmd contents

    @echo off
    set LogDir=D:\MSSQL\Logs
    set Servername=%1 ::First parameter in a DOS script
    set OutPutFile=%ServerName%.Admin.out
    sqlcmd -S"%ServerName%" -E -Q"exec stored procedure or sql here" -o"%LogDir%\%OutPutFile%"

    SendEMail.exe -SNoReply@whaterver.com -Attach"%LogDir%\%OutPutFile%" etc..


    Search for Diskspace report for sql servers and you should get many hits, or anything else you want to do.

    You can create a ServerList.txt file with server names and wrap above in loop to do for each server.

    for /f %%S in ('type ServerList.txt') do call DoAdmin.cmd %%S

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •