Friday, February 24, 2012

Backup n Restore Question (How to see a backup media content by TSQL?)

Hello, Howdy?

I got a question on backup and restore. I wanna know how to retrive the information about a backup media content by TSQL. we can see all the the information about that thing with SQL Management studio just by a few clicks, however, i wanna do that in code.

answeres are appreciated.....

thank u.

Hi, there is an option is RESTORE DATABASE which is called FILELIST ONLY, for more Information look in the BOL under RESTORE DATABASE:

"The RESTORE FILELISTONLY statement is used to determine the number and names of the files in the database being restored. "

HTH, Jens Suessmeyer.

|||HELLO JENS,
thank you for your response,
I got what u meant, that thing which you told me is about obtaining the information in a file on backup device, for example like this:
RESTORE FILELISTONLY FROM backup_device WITH FILE=3
but i don't want this, as u know every backup device is composed of several backups that have been taken earlier, each of them has a name, type, component, server,..... that you can see in the media content of a backup device in sql managament 2005 console.(Server Objects/Backup Device)
for example in the media content you can see this one:
2/16/2006 11:20 AM Database Full CSVBP\KARIMIPOUR liver_institute 1 2/16/2006 11:20:55 AM
as the orange section is the name of the back up that i have taken earlier. I want this. The name of the backups to show to the user. So the user can decide which backup to restore. cause the users don't have access to SQL, they don't know which backup to restore.....so I wanna give em some information about the name of which backup to restore.
Thanks

|||Hello
I solved my problem, we can find the name and description of taken backups in any backup device in the BACKUPSET table in MSDB database.
Have fun.

No comments:

Post a Comment