Querying SQB file

chenchen300chenchen300 Posts: 12 Bronze 1
edited June 9, 2015 11:26AM in SQL Backup Previous Versions
Dear friends,
I would like to build a dynamic restore scripts. The problem is i can't know the original File Groups within the new created SQB file.
I can see the SQL Backup gui doe's it, i guess maybe it uses the catalog repository. Anyway, i assume i do not have this repository and neither the backed up sql database.
My question is: how can i know what File Groups are contained within my SQB file , in order to script their new locations?

Comments

  • peteypetey Posts: 2,358 New member
    Try
    EXEC master..sqlbackup '-sql "RESTORE FILELISTONLY FROM DISK = [<backup file name>] WITH SINGLERESULTSET"'
    
    If you're fine with moving all data files to the same folder, and all log files to the same folder, you can use the DATAFILES and LOGFILES shortcuts e.g.
    EXEC MASTER..sqlbackup '-sql "RESTORE DATABASE mydb FROM DISK = [<backup file name>] WITH MOVE DATAFILES TO [<data files folder>], MOVE LOGFILES TO [<log files folder>"'
    
    In this way, you don't need to know the actual filegroup names.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
Sign In or Register to comment.