Vous êtes sur la page 1sur 36

SQL Server 2005 Yukon Ascend

SQL Server 2005 Architecture


Engine architecture
Metadata (Catalog) Interface
Resource Database
sys schema
Catalog views
Catalog security


SQL Server Relational Engine
High-Level Architecture
Storage Engine (Access Methods, Database Page
Cache, Locking, Transactions, )
SQL-OS (Schedulers, Buffer Pool, Memory
Management, Synchronization Primitives, )
Query Optimization
(Plan Generation, View
Matching, Statistics,
Costing)
Query Execution
(Query Operators,
Memory Grants,
Parallelism)
Language Processing (Parse/Bind,
Statement/Batch Execution, Plan Cache
Management)
U
t
i
l
i
t
i
e
s

(
D
B
C
C
,


B
a
c
k
u
p

/

R
e
s
t
o
r
e
,

B
C
P
,

)

M
e
t
a
d
a
t
a
,

T
y
p
e

s
y
s
t
e
m
,

E
x
p
r
e
s
s
i
o
n

S
e
r
v
i
c
e
s

Scheduler
Memory Manager
Deadlock Monitor
Buffer Pool
Lock Manager
SQL CLR Hosting Layer
Synchronization
Services
SQL Messages RPC Messages HTTP messages
SQL OS



Algebraizer
T-SQL
Compiler
P
A
R
S
E
R
Query
Optimizer
SQL
Manager
T-SQL
Execution
CLR
Query
Execution
E
x
p
r
e
s
s
i
o
n

S
e
r
v
i
c
e
Execution Environment
Storage Engine
Results
METADATA Interface
User/Schema Separation
Allows you to drop a user
without dropping all objects:

(step 1) transfer schema
ownership to someone else
(step 2) drop original user

Moreover, applications still
work because the schema name
has not changed
Metadata (Catalog) Interface
Catalog Views - new interface to SQL catalog
Only interface that supports all new features
This is a new API
Permissions-based metadata access
You only see metadata for objects you own or can access
Changes to applications that directly access System Tables
DMVs - Views and Functions that dynamically show system state
Dynamic Management Views and Functions
Views over persisted catalog metadata
Catalog Views (new in Microsoft SQL Server 2005)
Compatibility Views (replace System Tables)
INFORMATION_SCHEMA Views (ANSI SQL-99)

The introduction of the sys schema
No more direct base table access - Use Catalog views!
Catalog Views - strive to be close to the DDL
sys.labels, sys.procedures, sys.views, sys.assemblies
The System Tables in SQL 2000 are now views
They are deprecated
Permissions-based metadata access
Metadata (Catalog) Interface
Resource Database
Read-only database contains code for system:
procedures, views, functions, assemblies, etc.
Resource database is to compiled System SQL code as DLLs
are to compiled C++ code
Does not show in sys.databases view
%\MSSQL.n\MSSQL\DATA\mssqlsystemresources.mdf
System objects are no longer persisted into master
Now in a resource database
Makes for faster service pack upgrades
Easier Rollbacks


Resource Database
Think of it as a code deployment mechanism
A pluggable database, a file copy
No more scripts to run at hot fix or service pack time
System catalog metadata persists in the resource database
Server-level data persisted in master
Per-database data persisted into each database
Master and user databases derive system objects
metadata from resource database
System objects shipped in the resource database not in
master
System objects appears in the sys schema of every
database
sys.sp_help, sys.tables, sys.objects,

Resource Database (cont.)
The sys schema
The schema that contains all the engines system objects
The catalog views, compatibility views, stored procedures,
functions, etc
The sys schema appears in every database
Metadata describing user objects is materialized through
catalog views in the sys schema
select * from sys.objects
Metadata describing the system objects themselves is
materialized through other catalog views in the sys
schema
select * from sys.system_objects
Similar concept to INFORMATION_SCHEMA

Object Types
SQL Server 2000 object types:

C = CHECK constraint
D = Default or DEFAULT constraint
F = FOREIGN KEY constraint
FN = Scalar function
IF = Inlined table-function
K =PRIMARY KEY or UNIQUE constraint
L =Log
P = Stored procedure
R = Rule
RF = Replication filter stored procedure
S =System table
TF = Table function
TR = Trigger
U = User table
V = View
X = Extended stored procedure
SQL Server 2005 object types:

AF =Aggregate Function (CLR)
C = Check constraint
D = Default (constraint or stand-alone)
F = Foreign-key constraint
PK =Primary-key constraint
P = SQL Stored-Procedure
PC =Assembly (CLR) Stored-Procedure
FN = SQL Scalar-Function
FS =Assembly (CLR) Scalar-Function
FT =Assembly (CLR) Table-valued Function
IF = SQL Inlined Table-valued Function
R = Rule (old-style, stand-alone)
RF = Replication-filter-procedure
SN =Synonym
SQ =Service Queue
TA =Assembly (CLR) DML Trigger
TF = SQL Table-valued-Function
TR = SQL DML Trigger
U = Table (User-defined)
UQ =Unique constraint
V = View
X = Extended Stored Procedure
Catalog Security
You only see metadata for objects you can access
sa still sees everything in the system
dbo still sees everything in the database
Row-level filtering automatically applied to every
catalog access
select * from sys.objects only shows me metadata for
objects I own or have been granted some permission on
If you do not have permission:
You will not see the row, may return an empty set!

Catalog Security (cont.)
The one class of object that SQL 2005 treats more
strictly are things like check constraints, security
expressions, and triggers
These kinds of things constitute the business
logic of the application, so only the owners or
highly privileged roles get to see that metadata
In other words, GRANTing someone SELECT on
your table doesnt entitle them to see the SQL
source text of the triggers
Catalog Security Examples
sys.databases => only shows the databases you have
access to

sys.tables => only shows tables you own or have some
permissions on

sys.database_permissions => only shows permissions for
which you are the grantee or grantor

sys.check_constraints => only visible to the owner or
privileged roles

sys.procedures => only visible to the owner or privileged
roles
Permission-based access
VIEW DEFINITION is a permission to be granted to non-owners
Allows the grantee to see metadata (SP_HELP tablename) but NOT the data
Unless SELECT permission is already present
VIEW ANY DEFINITION GRANT-ed @ server scope
Grantee sees metadata for ANYthing in the server
VIEW DEFINITION GRANT-ed @ database scope
Grantee sees metadata for everything in the database
VIEW DEFINITION GRANT-ed @ schema scope
Grantee sees metadata for everything in the schema
VIEW DEFINITION GRANT-ed @ object scope
Grantee sees metadata for the specific object

GRANT VIEW DEFINITION ON XML SCHEMA COLLECTION::dbo.MySC TO
schemaUser
Questions?
Tools and Proactive Management
Installation
Ease of use: Windows Installer-based installation
System Configuration Checker for verifying target
machine
Command-line utilities for performing unattended
and remote installation
Ability to add and remove SQL Server 2005
components through Add and Remove
Improved error logging and failure reporting
Computer Manager
The Computer Manager combines the functionality of the following
SQL Server tools in the previous versions: Server Network Utility,
Client Network Utility and Server Manager
The following services are managed by the Computer Manager:
SQL Server
SQL Server Agent
SQL Server Analysis Services
Report Server
Microsoft Search
Distributed Transaction Coordinator (DTC)
Full Text Search
The Computer Manager uses the WMI to view and change the server
settings and is part of the Microsoft Management Console (MMC)

SQL Server Management Studio
Provides an integrated centralized environment for
management of multiple servers, tasks and services

Features include:
Object Explorer
Assisted Editors
Summary Window
Extensions to Query Editor for SQLCMD
Template Explorer
Better error handling
Project management (Solution Explorer)
Non-modal dialog boxes
Better scripting and scheduling abilities


Object Explorer
Displays the SQL components in a graphical tree
hierarchy
Allows the user to expand multiple nodes of the
tree simultaneously
Allows the user to filter a node based on one or
multiple filtering criteria
Provides a friendly user interface for management
Project Management
Solution Explorer is a project management tool
The functionality available to manage the project is:
Organize related scripts into a single script project
Maintain version control on scripts. (If VSS is
available)
Store connection and result options with each script

Query Editor
Allows execution of T-SQL scripts and statements against SQL
Server and SQL Server Mobile Edition, multidimensional
expressions (MDX), data mining expression (DMX) and XMLA
The ability to write scripts in a disconnected mode
Dynamic help
Improved display for XML results. Results in XML form, when
using the XML column or XML functions for Transact-SQL
Improved readability by use of color-coding
Graphical representation of the showplan information,
presenting the execution plan of a T-SQL statement
Extensions to support SQLCMD commands interactively
Query Editor
SQLCMD mode
Allows the user to write operating system actions
Replacement for isqlw, osql and xp_cmdshell
Allows OS commands to be executed interactively
Can enable a dedicated administrator connection to
access a running server even if the server is not
responding or is otherwise unavailable

The user needs to execute the SQLCMD utility at the command prompt by using
the -A switch to specify a dedicated connection

Assisted Editors & Templates
Assisted Editors for authoring SQL Server objects with
text properties like stored procedures, triggers and
functions
Example to access Assisted Editors:
Open SQL Server Management Studio
Explore Object Browser. Select SQL Instance Databases
<database> Programmability Stored Procedures
Right click on Stored Procedures New Stored Procedure
This will open the assisted editor with header information for
creating the stored procedure
Maintenance Plans
Benefits in SQL Server 2005:
Wizard and custom T-SQL available for ease of
creation of typical plans
Better manageability: User can introduce a hierarchy
for maintenance plans. Each plan can have subplans
which allow the user to create workflows and can be
scheduled at different times
Enhanced security: Maintenance plans are supported
using only Windows Authentication
Data Transformation
Services (DTS)
The DTS architecture consists of four parts:
The DTS Service tracks DTS packages that are running and manages the
storage of packages
The DTS run-time engine stores package layout, executes packages,
controls flow between tasks and provides run-time services such as
debugging, logging, event handling and management of connections,
variables and transactions
The DTS Data flow engine provides the capability to provide fast,
flexible, extensible and dependable data movement as it has been
optimized for high performance data movement and transformation
This engine supports multiple sources, multiple transformations and
multiple destinations in one fast, flexible data flow
The DTS clients include the tools, wizards and command line utilities that
DTS provides as well as custom applications which allow the DBAs to
develop, deploy and execute DTS packages
DTS
The Business Intelligence Development Studio provides an
environment similar to Visual Studio which is familiar to the
developers for designing packages
SQL Server Management Studio provides tools required to manage
and execute the DTS package
DTS provides easy deployment of packages and their dependencies.
DTS packages include package configurations which can be used to
load configuration values at runtime
Command line utilities:
dtexec utility
dtutil utility
The user can execute the DTS package from DTS Designer in
Business Intelligence Development Studio, in the DTS Import/Export
Wizard and using command-line utility: dtexecui

DTS Migration
The tasks which have not been supported in SQL Server
2005 are:
Analysis Services Processing
Copy SQL Server Object
Data Driven Query
Data Mining Prediction
Dynamic Properties
Execute Package task
Transfer Databases
Transfer Error Messages
Transfer Jobs
Transfer Master Stored Procedure
Transfer Logins
Transform Data Replaced by Data Flow Tasks and data flow
components

SQL Server Agent
Service is off by default
Only sysadmins have access to SQL Server Agents by
default
Two new roles have been introduced to create and manage
jobs and schedules
SQLAgentUserRole
MaintenanceUserRole
Components
Jobs Steps are divided into various subsystems for better
manageability
Alerts
Operators
Proxies Define the security context for the subsystems to run
except T-SQL scripts
SQL Profiler
Better Replay feature
Profiler uses an XML-based definition that allows
users to easily capture events from different types
of servers and programming interfaces
Correlate Performance Monitor counters with
SQL Server or Analysis events
Support for events like Deadlock in a graphical
format
Profiler supports and captures events pertaining to
Analysis Services and DTS
SQL Profiler
Trace results can be saved in XML, ANSI,
UNICODE and OEM formats
Can choose an aggregate option and select a key
for aggregation
This allows viewing the column on which the
aggregation was performed, along with a count for the
number of rows that make up the aggregate value
SQLiMail
Uses SMTP to send mail. No Outlook or Extended
MAPI needed
Runs out-of-process from SQL Server for
reliability
Provides background and asynchronous delivery
for scalability
Multiple failover SMTP accounts, profiles and
mail host database allowed
Cluster and 64-bit compatibility
SQLiMail
Service is off by default
Enforces security for user profiles
Attachments size can be configured and
only verified file extensions allowed to be
attached
Logs activity to SQL Server and
performance monitors for monitoring
Questions?

Vous aimerez peut-être aussi