Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Basic operation of SQLServer

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Basic operation of SQLServer

The creation of database

1. Open the "SSMS" tool and connect to SQLServer. Right-click "Database"-"New Database"

2. Specify the name and owner of the new database. When you create a new database, the system automatically creates a primary data file and a transaction log file, as shown in the following figure. The master data file is the main file of the database, which contains the startup information of the database and files pointing to other databases; the transaction log file is used to record database operations and can be used for database recovery)

3. Click "add" to add secondary data files to the database. When the primary data file of the database is full of data, the database system stores the data in the secondary data file. There can be only one primary data file, while there can be multiple secondary data files)

Expand the database (expand the database)

1. Right-click "Database name"-Select "Properties"

2. You can expand the initial size of the database here, or click "..." on the right. Button to set the automatic growth of data files

Shrink the database

After the database has been used for a period of time, there is often too much free space in the database caused by data deletion. at this time, we can use the method of shrinking the database to shrink the disk space occupied by the database to be used by other programs in the system.

1. Right-click "Database name"-"Task"-"shrink". There are two options: shrink the database or shrink the file. The difference is that when you shrink the database, you cannot shrink the file to a smaller size than the original size, while shrinking the file can.

2, in the properties of the database-click "options"-drop down to find automatic contraction-change the "false" in its options to "true" to configure automatic shrinkage of the database.

Separate the database from the attached database

Detaching and attaching databases is what we often call database relocation. In the work environment, companies often replace the hardware equipment for the database, at this time, we can separate the database and save it to storage, and attach the database to the new equipment. Note that both primary and secondary data files must be available when attaching the database (all data files).

1. Click

2. Check "close connection" and "Update Statistics" to determine the separation

3. Right-click "Database name"-Select "attach"

4. Add

5. Find the location of the main data files in the database-determine the attachment

Delete database

1. Right-"Delete"

2. in order to avoid customers who are connecting to the database that cannot be deleted, check "close existing connection"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report