SlideShare uma empresa Scribd logo
1 de 39
Agenda
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

Elements of a Failover Cluster Instance
       A failover cluster instance can run on one or more computers that are participating nodes of a failover
        cluster. The number of participating nodes is limited only by the operating system.
       A failover cluster instance contains:
            A combination of one or more disks in a Microsoft Cluster Service (MSCS) cluster group, also known as
             a resource group.
            Each resource group can contain at most one instance of SQL Server.
            A network name for the failover cluster instance.
            One or more IP addresses assigned to the failover cluster instance.
            One instance of SQL Server 2005 that includes SQL Server, SQL Server Agent, and the Full-text Search
             (FTS) service.

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

 SELECT SQL Statement (SELECT [CustomerID], [CompanyName], [City], [Region]
   FROM [Northwind].[dbo].[Customers]
   WHERE [Country] = 'Germany'
   ORDER BY [CompanyName]) then
                            press Ctrl+K,it will display the following:
 Reading the Graphical Execution Plan
 the execution plan for the aforementioned query and we'll begin the
  discussion on how to read such a plan. It is slightly nonsensical to those of us
  in Western culture and you'll see why in a second.
Select “where clause” evaluation order

 select a from table where c=1 and d=2
• There are no guarantees for evaluation order. The optimizer will try to find the most
  efficient way to execute the query, using available information.
• In above case, since c is indexed(assume) and d isn't, the optimizer should look into the
  index to find all rows that match the predicate on c, then retrieve those rows from the
  table data to evaluate the predicate on d.
• However, if it determines that the index on c isn't very selective (although not in
  example, a gender column is rarely usefully indexed), it may decide to do the table scan
  anyway, but Default order is :
1.   FROM clause
2.   WHERE clause
3.   GROUP BY clause
4.   HAVING clause
5.   SELECT clause
6.   ORDER BY clause
Storage Engine
Storage Engine is responsible for the following:



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,

 there are   2 types of files that are created at the disk
 level

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

This lies between the host machine (Windows OS)
 and SQL Server
All the activities performed on database engine are
 taken care of by SQL OS
It is a highly configurable operating system with
 powerful API (application programming interface)
It enables automatic locality and advanced
 parallelism
SQL OS provides various operating system services :
As mentioned in below :
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

         Physical Dat abase
         Design and Tuning
New Features of SQL Server 2012
T-SQL Features
   Table Value Parameters
   FileStream Object Storage
   Merge
   Variable initializers
   Row constructors with >1 row
   Compound operators (+=)
   Grouping sets (extension of Group By clause)
   Intellisense added
   New Collations
   CLR UDT 2GB capacity
   Integrated Full Text Search
   Sparse Columns (Indexing)
   Sequence
   Page Data
   Exception Handling
   Enhanced EXECUTE keyword
   Get Metadata
T-SQL Data Types
Geometery (for planar shapes, i.e. whse layout)
Geography (for GPS coordinates)
HierarchyID
date
time
datetime2
Datetimeoffset (timezone )
New Features In SQL serer 2012
New Data type Conversion
1. PARSE Conversion Function
  2. TRY_PARSE Conversion Function
  3. TRY_CONVERT Conversion Function
Uses Example:
SELECT StateProvinceID ,StateProvinceCode
  ,PARSE(StateProvinceCode AS INT) AS [Using PARSE
  Function] FROM Person.StateProvince WHERE
  CountryRegionCode IN ('FR') AND Name IN
  ('Vienne')
Date/Time Variables
SQL Server 2005:
       Type                Accuracy                  Range
Smalldatetime    1 min                1900-1-1 to 2079-6-6
Datetime         3.33 mS              1753-1-1 to 9999-12-31



SQL Server 2008:
       Type                Accuracy                 Range
Date             1 day                1-1-1 to 9999-12-31
time             100 nS               00:00:00 to 23:59.59.9999999
datetime2        100 nS               1-1-1 00:00:00 to
                                      9999-12-31 23:59.59.9999999
datetimeoffset   100 nS               1-1-1 00:00:00 to
                                      9999-12-31 23:59.59.9999999
Filestream
Filestream storage attribute on varbinary(max)
 column
Includes transactional access through Win32 API
  PathName()
  Get_Filestream_Transaction_context()
  OpenSqlFileStream()
Other Important Features
OVER Clause is enhanced with ROWS/RANGE
  Clause to limit the rows
 Suppose, to calculate sum of last 5 yrs revenue for every row,
 Ex.ROWS BETWEEN 4 PRECEDING AND CURRENT ROW
 Suppose to calculate sum of all preceding years(Cumulative sum),
 Ex.ROWS UNBOUNDED PRECEDING
 SQL Server 2012 provides a function EOMONTH() to calculate end
  date of a month.
 DECLARE @Currentdate DATETIME SET @Currentdate = '12/12/2010'
  SELECT EOMONTH ( @Currentdate ) AS EndofMonth;
 /*Result: 2010-12-31*/
 FORCESEEK hint is extended to specify columns used to seek in the specified index
 SELECT CompanyID,CompanyName,Amount
 FROM COMPANIES
 WITH (FORCESEEK(Idx_Company(CompanyID)))
 WHERE CompanyID = 1
 OVER Clause is enhanced to apply aggregate functions while applying "Order By“
 SUM(Amount) OVER (PARTITION BY CompanyID ORDER BY Year)
 Ex. SELECT CompanyId,[Year],Amount,
 SUM(Amount) OVER (PARTITION BY CompanyID
 ORDER BY [Year]) AS CumulativeRevenue
 FROM @Companies
 LOG function has been enhanced to accept any base
 SELECT LOG(10) as Result -- Returns natural logarithm value of 10. Natural base is e. its
  value 2.718
 SELECT LOG(9,3) as Result1-- Returns logarithm value of base 3.
Disaster         recovery :
disasters include :
•A natural or a man-made disaster such as a fire,
•A technical disaster such as a two-disk failure in a Redundant Array of
Independent Disks (RAID) 5 array
•Recovery:
A process that you can use to help recover information systems and data


Before you decide on which disaster recovery solution is best for you


look at each of the suggested disaster recovery solutions in more detail.
Failover clustering:
•Microsoft SQL Server failover clustering is designed to failover automatically if a hardware failure or
a software failure occurs.

•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.


The following operating systems support failover clustering:

Microsoft Windows NT 4.0, Enterprise Edition
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows Server 2003, Enterprise Edition
Microsoft Windows Server 2003, Datacenter Edition

Microsoft Cluster Service (MSCS): To implement failover clustering for SQL
Server, you must install MSCS from operating systems.
Database mirroring

             •   Solution for increasing database availability
             •   can only implement mirroring on a per-database basis
             •   Mirroring only works with databases that use the full recovery model
             •   Database mirroring works with any supported database compatibility level

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

    • Peer-to-peer transactional replication is designed for applications that
      might read or might modify the data in any database that participates
      in replication
    • if any servers that host the databases are unavailable, you can modify
      the application to route traffic to the remaining servers. The remaining
      servers contain identical copies of the data
Advantages:
•Read performance is improved because you can spread activity across all nodes.
•Aggregate update performance, insert performance, and delete performance for the topology
resembles the performance of a single node because all changes are propagated to all nodes.
Disadvantages:
•Peer-to-peer replication is available only in SQL Server 2005 Enterprise Edition.
•All participating databases must contain identical schemas and data.
•We recommend that each node use its own distribution database. This configuration eliminates the
potential for SQL Server 2005 to have a single point of failure.
•You cannot include tables and other objects in multiple peer-to-peer publications within a single
publication database.
•You must have a publication enabled for peer-to-peer replication before you create any subscriptions.
•You must initialize subscriptions by using a backup or by setting the value of the subscription
synchronization type to replication support only.
•Peer-to-peer transactional replication does not provide conflict detection or conflict resolution.
•We recommend that you do not use identity columns.
Configure Replication for Always On Availability Groups


1.   Configure the database publications and subscriptions.
2.   Configure the Always On availability group.
3.   Insure that all secondary replica hosts are configured for replication.
4.   Configure the secondary replica hosts as replication publishers.
5.   Redirect the original publisher to the Availability Group Listener Name.
6.   Run the validation stored procedure to verify the configuration.
7.   Add the original publisher to Replication Monitor.
Ms sql server architecture

Mais conteúdo relacionado

Mais procurados

Date warehousing concepts
Date warehousing conceptsDate warehousing concepts
Date warehousing concepts
pcherukumalla
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
Abdul Manaf
 

Mais procurados (20)

Date warehousing concepts
Date warehousing conceptsDate warehousing concepts
Date warehousing concepts
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
 
Azure SQL Database Managed Instance
Azure SQL Database Managed InstanceAzure SQL Database Managed Instance
Azure SQL Database Managed Instance
 
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
 
Introduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerIntroduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard Broker
 
Non relational databases-no sql
Non relational databases-no sqlNon relational databases-no sql
Non relational databases-no sql
 
ASH and AWR on DB12c
ASH and AWR on DB12cASH and AWR on DB12c
ASH and AWR on DB12c
 
Oracle archi ppt
Oracle archi pptOracle archi ppt
Oracle archi ppt
 
Oracle data guard for beginners
Oracle data guard for beginnersOracle data guard for beginners
Oracle data guard for beginners
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
 
Lecture2 oracle ppt
Lecture2 oracle pptLecture2 oracle ppt
Lecture2 oracle ppt
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
The oracle database architecture
The oracle database architectureThe oracle database architecture
The oracle database architecture
 
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data StreamingOracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
Oracle GoldenGate and Apache Kafka: A Deep Dive Into Real-Time Data Streaming
 
Analyzing awr report
Analyzing awr reportAnalyzing awr report
Analyzing awr report
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep Internal
 
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
Best Practices for Running PostgreSQL on AWS - DAT314 - re:Invent 2017
 

Semelhante a Ms sql server architecture

SQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture OverviewSQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture Overview
Jerry Yang
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
Concentrated Technology
 

Semelhante a Ms sql server architecture (20)

Sql server
Sql serverSql server
Sql server
 
SQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture OverviewSQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture Overview
 
Sql server
Sql serverSql server
Sql server
 
Sql Server
Sql ServerSql Server
Sql Server
 
ora_sothea
ora_sotheaora_sothea
ora_sothea
 
SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
 
R12 d49656 gc10-apps dba 07
R12 d49656 gc10-apps dba 07R12 d49656 gc10-apps dba 07
R12 d49656 gc10-apps dba 07
 
Tech Days09 Sqldev
Tech Days09 SqldevTech Days09 Sqldev
Tech Days09 Sqldev
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developers
 
SQL Server 2008 for .NET Developers
SQL Server 2008 for .NET DevelopersSQL Server 2008 for .NET Developers
SQL Server 2008 for .NET Developers
 
Managing SQLserver
Managing SQLserverManaging SQLserver
Managing SQLserver
 
SQL Server - High availability
SQL Server - High availabilitySQL Server - High availability
SQL Server - High availability
 
Azure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL ServerAzure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL Server
 
Fudcon talk.ppt
Fudcon talk.pptFudcon talk.ppt
Fudcon talk.ppt
 
Module02
Module02Module02
Module02
 
Investigate SQL Server Memory Like Sherlock Holmes
Investigate SQL Server Memory Like Sherlock HolmesInvestigate SQL Server Memory Like Sherlock Holmes
Investigate SQL Server Memory Like Sherlock Holmes
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developers
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
 
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Ms sql server architecture

  • 1.
  • 2. Agenda Relational Engine Storage Engine SQL OS New Features of SQL Server 2012 Q&A
  • 5. SQL Server Components Databases Database Files and File Groups Transaction Logs Backup and Recovery Microsoft Cluster Server Protocols Disaster Recovery
  • 6. SQL Server Databases System databases Master Model MSDB Resource Tempdb User databases
  • 7. SQL Server Files Binaries Datafiles (.mdf, .ndf) Transaction log files (.ldf) Backup files and snapshot files File groups
  • 8. 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.
  • 9. 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
  • 10. Microsoft Cluster Server Elements of a Failover Cluster Instance  A failover cluster instance can run on one or more computers that are participating nodes of a failover cluster. The number of participating nodes is limited only by the operating system.  A failover cluster instance contains:  A combination of one or more disks in a Microsoft Cluster Service (MSCS) cluster group, also known as a resource group.  Each resource group can contain at most one instance of SQL Server.  A network name for the failover cluster instance.  One or more IP addresses assigned to the failover cluster instance.  One instance of SQL Server 2005 that includes SQL Server, SQL Server Agent, and the Full-text Search (FTS) service. Implementation Considerations  Hardware  Software  Network
  • 11. 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
  • 12. Different Tasks of Relational Engine: Query Processing Memory Management Thread and Task Management Buffer Management Distributed Query Processing
  • 13. Query Processing  SELECT SQL Statement (SELECT [CustomerID], [CompanyName], [City], [Region] FROM [Northwind].[dbo].[Customers] WHERE [Country] = 'Germany' ORDER BY [CompanyName]) then press Ctrl+K,it will display the following:  Reading the Graphical Execution Plan  the execution plan for the aforementioned query and we'll begin the discussion on how to read such a plan. It is slightly nonsensical to those of us in Western culture and you'll see why in a second.
  • 14. Select “where clause” evaluation order select a from table where c=1 and d=2 • There are no guarantees for evaluation order. The optimizer will try to find the most efficient way to execute the query, using available information. • In above case, since c is indexed(assume) and d isn't, the optimizer should look into the index to find all rows that match the predicate on c, then retrieve those rows from the table data to evaluate the predicate on d. • However, if it determines that the index on c isn't very selective (although not in example, a gender column is rarely usefully indexed), it may decide to do the table scan anyway, but Default order is : 1. FROM clause 2. WHERE clause 3. GROUP BY clause 4. HAVING clause 5. SELECT clause 6. ORDER BY clause
  • 15. Storage Engine Storage Engine is responsible for the following: Storage of data Retrieval of data
  • 16. 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 (
  • 17. Database Files When we talk about any database in SQL server, there are 2 types of files that are created at the disk level 1.Data file 2.Log file
  • 18. 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
  • 19. 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
  • 20. Log files Do not contain pages; they contain a series of log records. Need to updated it ……………….
  • 21. 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
  • 22. SQL OS This lies between the host machine (Windows OS) and SQL Server All the activities performed on database engine are taken care of by SQL OS It is a highly configurable operating system with powerful API (application programming interface) It enables automatic locality and advanced parallelism SQL OS provides various operating system services : As mentioned in below :
  • 23. 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.
  • 24. 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
  • 25. Physical design and Index Selection Physical Dat abase Design and Tuning
  • 26. New Features of SQL Server 2012
  • 27. T-SQL Features  Table Value Parameters  FileStream Object Storage  Merge  Variable initializers  Row constructors with >1 row  Compound operators (+=)  Grouping sets (extension of Group By clause)  Intellisense added  New Collations  CLR UDT 2GB capacity  Integrated Full Text Search  Sparse Columns (Indexing)  Sequence  Page Data  Exception Handling  Enhanced EXECUTE keyword  Get Metadata
  • 28. T-SQL Data Types Geometery (for planar shapes, i.e. whse layout) Geography (for GPS coordinates) HierarchyID date time datetime2 Datetimeoffset (timezone )
  • 29. New Features In SQL serer 2012 New Data type Conversion 1. PARSE Conversion Function 2. TRY_PARSE Conversion Function 3. TRY_CONVERT Conversion Function Uses Example: SELECT StateProvinceID ,StateProvinceCode ,PARSE(StateProvinceCode AS INT) AS [Using PARSE Function] FROM Person.StateProvince WHERE CountryRegionCode IN ('FR') AND Name IN ('Vienne')
  • 30. Date/Time Variables SQL Server 2005: Type Accuracy Range Smalldatetime 1 min 1900-1-1 to 2079-6-6 Datetime 3.33 mS 1753-1-1 to 9999-12-31 SQL Server 2008: Type Accuracy Range Date 1 day 1-1-1 to 9999-12-31 time 100 nS 00:00:00 to 23:59.59.9999999 datetime2 100 nS 1-1-1 00:00:00 to 9999-12-31 23:59.59.9999999 datetimeoffset 100 nS 1-1-1 00:00:00 to 9999-12-31 23:59.59.9999999
  • 31. Filestream Filestream storage attribute on varbinary(max) column Includes transactional access through Win32 API PathName() Get_Filestream_Transaction_context() OpenSqlFileStream()
  • 32. Other Important Features OVER Clause is enhanced with ROWS/RANGE Clause to limit the rows  Suppose, to calculate sum of last 5 yrs revenue for every row,  Ex.ROWS BETWEEN 4 PRECEDING AND CURRENT ROW  Suppose to calculate sum of all preceding years(Cumulative sum),  Ex.ROWS UNBOUNDED PRECEDING  SQL Server 2012 provides a function EOMONTH() to calculate end date of a month.  DECLARE @Currentdate DATETIME SET @Currentdate = '12/12/2010' SELECT EOMONTH ( @Currentdate ) AS EndofMonth;  /*Result: 2010-12-31*/
  • 33.  FORCESEEK hint is extended to specify columns used to seek in the specified index  SELECT CompanyID,CompanyName,Amount  FROM COMPANIES  WITH (FORCESEEK(Idx_Company(CompanyID)))  WHERE CompanyID = 1  OVER Clause is enhanced to apply aggregate functions while applying "Order By“  SUM(Amount) OVER (PARTITION BY CompanyID ORDER BY Year)  Ex. SELECT CompanyId,[Year],Amount,  SUM(Amount) OVER (PARTITION BY CompanyID  ORDER BY [Year]) AS CumulativeRevenue  FROM @Companies  LOG function has been enhanced to accept any base  SELECT LOG(10) as Result -- Returns natural logarithm value of 10. Natural base is e. its value 2.718  SELECT LOG(9,3) as Result1-- Returns logarithm value of base 3.
  • 34. Disaster recovery : disasters include : •A natural or a man-made disaster such as a fire, •A technical disaster such as a two-disk failure in a Redundant Array of Independent Disks (RAID) 5 array •Recovery: A process that you can use to help recover information systems and data Before you decide on which disaster recovery solution is best for you look at each of the suggested disaster recovery solutions in more detail.
  • 35. Failover clustering: •Microsoft SQL Server failover clustering is designed to failover automatically if a hardware failure or a software failure occurs. •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. The following operating systems support failover clustering: Microsoft Windows NT 4.0, Enterprise Edition Microsoft Windows 2000 Advanced Server Microsoft Windows 2000 Datacenter Server Microsoft Windows Server 2003, Enterprise Edition Microsoft Windows Server 2003, Datacenter Edition Microsoft Cluster Service (MSCS): To implement failover clustering for SQL Server, you must install MSCS from operating systems.
  • 36. Database mirroring • Solution for increasing database availability • can only implement mirroring on a per-database basis • Mirroring only works with databases that use the full recovery model • Database mirroring works with any supported database compatibility level 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
  • 37. Peer-to-peer transactional replication • Peer-to-peer transactional replication is designed for applications that might read or might modify the data in any database that participates in replication • if any servers that host the databases are unavailable, you can modify the application to route traffic to the remaining servers. The remaining servers contain identical copies of the data Advantages: •Read performance is improved because you can spread activity across all nodes. •Aggregate update performance, insert performance, and delete performance for the topology resembles the performance of a single node because all changes are propagated to all nodes. Disadvantages: •Peer-to-peer replication is available only in SQL Server 2005 Enterprise Edition. •All participating databases must contain identical schemas and data. •We recommend that each node use its own distribution database. This configuration eliminates the potential for SQL Server 2005 to have a single point of failure. •You cannot include tables and other objects in multiple peer-to-peer publications within a single publication database. •You must have a publication enabled for peer-to-peer replication before you create any subscriptions. •You must initialize subscriptions by using a backup or by setting the value of the subscription synchronization type to replication support only. •Peer-to-peer transactional replication does not provide conflict detection or conflict resolution. •We recommend that you do not use identity columns.
  • 38. Configure Replication for Always On Availability Groups 1. Configure the database publications and subscriptions. 2. Configure the Always On availability group. 3. Insure that all secondary replica hosts are configured for replication. 4. Configure the secondary replica hosts as replication publishers. 5. Redirect the original publisher to the Availability Group Listener Name. 6. Run the validation stored procedure to verify the configuration. 7. Add the original publisher to Replication Monitor.

Notas do Editor

  1. Policy: “Declarative Management Framework” (DMF) is now “Policy Based Framework”
  2. No longer limited to 8000 bytes of data, but 2GB in SS2008
  3. No longer limited to 8000 bytes of data, but 2GB in SS2008