cancel
Showing results for 
Search instead for 
Did you mean: 

Delete the MDF and LDF file from the SQL Server folder

former_member254404
Participant
0 Kudos

Hai Experts ,

I need to known , What is MDF and log_ldf file  and when it is created. Can we delete the file since it occupies more space.

If we delete thet MDF and Log_ldf file , it cause any problem in the database .

Regards

Daya............

Accepted Solutions (1)

Accepted Solutions (1)

raghu_ram
Active Contributor
0 Kudos

Hi Daya,

Please check the below threads for similar discussion.

http://scn.sap.com/thread/1816931

http://scn.sap.com/thread/1594147

Regards,

Raghu

former_member254404
Participant
0 Kudos

Raghu ,

Thanks for your reply

My question is , If i delete manually the MDF and LDF file , its cause any problem in the data .

Then can u guide me , how to take the back up of transaction log files .

Regards

Daya...........

raghu_ram
Active Contributor
0 Kudos

Hi Sriram,

You can take the backup of these files rather than go for deleting I guess. Please check the below thread for shrinking a transactional log file.

http://scn.sap.com/thread/1862414

Regards,

Raghu

raghu_ram
Active Contributor
0 Kudos

Hi Sriram,

Also go through the below SAP Note

http://service.sap.com/sap/support/notes/1402580

http://service.sap.com/sap/support/notes/1274803

The above note contains a word file attached which explains the steps to Shrink a Log file.

Regards,

Raghu

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Sriram,

On top of other recommendations, I'd suggest to contact your IT department and ask for assistance with SQL Server maintenance.

Regards,

Akim

Former Member
0 Kudos

Hi,

you can reduce space occupied by datafiles and transaction log using some DB features like "shrink".

Take a look at this note for more information on how to accomplish this task:

363018: File management for SQL Server

Regards

Leo

Former Member
0 Kudos

Hi Sriram,

MDF are the primary data file in a File Group. These files contain "data" - so your tables, indexes, keys, constraints, UDF, UDT, stored procs, functions, etc...LDF files are your transactions

  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.

SQL Server 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.

In SQL Server, the locations of all the files in a database are recorded in the primary file of the database and in the master database

. The SQL Server Database Engine uses the file location information from the master database most of the time. However, the Database Engine uses the file location information from the primary file to initialize the file location entries in the master database in the following situations:

  • When attaching a database using the CREATE DATABASE statement with either the FOR ATTACH or FOR ATTACH_REBUILD_LOG options.
  • When upgrading from SQL Server version 2000 or version 7.0.
  • When restoring the master database.

Hope it helps!

Thanks,

Kiran

former_member186498
Active Contributor
0 Kudos

Hi Sriram,

.mdf are the primary database file, so if you delete this file you will loose your DB and destroys your appset, if you want to delete an appset it's better to use BPC admin console because there are several components to be free, .ldf are the transaction log, i.e. the log file when you select the full recovery model or bulk-logged recovery model. To delete these files see

ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_1devconc/html/f60f020a-8cad-435e-bd92-114b805ea3dd.htm

To reduce the space compress DB using the BPC full optimize with compression option and you can delete old logs but it's better to ask to a BASIS.

Kind regards

     Roberto