[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Retrieve logical file name from .bak file

Posted on 2004-11-26
5
Medium Priority
?
1,186 Views
Last Modified: 2007-12-19
Hi,

Please let me know how can i retrieve the logical file name if I have the .bak file i.e I want to know the file name for mdf and ldf files.

Regards,
R S
0
Comment
Question by:rajneetbhatia
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
ram2098 earned 200 total points
ID: 12679707
RESTORE FILELISTONLY FROM DISK = 'c:\yourfile.bak'

Execute the above statement using query analyzer.
this gives you the logical and physical filenames.
0
 

Author Comment

by:rajneetbhatia
ID: 12679750
Thanks a lot.., I am able to get the logical name.

Please let me know is it possible to get the database name.., if yes how..?


Waiting for reply.

Regards,
R S
0
 

Author Comment

by:rajneetbhatia
ID: 12679977
Hi,

How can I get the database name if I know the .bak file name.

Regards,
R S
0
 
LVL 11

Expert Comment

by:ram2098
ID: 12680099
RESTORE HEADER ONLY FROM DISK = 'c:\yourfile.bak'
0
 
LVL 11

Expert Comment

by:ram2098
ID: 12680123
sorry without space in between...

RESTORE HEADERONLY FROM DISK = 'c:\yourfile.bak'
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question