What is a database?

Source: Internet
Author: User
Tags naming convention

This article is for the Internet to translate and modify the results:

What's in the database?

It is important to note that most people do not need to create their own databases. You may also not create your own tables or other data structures, and you may only need to run backup and re-store the security on the operating system and have the application install for you to create the database. This is fully understandable and fully conforms to the needs of many businesses. However, it is a good idea to understand what these things are and how it can be part of the understanding of SQL Server.

The database is actually a file

You need to store information that you want to be able to retrieve later, and you must organize that information. If you use a word-processing program, you can store different documents in different files. You don't put all the documents in a large file. The functionality of SQL Server is very similar. Although you have a server, you will not simply store all the various types of information you need to run your business within a wide range of servers. Instead, you want to organize this information. The initial organizational mechanism for SQL Server is the database. The database allows you to save a set of information in a separate storage area. In addition, it allows you to isolate the security of these different sets of information so that you can control who can view or modify the data.
These things are called tables in a database. A table is how a relational store is defined. Information that you organize to store in a given database is added to these tables. You will be able to add or delete data to the database through these tables. You can also retrieve information from these tables from the database.
In addition to the tables in the database, there are many different constructs that can help you manage the information in the database, which is also stored in the database. These include many different types of objects that can help you manipulate data such as views, stored procedures, and functions. You can also get a complete set of securable objects, such as roles and users.
The database is actually made up of files that are stored on the Windows file system. These files are proprietary in binary format and cannot be read directly except through SQL Server. Writing data to these files is one of the most expensive and time-consuming operations in SQL Server (although in most cases the time involved is measured in microseconds). Because of this cost, it is important to understand that your database is defined by files, and that these databases are stored as part of your understanding of the database.

Two types of files

You can simply store the data in a text file or spreadsheet, which many people can do. But when you need multiple people to access it at the same time, update some dates, delete some, insert new information, and these other storage mechanisms become very problematic. This is why you need to use a database. Because SQL Server has to do a lot of different work on the data it stores, it proposes a number of different mechanisms for performing these operations. Databases are built around two different types of files that store different types of information.

Note: There are actually some other file types that can be added to the database, but we're talking about fundamentals here, so let's just say it now.

Data files

The first file that is required to define a database is a data file. Data files are easy to understand and interpret. This type of file is where the information you write to the database will be stored. Any given database can consist of multiple data files. The data file can be placed on multiple hard disks with your system. If you have more advanced storage mechanisms, such as storage area networks (Sans), you may have other hard disks that are constructed on simple servers, but they will be mapped as drives to the Windows operating system and SQL Server can use these stored data files. Log file
The second file that is required to create the database is the log file. The log file is slightly more complex than the data file. Log files record every transaction that occurs in the database. Transactions occur when the data is manipulated in some way in the system. These actions can update existing data by inserting new data into the table or by deleting the data from the table to add new data. All of these operations write information to the log file. There are many other functions that are also related to log files. These files are usually much smaller than the data files because the entries in the log file are only saved until all the data is successfully written to the data file. Because writing to the data file is subject to different types of failures, the log file is saved to help handle these failures. Once the information is written to the data file, the log entry can be deleted. The process of cleaning up the log files is discussed in detail in another post.
When you start to create files, you can adjust their size. After you create a file, you can resize it up or down. Each file can be set to grow automatically, which is complicated, so it's worth taking more time to understand what it means.
If you have many databases, managing files on the database can be a lot of work. You must check the available space and then set the file to a larger size when enough. One way to work around these manual tasks is to use the Autogrow property setting in the database.
Note: Use this setting with great care. You can populate the drive and take your server offline.
Setting the database to autogrow means that the database will automatically adjust the file size when it starts running. Many people use this setting, and many applications set it up at installation time. To avoid this problem, you should set the upper growth limit on the file. You can set a file by a database or a fixed size percentage. For smaller databases, a percentage increase is feasible, but as the database size expands, the process of increasing in percentage will become longer and longer. The best practice is to set growth to a specific value, not a percentage. Details on how to set all of these will be overwritten when the database is created.

Where's your file?

When you install SQL Server, you can choose where to place the database files. You can also adjust through the Server Properties window. When you create a database, it's best to know where to place the files to make sure there is enough space on the drive. To view this location, connect to the server as described in Database Foundation # 2. Once connected, in the Object Explorer window, right-click the server name itself. This will bring up a context menu. Select the Properties menu option at the bottom of the menu. This will open the Server Properties window and you will be on the default "General" tab. Select the Database Settings tab.
This interesting area is at the bottom of a portion of the window named the default location of the database. You will see the three different directories listed for data, logs, and backups, respectively. By clicking the ellipsis to the right of the entry, you can open a default file browser window to change the default location of your log or data file. You can also modify them by typing the text box directly, such as the physical path shown above, or by using a Universal Naming convention (UNC) path.
The goal of placing files should be to try to detach as much as possible. If you have the ability, it is best to separate the operating system files from the data and log files. This means that if possible, place the data and log files on something other than the C: \ Drive. In addition, you should at least consider storing the data and log files on a completely separate drive. This allows maximum throughput for data transfer to files on the drive.
Once you have determined where the storage location is appropriate, if you have made changes, click the OK button to save the changes. If you do not make any changes, or if you do not want to save your changes, click the Cancel button. These clicks close the Server Properties window.
These two file types have several properties in addition to the physical location when the database is created. A part of the physical location will be the file name and extension. These can be any valid Windows operating system name and extension. By default, extensions are usually. MDF for the data file. LDF as a log file. If you prefer, you can change these, but it can cause confusion because most people use default values as best practices. Has a logical file name that allows you to reference a file in the database without having to return to the full file location, including the drive. The logical name does not need to match the physical name, but this is usually the case.

Conclusion: This introduces the core content of database file storage. (from-Fritsch)

What is a

database?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.