Sie sind auf Seite 1von 17

Microsoft SQL server

Manasi Adsul-01
Nidhi Chauhan-07
Isha Chhawchharia-08
Introduction
• MS SQL Server is a database server and a product of Microsoft
• Enables user to write queries and other SQL statements and execute
them
• Consists of several features. A few are:
– Query Analyzer- Allows us to write queries and SQL statements, Checks syntax
of the SQL statement written, Executes the statements, Store and reload
statements, Save the results in file, View reports.
– Profiler- is a Monitoring tool, Used for performance tuning, Uses traces – an
event monitoring protocol, Event may be a query or a transaction like logins,
– Service Manager- Helps us to manage services, More than one instance of SQL
server can be installed in a machine, First Instance is called as default instance,
Rest of the instances (16 max) are called as named instances, Service manager
helps in starting or stopping the instances individually
– Bulk Copy Program (BCP)- A powerful command line utility that enables us to
transfer large number of records from a file to database. Time taken for copying
to and from database is very less, Helps in back up and restoration
System Databases
• By default SQL server has 5 databases
– Master : Records all the system level info for an instance of SQL Server.
– Model : It is used by SQL Server as Templates for all DB created
– Tempdb : It is a workspace for holding Temporary objects or intermediate
results set.
– Msdb : Has tables that have details with respect to alerts, jobs. Deals with SQL
Server Agent Service
⁻ Resourcedb :- It is used as a read only Database containing System Objects that
are included in SQL Server.
• We need to use Master database for creating a database
• By default the size of a database is 1 MB
• A database consists of
– Master Data File (.mdf)
– Primary Log File (.ldf)
SQL Database SQL Operators
Objects
– Tables
 Arithmetic

– Views  Assignment

– Stored Procedures  Comparison


– Functions
 Logical
– Rules
 String
– Defaults
 Unary
– Cursors

– Triggers  Bitwise
SQL Server Data types
• Integer : Stores whole number
• Float : Stores real numbers
• Text : Stores characters
• Decimal: Stores real numbers
• Money : Stores monetary data. Supports 4 places after
decimal
• Date : Stores date and time
• Binary : Stores images and other large objects
• Miscellaneous : Different types special to SQL Server.
(Refer to notes for more info)
Built-In Server / Database Roles
Server Roles Database Roles

• SysAdmin • db_accessadmin
• ServerAdmin • db_BackupOperation
• SetupAdmin • db_DataReader
• SecurityAdmin • db_DataWriter
• ProcessAdmin • db_DDLAdmin
• DiskAdmin • db_DenyDataReader
• DBCreator • db_DenyDataWriter
• BulkAdmin • db_Owner
• db_SecurityAdmin
• public
SERVER ROLES
• SysAdmin :- Can perform any activity in the server
• ServerAdmin :- Can change server-wide configuration and shut it down
• SetupAdmin :- Add or remove linked servers
• SecurityAdmin :- Manages login and their properties , resets password.
• ProcessAdmin:- Ends running processes
• DiskAdmin :- Manages Disk File
• DBCreator :- Create, Drop, Restore and Alter Database
• BulkAdmin :-Can Run BULK_INSERT statement. (Bulk_Insert is a
process/method provided by a dbms to load multiple rows of data into db
Table).
• Public:- Every server belongs to Public. Database user cannot be removed
from public role.
DATABASE ROLES
• db_accessadmin :- Add/Remove access to database for Logins
• db_BackupOperation:- Backing up the Database
• db_DataReader :- Read all data from User Table
• db_DataWriter :- Add, Delete or change data into user table
• db_DDLAdmin:- can run any Data Definition Language command in
database.
• db_DenyDataReader:- Members of this cannot read any data in user table.
• db_DenyDataWriter:-cannot Add, Delete or modify data into user table
• db_Owner:- Configuration & Maintainence activities on database (drop
table).
• db_SecurityAdmin:- Modify and manage permissions
• Public:- Every database belongs to Public. Database user cannot be
removed from public role.
• db_manager:- Create and Delete Databases.
Understanding Database Schemas
• Schemas
– Logical collection of related database objects
– Part of full object name:
• Server.Database.Schema.Object
– Default schema is “dbo”

• Managing Schemas
– CREATE, ALTER, DROP SCHEMA
– SQL Server Management Studio
– Can assign default schemes to database users:
• WITH DEFAULT_SCHEMA ‘SchemaName’
In-Memory OLTP - Motivation
$/1000 Mb
1800

1600
SQL 2000
1400

1200

1000

800 $/1000 Mb

600 SQL 2008 R2


400
SQL 2005
SQL 2008 SQL 2014
200 SQL 2012
0
2000

2004
2000

2000
2001
2001
2001
2002
2002
2003
2003

2005
2006
2006
2007
2007
2008
2008
2009
2009
2010
2010
2010
2011
2012
2012
2013
2013
2014
2014
Database Maintenance & Data –
Protection-Methods for maintaining, backing up, and restoring databases

Database Backup Types-


• Recovery Models
Full:- Full database backup takes a copy of the entire database (basically copies all
of the pages) including the part of the transaction log file so that the full database
can be recovered after a full database backup is restored. Backup can be taken on
a backup device which could be a local or network disk or local tape drive
or Windows Azure blob storage (available with SQL Server 2012 and later). A full
database backup represents the database at the time the backup operation
finished and allows restoring to the point-in-time when the backup was taken.
Bulk-logged, Simple

• Backup operations
Differential Backups:-Differential database backup includes only extents
(collections of eight physically contiguous pages) which were changed since the
last full database backup. SQL Server looks into the Differential Changed Map
(DCM) page to identify all the extents which were changed since the last full
database backup and captures only them; hence, often differential database
backup is very fast compared to taking a full database backup.
Transaction Log Backups:- Transaction log backup is supported only with either
Full recovery model or Bulk-logged recovery model and like differential database
backup, you must have taken a full database backup as its base. Transaction log
backup captures all the transaction log records that have been written after the
last full database backup or last transaction log backup.

Full Backups,Allows point-in-time recovery.

Recovery Processes-
• Recovery process:
Latest full backup (Required), Latest differential backup (Optional), Unbroken sequence of
transaction log backups (Optional)

• All transaction logs should be restored with NO RECOVERY option (except for the last
one)
Prevents database from being accessed while restore process is taking place
Relational Database Server Goals

Reliability Availability Scalability

Data Integrity
Transaction
Performance and
Isolation
Protection

Reporting Data Analysis


Relational Database Server Goals
• Scalability:-Database scalability is the ability to scale out or scale up
a database to allow it to hold increasing amounts of data without sacrificing
performance.
• Data Integrity & Protection:- data integrity ensures recoverability and
searchability, traceability (to origin), and connectivity. Protecting the validity
and accuracy of data also increases stability and performance while improving
reusability and maintainability
• Transaction Isolation:- prevents dirty reads, non repeatable reads, and
phantom reads
• Reporting:- SQL Server Reporting Services is a solution that customers deploy
on their own premises for creating, publishing, and managing reports, then
delivering them to the right users in different ways, whether that's viewing
them in web browser, on their mobile device, or as an email in their in-box.
• Data Analysis:- Data is stored in databases, and will enable you to access
and analyze this data with ease.
The SQL Overview
• The Structured Query Language (SQL) defines a standard for
interacting with relational databases
– Most platforms support ANSI-SQL 92
– Most platforms provide many non-ANSI-SQL additions

• Most important data modification SQL statements:


– SELECT: Returning rows
– UPDATE: Modifying existing rows
– INSERT: Creating new rows
– DELETE: Removing existing rows
SUMMARY
Microsoft SQL server is a complete data management package including relational
database server, full text indexing and search, XML data import and export,
distributed and heterogeneous data integration, analysis server and client for OLAP
(online analytical processing) and data mining, replication among heterogeneous data
stores, a programmable data transformation engine, and more.

The SQL server serves as a foundation of Microsoft’s suite of enterprise server


products. SQL server 2000 rounded out some of the feature groups started in earlier
releases and added entirely new functionality, including XML support.

The release currently being implemented is designed to augment the product’s ease of
use, ease of application development, robustness, performance, and scalability
features.
THANK YOU!

Das könnte Ihnen auch gefallen