Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2006
    Location
    Latrobe, PA
    Posts
    16

    Unanswered: How to get the drive letter and the backup directory

    Hello,

    I'm looking to get the drive letter and path for my backups programmatically. I am monitoring my sqlserver boxes remotely and need to get this information to determine if my backups will fit on the backup drive.

    I'm looking for either a sql statement or a stored procedure to accomplish this.

    For example...the backup script states:
    EXECUTE master.dbo.xp_create_subdir N'H:\MSSQL\Backup\master'

    I need to know how this script gets H:\MSSQL\Backup

    Thanks in advance.

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    nevermind I was wrong.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    in SQL2K it is in the backupmediafamily table in the msdb.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  4. #4
    Join Date
    Dec 2006
    Location
    Latrobe, PA
    Posts
    16
    Thanks....but I still need it for 2005

  5. #5
    Join Date
    Dec 2006
    Location
    Latrobe, PA
    Posts
    16
    Actually it is in 2005 as well, but this table is written to after the backup is taken. This could work, but if one of our DBA's changes the drive (for whatever reason), we won't be notified until at least a day later.

    I'm looking for proactive monitoring.

  6. #6
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    If you use backup devices, you can look in the sysdevices table for SQL 2000. not quite sure what the 2005 equivalent is, but sysdevices is probably carried over for this version. You just have to find the real table before SQL 2008 comes out.

  7. #7
    Join Date
    Dec 2006
    Location
    Latrobe, PA
    Posts
    16
    Sorry...this doesn't give me any data in 2005. I have attached an image of the maintenance plan in 2005. If I bring the maintenance plan task window, I can see where it states the backup (This is roughly the same for v7 & 2000). Obviously SQL Server is getting this information from somewhere....
    Attached Thumbnails Attached Thumbnails Maintenance_Plan.bmp  

Posting Permissions

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