Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining Database Name from Backup

Status
Not open for further replies.

bikerboy718

Programmer
Feb 11, 2005
195
US
Is it possible to determine the database name on the server from a backup file? By this I am not referring to the logical name which can be retrieved from the RESTORE FILELISTONLY command. I am referring to that actual database name as how it was stored on the server.

Any help would be greatly appreciated.

With Great Power Comes Great Responsibility!!! [afro]

Michael
 
If you setup the backups to use the default naming then yes as it will be in the format of <DBNAME><backup><timestamp>.<bak or trn>

Biglebowskis Razor - with all things being equal if you still can't find the answer have a shave and go down the pub.
 
The problem that I am having is we are doing a migration from one environment to another, and I have no control over how the backups are named. I completely agree with your naming convention however it is not in my control.

With Great Power Comes Great Responsibility!!! [afro]

Michael
 
Do a RESTORE HEADERONLY and it'll give you the database name.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / SQL 2005 BI / SQL 2008 DBA / SQL 2008 DBD / SQL 2008 BI / MWSS 3.0: Configuration / MOSS 2007: Configuration)
MCITP (SQL 2005 DBA / SQL 2008 DBA / SQL 2005 DBD / SQL 2008 DBD / SQL 2005 BI / SQL 2008 BI)
MCM (SQL 2008)
MVP

My Site
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top