0

I've downloaded an unspecified SQL file with no file extension. When reading the first 10 lines of the file it shows among unreadable characters:

TAPE
Microsoft SQL ServerSPA
L
SFMB
8SSET
4Oct_2015_Latest backupDBA\TSSHTSPAD2
VOLBX
C:\DBASPAD
MSCI8
Oct_2015_LatestDBASFGI
PRIMARYSFINf
Oct_2009_DataC:\Program Files\Microsoft SQL Server 2000\MSSQL\data\Oct_2015_Latest.mdfSFINl
Oct_2009_LogC:\Program Files\Microsoft SQL Server 2000\MSSQL\data\Oct_2015_Latest_log.ldf
SPAD
MSDA
APAD
MQDA

I have done some reading on .mdf files, but cannot find out how to read this file. I am using Linux. Is there a way to read this in Linux or Windows?

The RESTORE HEADER ONLY command gave this:

Oct_2009_Data
C:\Program Files\Microsoft SQL Server 2000\MSSQL\data\Oct_2012_Latest.mdf
D
PRIMARY
1005584384
35184372080640
1
0
0
00000000-0000-0000-0000-000000000000
0
0
0
512
1
NULL
968000005802100003
4D42441E-4BCF-4351-9BAD-A03C53801BEF
0
1
NULL
NULL


Oct_2009_Log
C:\Program Files\Microsoft SQL Server 2000\MSSQL\data\Oct_2012_Latest_log.ldf
L
NULL
5477695488
35184372080640
2
0
0
00000000-0000-0000-0000-000000000000
0
0
0
512
0
NULL
0
00000000-0000-0000-0000-000000000000
0
0
NULL
NULL

And RESTORE FILEONLY gave INCOMPLETE in the first column and the rest were null.

3
  • 2
    I suspect this is a database backup file. Execute a T-SQL RESTORE HEADERONLY and RESTORE FILELISTONLY to make sense of the contents.
    – Dan Guzman
    Commented Dec 6, 2016 at 12:20
  • Adding responses above. Commented Dec 6, 2016 at 17:28
  • The output you posted from RESTORE HEADERONLY looks like output from RESTORE FILELISTONLY. Did you run the command using SQL V.Next on Linux?
    – Dan Guzman
    Commented Dec 7, 2016 at 3:40

1 Answer 1

1

A MDF is a primary database file, ndf is a non-primary database file, ldf is a log database file. Together, these objects create a database in SQL Server. These files can be attached or detached from the SQL Server Instance.

Hierarchy is: SQL Server Instance -> SQL Server Databases -> SQL Server Schema -> SQL Server Tables.

The most common way to attach and detach a database is to use SSMS. (SQL Server Management Studios) SSMS has recently been placed as a standalone install, you could download SSMS on a Windows machine and then follow this KDB to attach the database to your Instance. I would recommend using caution when attaching unknown databases to your instance. You will also need to attach the log file and any other files that were included.

Once it has been attached, you may be able to view the objects inside it. This will depend on whether the database is encrypted with Transparent Data Encryption, what user permissions are set to, and other factors.

Objects include tables (this has data inside it which you are probably looking for), stored procedures (programmed scripts that can be executed and run), views (queries that look at tables to retrieve a set of data in a specific fashion) and may other things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.