Untitled
Untitled
Relational Engine
Storage Engine
SQL OS
New Features of SQL Server 2012
Q&A
SQL Server Architecture
Protocol Used Area
SQL Server Components
Databases
Database Files and File Groups
Transaction Logs
Backup and Recovery
Microsoft Cluster Server
Protocols
Disaster Recovery
SQL Server Databases
System databases
Master
Model
MSDB
Resource
Tempdb
User databases
SQL Server Files
Binaries
Datafiles (.mdf, .ndf)
Transaction log files (.ldf)
Backup files and snapshot files
File groups
SQL Server Transaction Log
When the end of the logical log reaches the end of the physical log file,
the new log records wrap around to the start of the physical log file.
SQL Server Recovery Model
Recovery Description Work Loss Exposure Recover to point
Model in time?
Simple No log Changes since the most Can recover only to
backups recent backup are the end of a backup
unprotected
Full Requires log Normally none Can recover to a
backups specific point in
time
Bulk logged Requires log If the log is damaged or Point in time is not
backups bulk-logged operations supported
occurred since the most
recent log backup, changes
since the last backup must
be redone
9
Microsoft Cluster Server
Implementation Considerations
Hardware
Software
Network
Relational Engine
Query Processor
It includes the components of SQL Server that
determine what your query exactly needs to do and
the best way to do it. It manages the execution of
queries as it requests data from the storage engine
and processes the results returned
Different Tasks of Relational Engine:
Query Processing
Memory Management
Thread and Task Management
Buffer Management
Distributed Query Processing
Query Processing
Storage of data
Retrieval of data
Data Pages in Buffer Pool – Data Stored in Memory Cache
• if there is any way one can know how much data in a table is stored
in the memory cache?
• if there are multiple indexes on table (and used in a query), were the
data of the single table stored multiple times in the memory cache or
only for a single time?
Query ,run to figure out what kind of data is stored in the cache
SELECT COUNT(*) AS cached_pages_count,
name AS BaseTableName, IndexName,
IndexTypeDesc
FROM sys.dm_os_buffer_descriptors AS bd
INNER JOIN
(
SELECT s_obj.name, s_obj.index_id,
s_obj.allocation_unit_id, s_obj.OBJECT_ID,
i.name IndexName, i.type_desc IndexTypeDesc
FROM
(
Database Files
When we talk about any database in SQL server,
1.Data file
2.Log file
Data file
Data file physically stores the data in data pages.
The size for Data Page is 8KB.
Data pages are logically organized in extents
Extents
Extents are logical units in the database
combination of 8 data pages i.e. 64 KB forms an
extent
Extents can be of two types:
a)Mixed
b)Uniform
Log files
Do not contain pages; they contain a series of log
records.
Need to updated it ……………….
Log files
It also known as write ahead log.
It stores modification to the database (DML and DDL).
Sufficient information is logged to be able to:
Roll back transactions if requested
Recover the database in case of failure
Write Ahead Logging is used to create log entries
Transaction logs are written in chronological order in
a circular way
Truncation policy for logs is based on the recovery
model
SQL OS
Memory Management
Buffer Pool
Log Buffer
Deadlock detection using blocking and locking
structure.
Other Services. It includes following:
exception handling,
hosting for external components like Common
Language Runtime, CLR etc.
Partitioning
Allows tables and indexes to be split into a series of
ranges, with each range stored separately (most commonly
in separate file groups).
Each table or index can have up to 1000 partitions.
250 indexes x 1000 partitions x 3 allocation units = 750000
IAM chains.
Create Partition only on very large table.
Avoid it on small table/index
Physical design and Index Selection
Before you decide on which disaster recovery solution is best for you
•failover clustering is designed for high server availability with almost no server downtime
•To implement failover clustering, you must install Microsoft SQL Server Enterprise Edition.
Advantages
• Database mirroring increases data protection.
• Database mirroring increases availability of a database.
• Database mirroring improves the availability of the production database during upgrades.
Disadvantages
•The mirror database should be identical to the principal database. For example, all objects,
logins, and permissions should be identical.
•Database mirroring involves the transfer of information from one computer to another
computer over a network. Therefore, the security of the information that SQL Server transfers is
very important
Peer-to-peer transactional replication