Share via

SQL MI backup status using powershell

Siva 736 Reputation points
2022-05-18T12:07:28.683+00:00

Hi Team,

We have SQL MI instance, we need to get the backups status via powershell script.

Do we have any script for viewing the backup status for all managed instance

Azure SQL Database
0 comments No comments

1 answer

Sort by: Most helpful
  1. Alberto Morillo 35,506 Reputation points MVP Volunteer Moderator
    2022-05-18T13:59:24.863+00:00

    I am assumming you are talking about automated backups. I am afraid you cannot monitor automated backups using PowerShell.

    However, you can use Extended Events for that purpose.

    CREATE EVENT SESSION [Simple backup trace] ON SERVER  
    ADD EVENT sqlserver.backup_restore_progress_trace(  
    WHERE operation_type = 0  
    AND trace_message LIKE '%100 percent%')  
    ADD TARGET package0.ring_buffer  
    WITH(STARTUP_STATE=ON)  
    GO  
    ALTER EVENT SESSION [Simple backup trace] ON SERVER  
    STATE = start;  
    

    Was this answer helpful?


Your answer

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