August 28, 2008 at 8:57 am
Come on if you follow the link to MS's site you find this glaring at you
SQL Server databases have three types of files:
* Primary data files
The primary data file is the starting point of the database and points to the other files in the database. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.
* Secondary data files
Secondary data files make up all the data files, other than the primary data file. Some databases may not have any secondary data files, while others have several secondary data files. The recommended file name extension for secondary data files is .ndf.
* Log files
Log files hold all the log information that is used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf.
Thus log files are database files. If you actually create a database and specify a second data file and don't enter a filename in SQL 2005 it adds ndf to it. Hence mdf, ldf, and ndf are all database file extensions.
A Database to SQL server is what all of these files when combined provide. Concurrency control is a necessity in an RDBMS so having a LOG file so you can use Transactions is a must. This was an easy one.
August 28, 2008 at 9:40 am
I knew I should have checked *.ldf - even though it is a log file, so I thought it was not a database file.
I guess both are considered "database files" because they are needed for the database. Sounds picky, but the URL below makes sense - mdf/ndf files are "data files" and ldf files are "log files". Together they make up "database files."
A primer on SQL Server database files
http://articles.techrepublic.com.com/5100-10878_11-6096988.html
I should go with my gut more often. 🙂
webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
August 28, 2008 at 9:55 am
Michael Kipp (8/28/2008)
Please don't confuse "database files" with "data files".A database is more than just a data file.
A database is more than just a data file, but it is not inherently dependent on a log. Many databases that are designed for single-user use do not maintain any form of log file, yet remain true databases.
Even in MS SQL Server specifically, while the log file is of great importance for many things, it at least arguably does not hold the database entities. It can be discarded and rebuilt with no challenge if you have the actual data files (.mdf and .ndf by default.)
---
Timothy A Wiseman
SQL Blog: http://timothyawiseman.wordpress.com/
August 28, 2008 at 4:47 pm
for those of you who says .ldf is log file not data file, please read the question carefully, it asks for database file, not data file. .ldf forms a part of database file, because database file consists of (on full and bulk-logged recovery mode) data file and log file.
I personally think it's a good question, as it tests your knowledge of differentiating data file and database file.
August 28, 2008 at 6:32 pm
yep, i was confused by the question too. I thought it was just asking for database file extension, not include database log extension, meaning only mdf and ndf by default.
What a confusing question indeed.
- Simon
Simon Liew
Microsoft Certified Master: SQL Server 2008
August 29, 2008 at 2:49 am
The question suck a bit coz even though .ndf is a default extention, a file with .ndf extention does not get created by default with this extention when you create a new db. Only .mdf and .ldf files are created by default.
August 29, 2008 at 3:54 am
Sorry question-master, but I disagree.
A "log" file is not the same as a database file. A "log" file is a "log" file, and what it holds may be "data", but that is true of any file.
If you are going to ask a question, please make sure that you know the answer first!
Kenneth Spencer.
You never know: reading my book: "All about your computer" might just tell you something you never knew!
lulu.com/kaspencer
August 29, 2008 at 1:19 pm
I appreciate the QOD question because it encourages me to read BOL more and the questions and ensuing discussions helps me to better understand some of the BOL entries. If I studied the BOL more closely I would not have missed the question. Yes, I did not include the log file in my answer.
Thanks for keeping us on our toes!
August 30, 2008 at 7:43 pm
LDf are used for the Transaction Log not for the Database itself.
José Miguel Gutiérrez Hilaccama
Database Developer - MCTS SQL Server 2005
No way Jose? ... bah
September 1, 2008 at 11:08 pm
Nice question...:)
September 2, 2008 at 10:04 am
The thing that caught me on this is that SQL Server does not require any secondary data files and so it could be considered that .ndf is not a "default" but then again if you add more than one data file it does default to .ndf from the GUI so maybe I'm reading too much into the question!
Nigel Moore
======================
September 4, 2008 at 2:32 am
Trick question. Not funny nor have I learnt anything from it.
September 9, 2008 at 6:19 am
hey Guys but *.ndf is not default file in database
December 3, 2008 at 12:25 pm
here is the explaination I got after answering the quesiton incorrectly...
'SQL Server 2005 does not enforce the .mdf, .ndf, and .ldf file name extensions, but these extensions help you identify the different kinds of files and their use. MDF is for primary database files, NDF is for secondary database files and LDF is for log files.'
I left out the log file, but in thinking about it - I do agree that the log file is part of the database files. I am not hung up on whether I get or don't get the point, but I find it funny that the explaination supports my incorrect answer.
October 2, 2010 at 9:32 am
I fell into the same trap as a couple of others: I assumed that "default" meant that the system would supply that extension as a default, so I left out .ndf (the default for secondary database files is actually no extension, not .ndf). Of course, were I creating such a file I would follow the reccomendation and give it a .ndf extension, so although it isn't the system's default it is in some sense my default.
Tom
Viewing 15 posts - 16 through 30 (of 31 total)
You must be logged in to reply to this topic. Login to reply