How to get the database backup location?

Zahid. Ahamed 41 Reputation points
2020-09-29T01:48:55.507+00:00

Hi Expert,

I am not sure in which location the database backup is performing. I ran a query and it returned the following output. And also I don't see any database backup job in the SQL Server agent. But the backup is performing every day. Please look into the attach screenshot

29001-image.png

SQL Server | Other
0 comments No comments
{count} votes

Accepted answer
  1. m 4,276 Reputation points
    2020-09-29T03:30:45.04+00:00

    Hi @Zahid. Ahamed ,

    Please execute code as next to check your device type:

    SELECT  
        database_name,  
        backup_finish_date,  
        CASE msdb..backupset.type  
            WHEN 'D' THEN 'Database'  
            WHEN 'L' THEN 'Log'  
        END AS backup_type,  
        physical_device_name,  
     device_type  
    FROM msdb.dbo.backupmediafamily  
    INNER JOIN msdb.dbo.backupset  
        ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id  
    --WHERE (CONVERT(datetime, msdb.dbo.backupset.backup_start_date, 102) >= GETDATE() - 1)  
    ORDER BY database_name,backup_finish_date  
    

    29041-20200929devicetype.jpg

    Quote from this doc. :SQL-Server-physical_device_name-in-the-Backup-log-shows-GUID
    Please verify these rows have value 7 in the column "device_type" or not. The value 7 means "Virtual device". These rows are actually very useful for monitoring, for example it help to know that the Virtual Machine backups are running full database backups on a SQL Server instance. there's no trace of these backup files since they are above the scope of the virtual machine (above the level of your control) - these are triggered by the host,meaning azure in this case (Hyper-V or VMware for example triggers these).

    In conclusion: These backups are not related to our backup in the level of the instance.

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.


5 additional answers

Sort by: Most helpful
  1. m 4,276 Reputation points
    2020-09-29T02:16:42.427+00:00

    Hi @Zahid. Ahamed ,

    Execute code as next:

    Use master  
    go  
      
    SELECT  
        database_name,  
        backup_finish_date,  
        CASE msdb..backupset.type  
            WHEN 'D' THEN 'Database'  
            WHEN 'L' THEN 'Log'  
        END AS backup_type,  
        physical_device_name  
    FROM msdb.dbo.backupmediafamily  
    INNER JOIN msdb.dbo.backupset  
        ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id  
    --WHERE (CONVERT(datetime, msdb.dbo.backupset.backup_start_date, 102) >= GETDATE() - 1)  
    ORDER BY database_name,backup_finish_date  
    

    28905-20200929code2.jpg

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.

    1 person found this answer helpful.
    0 comments No comments

  2. Guoxiong 8,206 Reputation points
    2020-09-29T02:13:44.153+00:00

    The following script should list the database backup history:

    SELECT *
    FROM msdb.dbo.backupmediafamily AS f
    INNER JOIN msdb.dbo.backupset AS b ON f.media_set_id = b.media_set_id;
    
    0 comments No comments

  3. Zahid. Ahamed 41 Reputation points
    2020-09-29T02:35:29.267+00:00

    Thanks for replying. I don't know about this backup device. I ran this above query and it returned the below output:--
    28944-image.png

    0 comments No comments

  4. Shashank Singh 6,251 Reputation points
    2020-09-29T06:05:31.87+00:00

    @Zahid. Ahamed The physical-device_name as Hexadecimal number represents a tape or Snapshot backup not a backup on local or shared disk. So you would not be able to find it on local disk. The backup is either being performed by some third part backup tool taking backup on tape or some backup tool which takes snapshot backup. In this case you need to get in touch with backup team to get information about the same. Please see similar answer given by me on Stackexchange Thread

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.