How to retrieve the sql server database files in the backup using API

Last post 11-24-2020, 2:40 AM by MDaniou. 1 replies.
Sort Posts: Previous Next
  • How to retrieve the sql server database files in the backup using API
    Posted: 11-16-2020, 4:50 AM


    I need some guidance to get the list of the database files in the backups.

    The context is that I am building a DR process meaning that I need to automatically restore all the databases of a sql server instance and I can't know the list of the files in the backup before eventually executing the Cmdlet Restore-CVSQLDatabase.

    Something closed to the result of the sql query below :

    declare @i_jobId integer
    declare @i_commCellId integer
    set @i_jobId = 1873809  --1861414
    set @i_commCellId = 2

    SELECT DISTINCT,, dbInfo.type, dbInfo.is_copy, dbInfo.backupmethod
    FROM sqlfilebackupinfo fbkpinfo, sqlNames N1, sqlNames2 N2,
     (SELECT,, BkpInfo.type, BkpInfo.is_copy, BkpInfo.backupmethod
      FROM sqlDbBackupInfo BkpInfo, sqlNames N, sqlNames2 M
      WHERE IN
        SELECT sqlDbBackupFileId
        FROM sqlArchiveInfo
        WHERE aFileid IN
          SELECT id
          FROM archFile
          WHERE jobId = @i_jobId
          and commCellId = @i_commCellId
        AND commCellId = @i_commCellId
      AND = BkpInfo.sqlNameId
      AND N.sqlid =
     ) AS DBInfo
    WHERE fbkpinfo.sqldbBackupinfoid =
    AND = fbkpinfo.sqlNamePhyId
    AND N1.sqlid =

    Could you please help me figure how I can get this information ?

    Thanks a lot for your help !


  • Re: How to retrieve the sql server database files in the backup using API
    Posted: 11-24-2020, 2:40 AM

    Any idea ?

The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Copyright © 2020 Commvault | All Rights Reserved. | Legal | Privacy Policy