MSSQL 2008 - ©2012 Hossein Zahed - AUT
Hossein Zahed
MCPD & .Net Teacher
Amir Kabir University of Technology
Email: hossein.aspx@gmail.com
Website: http://www.hzahed.com
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Data, Information, Knowledge
Data
 Facts of the world
 Your height, weight, color of your eyes
 Height and color of a tree
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Data, Information, Knowledge
Information
 Movable and Shareable data
 Beyond the range of your senses
 Photo, Music, Movie, …
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Data, Information, Knowledge
Knowledge
 What we know
 Processing information and data to
make decisions
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Database
Definition
 An organized collection of data, typically in
digital form
 Database System implies that the data is
managed to some level of quality (measured
in terms
of accuracy, availability, usability, and
resilience)
 The availability of rooms in hotels
 Finding a hotel with vacancies
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Database
Types
 Active Database: security
monitoring, alerting, statistics gathering and
authorization
 Cloud Database: in the cloud
 Data Warehouse: data centers
 Distributed database: a single DBMS over
processes, computers, and sites
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Database
Types - Continued
 Document-Oriented Database:
storing, retrieving, and managing document-
oriented, or semi structured data, information
 Embedded Database: requires access to stored
data in a way that the DBMS is “hidden” from the
application’s end-user and requires little or no
ongoing maintenance
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Database
Types - Continued
 Real-time Database: responses users' request in
a given time period, it can be regarded as a real
time database
 Temporal Database: a database with built-in time
aspects, for example a temporal data model and
a temporal version of Structured Query Language
(SQL)
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Database Management System
(DBMS)
Well Known Examples
 Microsoft SQL Server
 Oracle
 IBM DB2
 MySQL
 PosterSQL
 Microsoft Access
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Specifications
 Relational Database Management System
(RDBMS): means that data is stored in tables
and the relationships among the data are also
stored in tables. The data can be accessed or
reassembled in many different ways without
having to change the table forms.
 Primary Query Language: Transact SQL
known as T-SQL
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Versions
 Genesis: Sybase SQL Server to Microsoft – 1989
 Microsoft SQL 2000
 Microsoft SQL 2005
 Microsoft SQL 2008
 Microsoft SQL Azure – Cloud DB
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Versions - Continued
 Microsoft SQL Server 2008 R2
 Microsoft SQL Server 2012
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Editions
 Datacenter
 Enterprise
 Developer
 Standard
 Web
 Workgroup
 Express
 Azure
 Compact (SQL CE)
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Architecture
 Protocol Layer: Protocol layer implements the external interface
to SQL Server. All operations that can be invoked on SQL Server are
communicated to it via a Microsoft-defined format, called Tabular Data
Stream (TDS). TDS is an application layer protocol, used to transfer data
between a database server and a client. Initially designed and developed
by Sybase Inc. for their Sybase SQL Server relational database engine
in 1984, and later by Microsoft in Microsoft SQL Server, TDS packets
can be encased in other physical transport dependent
protocols, including TCP/IP, Named pipes, and Shared memory.
Consequently, access to SQL Server is available over these protocols. In
addition, the SQL Server API is also exposed over web services.
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Architecture - Continued
 Data Storage:
 Data Types: integer, decimal, char, varchar, datetime, …
 UDT (User-Defined Data Types)
 DBO (Database Objects):
tables, views, indexes, logs, stored procedures
 Maximum 231 objects
 Maximum Database Volume: 220 TB
 Primary (Master) Data File extension: .mdf
 Secondary Data File (Metadata) extension: .ndf
 Log Data File extension: .ldf
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Architecture - Continued
 Buffer Management:
 Storage space allocated to a database is divided into
sequentially numbered pages, each 8 KB in size.
 A page is the basic unit of I/O for SQL Server operations.
 SQL Server buffers pages in RAM to minimize disc I/O.
 The amount of memory available to SQL Server decides
how many pages will be cached in memory. The buffer
cache is managed by the Buffer Manager.
 The page is updated on the disc by the Buffer Manager
only if the in-memory cache has not been referenced for
some time.
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Architecture - Continued
 Loggin & Transactions:
 SQL Server ensures that any change to the data
is ACID-compliant.
(Atomicity, Consistency, Isolation, Durability)
 It uses transactions to ensure that the database will
always revert to a known consistent state on failure.
 All the operations performed will be written to a
log, along with the transaction ID which the operation
was a part of. Each log entry is identified by an
increasing Log Sequence Number (LSN) which is used
to ensure that all changes are written to the data files.
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Architecture - Continued
 Concurrency & Locking:
 Multi users using the same database at the same time
 Pessimistic Concurrency
 Exclusive: no access for other users
 Shared: read access for other users
 Optimistic Concurrency
 A new row created in Tempdb
 2 Rows added if they are different
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Architecture - Continued
 Data Retrival:
 The main mode of retrieving data from an SQL Server
database is querying for it using T-SQL.
 T-SQL ► Query ► Query Processor ► Query Plan ►
Selecting Optimized Query (by Time) ► Execute
 Stored Procedures (SP): Parameterized T-SQL Queries
that can have input/output results
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Architecture - Continued
 SQL CLR (Common Langauge Runtime):
 SQL Server has it’s own .Net Framework Runtime (CLR)
 OS Independent in Memory Management, Threading
and Resource Management
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services
 Service Broker:
 Guarantees internal/external processes between
instances of SQL on the same server or external
servers.
 Communicates over TCP/IP and allows the different
components to be synchronized together, via exchange
of messages.
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services - Continued
 Replication:
 Replicate / Synchronize database objects
1. Transaction Replication: Each transaction in publisher
is synched out to subscribers (almost realtime)
2. Merged Replication: Changes made to both publisher
and subscribers are synchronized Bi-Directionally
3. Snapshot Replication: A copy of database is sent out
from publisher to subscribers at a certain time.
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services - Continued
 Analysis Services:
 Adds OLAP and Data Mining capabilities for SQL
Server databases
 OLAP (Online Analytical Processing): shortly answers
Multi-Dimensional analytical queries using the
following technics (MOLAP / ROLAP / HOLAP)
 Data Mining: Decision Trees, Clustering
Algorithm, Navie Bayes, Time
Series, Regression, Logistic, Neural Networks, Genetic
Algorithm
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services - Continued
 Reporting Services:
 A report generation environment for data gathered from
SQL Server databases
 RDL files can be rendered in a variety of
formats including Excel, PDF, CSV, XML, TIFF (and
other image formats) and HTML
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services - Continued
 Integration Services:
 Is used to integrate data from different data sources
 Includes GUI tools to build data extraction workflows
integration various functionality such as extracting
data from various sources, querying data, transforming
data including aggregating, duplication and merging
data, and then loading the transformed data onto other
sources, or sending e-mails detailing the status of the
operation as defined by the user
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services - Continued
 Notification Service:
 Originally introduced as a post-release add-on for SQL
Server 2000
 A mechanism for generating data-driven
notifications, which are sent to Notification Services
subscribers
 Used one of three methods to send a message to the
subscriber informing about the occurrence of the
event. These methods include SMTP, SOAP, or by
writing to a file in the filesystem.
 Deprecated in MSSQL 2008 by introducing Agents
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services - Continued
 Full Text Search Service:
 A specialized indexing and querying service for
unstructured text stored in SQL Server databases
 The full text search index can be created on any
column with character based text data. It allows for
words to be searched for in the text columns
 The Full Text Search engine is divided into two
processes - the Filter Daemon process (msftefd.exe)
and the Search process (msftesql.exe)
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Services - Continued
 Full Text Search Service:
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Development Tools
 SQL CMD (Command Line)
 SQL Management Studio (2005/2008/20012)
 Visual Studio (2005/2008/2010)
 Business Intelligence Development Studio
 SQL Native Client
MSSQL 2008 - ©2012 Hossein Zahed - AUT
Microsoft SQL Server
Questions & Answers

Microsoft SQL Server 2008

  • 1.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Hossein Zahed MCPD & .Net Teacher Amir Kabir University of Technology Email: hossein.aspx@gmail.com Website: http://www.hzahed.com
  • 2.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Data, Information, Knowledge Data  Facts of the world  Your height, weight, color of your eyes  Height and color of a tree
  • 3.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Data, Information, Knowledge Information  Movable and Shareable data  Beyond the range of your senses  Photo, Music, Movie, …
  • 4.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Data, Information, Knowledge Knowledge  What we know  Processing information and data to make decisions
  • 5.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Database Definition  An organized collection of data, typically in digital form  Database System implies that the data is managed to some level of quality (measured in terms of accuracy, availability, usability, and resilience)  The availability of rooms in hotels  Finding a hotel with vacancies
  • 6.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Database Types  Active Database: security monitoring, alerting, statistics gathering and authorization  Cloud Database: in the cloud  Data Warehouse: data centers  Distributed database: a single DBMS over processes, computers, and sites
  • 7.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Database Types - Continued  Document-Oriented Database: storing, retrieving, and managing document- oriented, or semi structured data, information  Embedded Database: requires access to stored data in a way that the DBMS is “hidden” from the application’s end-user and requires little or no ongoing maintenance
  • 8.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Database Types - Continued  Real-time Database: responses users' request in a given time period, it can be regarded as a real time database  Temporal Database: a database with built-in time aspects, for example a temporal data model and a temporal version of Structured Query Language (SQL)
  • 9.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Database Management System (DBMS) Well Known Examples  Microsoft SQL Server  Oracle  IBM DB2  MySQL  PosterSQL  Microsoft Access
  • 10.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Specifications  Relational Database Management System (RDBMS): means that data is stored in tables and the relationships among the data are also stored in tables. The data can be accessed or reassembled in many different ways without having to change the table forms.  Primary Query Language: Transact SQL known as T-SQL
  • 11.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Versions  Genesis: Sybase SQL Server to Microsoft – 1989  Microsoft SQL 2000  Microsoft SQL 2005  Microsoft SQL 2008  Microsoft SQL Azure – Cloud DB
  • 12.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Versions - Continued  Microsoft SQL Server 2008 R2  Microsoft SQL Server 2012
  • 13.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Editions  Datacenter  Enterprise  Developer  Standard  Web  Workgroup  Express  Azure  Compact (SQL CE)
  • 14.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Architecture  Protocol Layer: Protocol layer implements the external interface to SQL Server. All operations that can be invoked on SQL Server are communicated to it via a Microsoft-defined format, called Tabular Data Stream (TDS). TDS is an application layer protocol, used to transfer data between a database server and a client. Initially designed and developed by Sybase Inc. for their Sybase SQL Server relational database engine in 1984, and later by Microsoft in Microsoft SQL Server, TDS packets can be encased in other physical transport dependent protocols, including TCP/IP, Named pipes, and Shared memory. Consequently, access to SQL Server is available over these protocols. In addition, the SQL Server API is also exposed over web services.
  • 15.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Architecture - Continued  Data Storage:  Data Types: integer, decimal, char, varchar, datetime, …  UDT (User-Defined Data Types)  DBO (Database Objects): tables, views, indexes, logs, stored procedures  Maximum 231 objects  Maximum Database Volume: 220 TB  Primary (Master) Data File extension: .mdf  Secondary Data File (Metadata) extension: .ndf  Log Data File extension: .ldf
  • 16.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Architecture - Continued  Buffer Management:  Storage space allocated to a database is divided into sequentially numbered pages, each 8 KB in size.  A page is the basic unit of I/O for SQL Server operations.  SQL Server buffers pages in RAM to minimize disc I/O.  The amount of memory available to SQL Server decides how many pages will be cached in memory. The buffer cache is managed by the Buffer Manager.  The page is updated on the disc by the Buffer Manager only if the in-memory cache has not been referenced for some time.
  • 17.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Architecture - Continued  Loggin & Transactions:  SQL Server ensures that any change to the data is ACID-compliant. (Atomicity, Consistency, Isolation, Durability)  It uses transactions to ensure that the database will always revert to a known consistent state on failure.  All the operations performed will be written to a log, along with the transaction ID which the operation was a part of. Each log entry is identified by an increasing Log Sequence Number (LSN) which is used to ensure that all changes are written to the data files.
  • 18.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Architecture - Continued  Concurrency & Locking:  Multi users using the same database at the same time  Pessimistic Concurrency  Exclusive: no access for other users  Shared: read access for other users  Optimistic Concurrency  A new row created in Tempdb  2 Rows added if they are different
  • 19.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Architecture - Continued  Data Retrival:  The main mode of retrieving data from an SQL Server database is querying for it using T-SQL.  T-SQL ► Query ► Query Processor ► Query Plan ► Selecting Optimized Query (by Time) ► Execute  Stored Procedures (SP): Parameterized T-SQL Queries that can have input/output results
  • 20.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Architecture - Continued  SQL CLR (Common Langauge Runtime):  SQL Server has it’s own .Net Framework Runtime (CLR)  OS Independent in Memory Management, Threading and Resource Management
  • 21.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services  Service Broker:  Guarantees internal/external processes between instances of SQL on the same server or external servers.  Communicates over TCP/IP and allows the different components to be synchronized together, via exchange of messages.
  • 22.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services - Continued  Replication:  Replicate / Synchronize database objects 1. Transaction Replication: Each transaction in publisher is synched out to subscribers (almost realtime) 2. Merged Replication: Changes made to both publisher and subscribers are synchronized Bi-Directionally 3. Snapshot Replication: A copy of database is sent out from publisher to subscribers at a certain time.
  • 23.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services - Continued  Analysis Services:  Adds OLAP and Data Mining capabilities for SQL Server databases  OLAP (Online Analytical Processing): shortly answers Multi-Dimensional analytical queries using the following technics (MOLAP / ROLAP / HOLAP)  Data Mining: Decision Trees, Clustering Algorithm, Navie Bayes, Time Series, Regression, Logistic, Neural Networks, Genetic Algorithm
  • 24.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services - Continued  Reporting Services:  A report generation environment for data gathered from SQL Server databases  RDL files can be rendered in a variety of formats including Excel, PDF, CSV, XML, TIFF (and other image formats) and HTML
  • 25.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services - Continued  Integration Services:  Is used to integrate data from different data sources  Includes GUI tools to build data extraction workflows integration various functionality such as extracting data from various sources, querying data, transforming data including aggregating, duplication and merging data, and then loading the transformed data onto other sources, or sending e-mails detailing the status of the operation as defined by the user
  • 26.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services - Continued  Notification Service:  Originally introduced as a post-release add-on for SQL Server 2000  A mechanism for generating data-driven notifications, which are sent to Notification Services subscribers  Used one of three methods to send a message to the subscriber informing about the occurrence of the event. These methods include SMTP, SOAP, or by writing to a file in the filesystem.  Deprecated in MSSQL 2008 by introducing Agents
  • 27.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services - Continued  Full Text Search Service:  A specialized indexing and querying service for unstructured text stored in SQL Server databases  The full text search index can be created on any column with character based text data. It allows for words to be searched for in the text columns  The Full Text Search engine is divided into two processes - the Filter Daemon process (msftefd.exe) and the Search process (msftesql.exe)
  • 28.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Services - Continued  Full Text Search Service:
  • 29.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Development Tools  SQL CMD (Command Line)  SQL Management Studio (2005/2008/20012)  Visual Studio (2005/2008/2010)  Business Intelligence Development Studio  SQL Native Client
  • 30.
    MSSQL 2008 -©2012 Hossein Zahed - AUT Microsoft SQL Server Questions & Answers