In the previous lesson we have already discuss about how to log in your database server and access your database located in local server or remote server and all if you miss those lesson then just have a look here..
This article will assist with moving SQL Server Data File(s) (.mdf) and Log File(s) (.ldf) from one location to another using the attach and detach .but before going into step for attach and detach the mdf and ldf let talk in short about
This article will assist with moving SQL Server Data File(s) (.mdf) and Log File(s) (.ldf) from one location to another using the attach and detach .but before going into step for attach and detach the mdf and ldf let talk in short about
what is mdf?
what is ldf?
what is ndf?
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 comprise all of the data files other than the primary data file. Some databases may not have any secondary data files, while others have multiple secondary data files. The recommended file name extension for secondary data files is .ndf.
Log files:Log files hold all of the log information 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.
step to attach database file:
Step1:Just folllow the below screen and brose the attach file window.Right click on database >>all task>>attach database.
Step2:click on browse option in newer version this option named as add new then select .mdf file and click on OK.
Step3: Now the database .mdf file is in browse window for confirmation click on OK other choss another .mdf file. After click on OK it will give message whether the file is attach or not.
step to detach database file: first select your database then give right click and select the detach option .
step to move database file: To move the database file there are two way first way is Stop the sql server and then go to the physical path of .mdf file copy and past it another place or in your hard disk and attach in other sql server and remeber dont forget to start the sql server once you stop it .Second way is detach the database then copy the database and move it another location then again attach the database .mdf file.
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter