Powered by Blogger.

Saturday, February 15, 2014

Data files and Log files in sql server 2008




In this post we will discuss about Data files and log files in sql server 2008. Also you can check out my previous posts on:

- Transaction in SQL Server 2008

- Boxing and Unboxing in C#.Net

- Confirm box example in JavaScript

There are two types of operating system files named data files and log files  are maintained while creating a database.A database requires minimum one datafile and one log file.

Purpose of data file is to store the data and purpose of logfile is to record the changes made to data which will be useful in transaction management.

Datafiles are classified into primary datafiles and secondary datafiles. System required information about the database and also user data is specified in the datafiles but only user data is specified in the secondary datafiles.

Primary datafiles are saved as the extension .mdf (master datafile),secondary datafiles are saved as the extension .ndf (next datafile) and log files are saved as the extension .ldf (log datafile).

The datafile or logfile specification contains the following five options.
1. name->This option is used to provide logical name of the file i.e, used by sql server to refer to that file.

2. filename-> This option is used to provide physical name of the file along with the path where you want to save it in the hard disk.

3. size->This option is used to specify the initial memory to allocate to the file which is by default taken in MB.
For a logfile the size is 504KB and for a datafile the default size is 1280 KB.

4. filegrowth-> This option is used to specify how much increment to be done to the filesize.Every time it requires additional memory.This is also by default taken in MB and this can also be specified by %.

5. maxsize->This option is used to specify the maximum limit for the filesize. This is also by default taken in MB. This option can be set as unlimited so that the filesize will be increment up to the maximum memory available on that drive where the file is created.

It is not compulsory that you need to write all file option and also no need to follow any order to write these options while creating a database.



0 comments

Post a Comment