Microsoft SQL Server generates databases which is stored in the hard disk of the system where SLQ Server is installed. The information is managed well by the server in three types of database files; Primary Data File, Secondary Data File, and Log File. Primary Data File which is also referred as MDF file i.e. Master database file is considered as the starting point of any database which points to other files available in the databases. All the databases have one primary database and the extension for this file is .mdf.
Types of SQL Databases
So basically, there are three types of SQL databases.
- Primary: SQL database has this one primary file which refers to other files and act as a core file with a default extension as .mdf. This is a master data file and when needed, users can store further prolonged data to secondary files.
- Secondary: Secondary data files comprise files other than primary data files. It is not necessary that all the primary data files will have secondary files; these are explicitly created when needed. These files are saved with .ndf extension.
- Log: This file comprises records of all the transactions made in the primary database file. At least one log file is automatically created while creating MDF file. This file can be utilized highly for recovery process and uses .ldf as extension.
Where is SQL MDF File Located?
SQL MDF file is stored on the system and can be fetched easily. The default location of the MDF file is;
C:\Program Files\Microsoft SQL Server\MSSQL\MSSQL\Data\
But this location can be changed by user and the master database can also have some other location. This location can be retrieved easily by following below mentioned steps.
- Open SQL Server Management Studio.
Select the database whose location you need. - Right-click to this database and go to Properties.
- Now in the left-pane, got to Files option.
- Details of this database will be available in the right pane.
- Check for the File group as Primary and copy the location from Path.
How to Open SQL MDF File?
In order to open any MDF file in SQL Server, one can follow the below mentioned steps;
- Open “SQL Server Management Studio” and connect it to server.
- Now in “Object Explorer” expand the “Databases” on left pane.
- Right-click on “Databases” and click on “Attach”.
- Here, click on “Add” option available in the “Attach databases” window.
- Now go to the folder where your MDF file is saved.
- Select that database and click on OK.
- Click OK again and now the database will be now visible in Object Explorer.
- The databases will be attached to the server successfully.
- If the database is still not available in the node, you can Refresh it by pressing F5.
- All the elements in the database can be also viewed easily.
In case while opening the database, you get errors then conclusions can be drawn that the MDF file is damaged or corrupted. There can be several other reasons as well because of which MDF file is not accessible. In such situations, users must first troubleshoot the database file issues and only then the database will be accessible.
Author: As author of MS Outlook Tools, Peter has experience more than 20 years in IT industry and he is now working with an expert data recovery firm. He has quality expertise in the Office products especially in Microsoft Outlook and love to solve users query by providing excellent solutions.
0 comments:
Post a Comment