Love you. 10,000 Years >> Database basics

Source: Internet
Author: User
Tags mssqlserver

Hi ! Recently learned a new skill, learning the knowledge of the database, here to give you a talk, hope enlighten!! >>

01. First, let's talk about why we use the database.

a database can be viewed as a repository for permanent data storage.

can store large amounts of data

Data consistency and integrity can be guaranteed

To meet the sharing and security requirements of your app

Convenient and intelligent analysis to generate new and useful information

02. Log in to SQL Server two ways:

Windows Authentication

SQL Server Authentication

Note the point:

When we connect (log in) the database, we must ensure that

Database service open: SQL Server (MSSQLServer)

03. Common Database

Oracle

DB2

SQL Server

Mysql

Sqllite

Visual FoxPro

Access

The difference between 04.DBMS and DBS

Dbms:database ManageMent System: Database management Systems

Dbs:database System Database

Relationship: DBS contains DBMS

Because of the database system components:

The operator of the database

Database software (database management system)

The computer that hosts the software

05. Database service Startup method

method One : To "My Computer" → Right-click "Services" →sql Server (MSSQLServer)

method Two : Open the Start menu → run →services.msc Enter to open the Services window, follow the same procedure

method Three : Press and hold the "Win+r" on the keyboard to open the Command Prompt window, enter the →services.msc carriage return to open the service window, follow the same procedure

method Four : "cmd-> Administrator" → enter "net start mssqlserver enter" (if you want to stop: put start as stop)

06. System Database

Resource Database : role: User created a new database school,

Then some information is automatically mapped from resource to school ("hidden" database )

master database : Saves all database information and, once corrupted, the entire database software will not run.

modeL: Template Database

tempdb: Staging database, saving temporary data

msdb: Agents, business scheduling, alert jobs, and more.

07. Some issues that cannot be ignored

1. How do I copy a database file from a hard disk to a USB flash drive?

Parsing: By shutting down the service

2. How do I restore a database file from a USB flash drive to a database in the database software on my computer?

Resolution: The data file on the USB stick is copied to the computer's non-system disk, using additional tools to find the corresponding location of the database files, for additional operations

3. Stop the defect of the service backup data file?

Parse: Hot backup! (to be said below)

4. Children's Shoes: Shrink database What do you do?

Resolution: Save Hard disk space

08. Detach and Attach

01. Separation

Method: Right-click the database "~" → "Tasks" → "Detach" → "Detach database", tick ' delete connection ' (must) → "OK"

(The detached database will no longer appear in the list of databases, but its physical files are still stored on disk, at which point the files can be copied. Paste units)

02. Additional

Method: Right-click the database → "Add" → "Select your file location" → "OK"

09. Backup and Restore

01. Backup (Category: Full. Variance. Transaction log. Files and Filegroups)

The following is an example of database Shool (full)

(1) Right-click the database "Shool" → "Tasks" → "Backup" → popup "backup Database window" → "Backup Type" select "full" → "name" to fill in

(2) in the "Back up to" select Address ... Carefully

(3) "OK"

02. Restore

The following is an example of restoring a database Shool

(1) Detach the corrupted database in SSMs.

(2) Right click on the database "shool" → "Restore Database" → "pop Up" restore Database window "→ type" target database "name" Shool "→ click" Source Device "radio button (cut) in the" restored source "area to browse to select the location of the backup file

(3) "OK" 

10. Shrinking the Database

Right-click the database "Shool" → "Tasks" → "shrink"

Role:save hard disk space11. Deleting a database

when you need to delete a database,

Be sure to back up, seriously recommended, especially very very much and need attention

============================

Well, today's share is here, I hope that useful to everyone, there is any question can ask me, although is a freshman, but knowledge is not divided into high and low, is not it?

Have an opinion to discuss >>

qq:1907832004

E:[email protected]

Love you. 10,000 Years >> Database basics

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.