slides exam 70-432

50
Exam 70-432 TS: Microsoft SQL Server 2008, Implementation and Maintenance Microsoft Learning Exam Cram Marathon Patrick Pitre

Upload: cesarff2

Post on 02-Dec-2014

271 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Slides Exam 70-432

Exam 70-432

TS: Microsoft SQL Server 2008,

Implementation and Maintenance

Microsoft Learning

Exam Cram Marathon

Patrick Pitre

Page 2: Slides Exam 70-432

• Microsoft SQL Server 2008 Exams and Certifications

• Exam Roadmap

• Certification Paths

• Certification Roadmap

• Target Audience

• Skills Being Measured

• Deep-dive: Backup/Restore

• Backup operations

• Restore operations

• Common Scenarios

o Exam Preparation

o Practice Questions

o Additional Reading and Study Materials

o Test Taking Tips

o Q&A

Agenda

Page 3: Slides Exam 70-432
Page 4: Slides Exam 70-432

Choose Your Path

MTA

MCTS

MCITP & MCPD

MCM

MCA

MOS

MOS EXPERT

MOS MASTER

AND/OR

MO

S C

ert

ific

ati

ons

IT C

ert

ific

ati

ons

Page 5: Slides Exam 70-432

• Exam 70-432

• TS: Microsoft SQL Server 2008, Installation and Maintenance

• Exam 70-450

• PRO: Designing, Optimizing and Maintaining a Database Infrastructure using Microsoft SQL

Server 2008

• Prerequisite: 70-432

• Upgrade Path Exam: 70-453 Transition your MCITP SQL 2005 DBA to

• Exam 70-433

• TS: Microsoft SQL Server 2008, Development

• Exam 70-451

• PRO: Designing Database Solutions and Data Access using Microsoft SQL Server 2008

• Prerequisite: 70-433

• Exam 70-448

• TS: Microsoft SQL Server 2008, Business Intelligence Development and Maintenance.

• Exam 70-452

• PRO: Designing a Business Intelligence Infrastructure Using Microsoft SQL Server 2008

• Prerequisite: 70-448

• Upgrade Path Exams available for all

SQL Server 2008 Exams

and Certifications

Page 6: Slides Exam 70-432

• http://bit.ly/9mEOTK

SQL Server 2008 Certification Paths

Page 7: Slides Exam 70-432

Where to Get It (MCTS -

MCA)

Microsoft Microsoft Technology Specialist and Professional Series

certifications exams are administered by Prometric

Page 8: Slides Exam 70-432

• All audio of the sessions will be downloadable

• All content of the sessions will be downloadable

• Sessions run continuously all day today

• Microsoft Learning representatives are available

all day to answer certification questions via chat

• Download promotional offers into your Virtual

Backpack and book your exams soon!

More information about

these Exam Cram sessions

Page 9: Slides Exam 70-432

• Candidates should have one to two years of experience

using SQL Server 2008 or two to three years of

experience using a previous version of SQL Server.

• Candidates for this exam are IT professionals who have

jobs in which database administration is their main area

of responsibility, or they work in environments in which

databases are central to their job roles. These job roles

include the following:

• IT generalists who work in environments in which SQL Server

2008 is part of an overall solution

• IT professionals who manage systems that run SQL Server 2008

• IT professionals who work with third-party applications that are

built on SQL Server 2008

• Developers who build applications that use SQL Server 2008

Target Audience

Page 10: Slides Exam 70-432

o Installing and Configuring SQL Server 2008 (10 percent)

oMaintaining SQL Server Instances (13 percent)

oManaging SQL Server Security (15 percent)

oMaintaining a SQL Server Database (16 percent)

o Performing Data Management Tasks (14 percent)

oMonitoring and Troubleshooting SQL Server (13 percent)

oOptimizing SQL Server Performance (10 percent)

o Implementing High Availability (9 percent)

Skills Being Measured

70-432

Page 11: Slides Exam 70-432

Installing SQL Server

• Service Accounts

• Best practice – Use separate user accounts (local or domain) for SQL Server and SQL Server Agent (to run Windows Services).

• Authentication Modes

• Windows (local Windows account or Active Directory/Domain account)

• Mixed Mode – Windows and SQL Server authentication.

• Recommended: Don’t use Mixed Mode unless you have to (e.g., dealing with legacy system).

• Data Directories

• Best practice: Use different disks to house data files (.mdf) and transaction logs (.ldf) files.

• Use different RAID types for performance. Transaction logs typically need highest disk-throughput.

• Set default locations for new database directories during installation. Can change later if necessary.

• Collation Settings

• Supports regional system locale.

• Affects ordering and case-sensitivity

Installing and configuring SQL Server 2008

Page 12: Slides Exam 70-432

SQL Instances

What is an instance?

• Installation of SQL Server Database Engine*, that users/processes can connect to (e.g.,

with TCP/IP, Named Pipes, VIA, or Shared Memory).

• Each SQL Server Instance runs as its own set of Windows Services, has distinct directory structure,

registry structure, collation settings, security, etc.

• *Can include SQL Server Analysis Services and Reporting Services.

The “Default Instance”

• Default instance name is MSSQLSERVER (including Windows Service name).

• Can change default instance name.

“Named Instance”

• Set instance name during installation.

• Allows you to run multiple instances of SQL Server on same machine, all accessible via

TCP port 1433 (configurable), named pipes, etc.

• Access via the computer hostname (or IP address if allowed) and Instance name.

• If computer name is MySqlServer, and instance name is SQL2008, then access with

MySqlServer\SQL2008.

• Windows Service name will also show Instance name (same as above).

Installing and configuring SQL Server 2008 (cont.)

Page 13: Slides Exam 70-432

What else can I install?

• SQL Server Analysis Services (SSAS)

• Microsoft Business Intelligence suite.

• SQL Server Integration Services (SSIS)

• Replaced Data Transformation Services (DTS)

• Includes Business Intelligence Development Studio (BIDS)

• Drag and drop design surface for creating complex data

transformation tasks (as well as SQL Admin tasks).

• SQL Server Reporting Services (SSRS)

• Full-suite of tools to build, deploy, and manage reports.

• Robust API for custom programming.

Installing and configuring SQL Server 2008 (cont.)

Page 14: Slides Exam 70-432

Full-Text Search (FTS)

• Allows users to run “fuzzy” queries against data; thesaures, stemming

(break/breaking/breaker), and STOP words (to reduce noise in full text catalog.

• Setup Full-Text catalogs first.

• FREETEXT: less than typical WHERE clause. Stemming, word-breaking,

thesaurus

• STOPLIST: Used when creating index to ignore specific words. Prevents full text

index-bloat

• FREETEXTTABLE: Returns table with zero or more

• CONTAINS: Used in WHERE clause for “fuzzy” matches, proximity, or weighted

words

• More powerful than LIKE T-SQL predicate. Like works on character patterns

only.

Installing and configuring SQL Server 2008 (cont.)

Page 15: Slides Exam 70-432

• Every hard disk is guaranteed... To crash. - Unknown

• A business that fails to backup, risks failure to be in business. - T.E Ronneberg

• Backup: Do it today, or pay tomorrow. – Unknown

• SYSTEM ALERT: Backup Not Found:

A)bort, R)etry, C)ry?

• Blessed are the pessimists, for they have made backups. - Unknown

• It's so logical and so simple. Fat is the backup fuel system. The role it plays in the

body is that when there's no carbohydrate around, fat will become the primary

energy fuel. That's pretty well known. – Robert Atkins

Backup Wisdom

Page 16: Slides Exam 70-432

Four type of backups:

o Database backups

o Most common for most basic/straight-forward scenarios

o File backups

o Used to backup/recover individual files/filegroups.

o Good for large database, where disk space is an issue.

o Partial backups

o Can be used with Full or Differential – NOT transaction logs.

o Works with filegroups.

o Back up Primary filegroup, read/write filegroups, plus specified files/filegroups

o Best for read-only filegroups, and you don’t want to backup entire database

o Bandwidth, disk space, etc.

o Transaction Log backups

o Crucial for good disaster recovery plan.

o Allows restore of all data since last t-log backup.

o Differential

o Can run in between Full backups

o Used to keep backup size small, but each successive differential backup will be bigger than last,, until a full backup is performed again.

Backup Basics

Page 17: Slides Exam 70-432

• Full

• Default recovery model; suitable for most OLTP and business scenarios.

• Requires transaction log backups

• Can recover data up to point of last t-log backup

• Point-in-time restore (via transaction log backups)

• Simple

• Only recover changes up to last backup.

• No transaction log backups.

• Not suitable for most production OLTP systems, as risk of data-loss is high.

• Bulk-Logged

• Requires transaction log backups.

• Minimal logging for recovery operations, so recovery can be faster.

• Regular operations are still logged

• Use with care – set recovery model to bulk-logged, do the data-recovery, then set

recovery model back to Full (or Simple).

Recovery Models (Backup/Restore)

Page 18: Slides Exam 70-432

Transaction Log Backups (Full/Bulk-Logged recovery models only)

• Essential for point-in-time data recovery.

• Contains all the transactions that have occurred since the last full backup

• Differential Backups

• Only backs up changes in database since last full backup.

• Smaller than Full backup, but will grow in size until next full backup.

• Work well with large databases, when disk space or performance can become an issue.

• Need a “base” backup (full backup) to recover fully.

• Can be used with transaction log backups.

• Works with all three main backup types:

• Database

• File

• Partial

Backup/Recovery

Page 19: Slides Exam 70-432

Can automate many DBA tasks, not only backups!

• Execute T-SQL Statement, Index rebuild/reorg, update statistics.

• Management -> Maintenance Plans -> (right-click folder)

Maintenance Plan (using Wizard)

• Wizard allows you to configure many backup options/tasks at once.

Maintenance Plan (no Wizard)

• “Designer” surface, SSIS (SQL Server Integration Studio)

• Can drag and drop objects

See Maintenance Plan examples on following slides…

Maintenance Plans

Page 20: Slides Exam 70-432

Let’s setup two maintenance plans: one plan for full nightly backup, and one plan for transactions log backups every 4 hours.

• Management -> Maintenance Plans -> (right-click) -> New Maintenance Wizard…

Example Maintenance Plan - Wizard

Create plan with specs below.

• Make sure folder exists.

• Check “Verify backup integrity”! <- Cleanup Task:

• Remove old

backup files

• Sub-folders

• Delete old files

every week

Page 21: Slides Exam 70-432

Once maintenance plan is created, can edit is SSIS design surface.

• Management -> Maintenance Plans -> (plan name) -> Double-click to open plan in designer surface.

Example Maintenance Plan – Wizard (cont.)

Let’s add an additional step:

• Cleanup Task

Cleanup Task:

• Remove old backup files

• Include Sub-folders

• Delete old files every week (in this example)

Backup Database (Full) Task

Page 22: Slides Exam 70-432

• Use designer surface, drag and drop maintenance objects to design surface (similar to BIDS).

Example Maintenance Plan – No Wizard

Drag object onto designer

surface.

Toolbox of available tasks Backup Database Task Details

Maintenance Cleanup Task Details

Page 23: Slides Exam 70-432

Complete Backup - Full (daily/weekly/etc.) backups, with transaction log (t-log)

backups

• Provides granular, point-in-time restores of data.

• Minimizes data loss – can restore data up to most recent transaction log backup.

• The more critical the data, the more often t-log backups should be scheduled.

• Tolerance to pain and data loss. Decide, with LOB managers and stakeholders, how much data can be

lost in a disaster situation. Every four (4) hours of data loss? Two (2) hours? One (1) hour?!

• Make sure you have sufficient disk storage for all your backup files!

Restore

• Restore full backup first.

• If you have multiple transaction logs to be restored, make sure you restore and set the

option RESTORE WITH NO RECOVERY option.

• Or, in the restore wizard, make sure this option is checked. This will allow you restore subsequent t-

logs, and restore more data closer to database disaster.

• Note: if using Differential backups, restore last full backup, then any differential

backups, then any t-log backups.

Common Backup/Recovery Scenarios - 1

Page 24: Slides Exam 70-432

Simple Recovery model

• Appropriate for scenarios that don’t require point-in-time recovery.

• Risks of data loss is high, since the only available data to restore is from last full/differential

backup.

• Appropriate for databases that don’t change often (mostly static tables, lookup tables,

archive data, etc.)

Restore

• Simple Recovery Model is easiest to restore, since only dealing with one or two backups

(Full and Differential, respectively).

• If you are using Full backups only, only need to restore one backup file (last full backup).

• If you are using Differential backups, need to restore “base” backup first (full backup), then

restore the differential backup(s).

• Use the WITH RECOVERY option, since no transaction logs to restore.

Common Backup/Recovery Scenarios - 2

Page 25: Slides Exam 70-432

Why is my transaction log (t-log) growing so big? What can I do?

If you perform a full backup, and periodic transaction log backups, your transaction

log should truncate (shrink) automatically.

• Sometimes however, the t-log will continue to grow, despite your best efforts.

There are many factors that can delay log truncations:

• No CHECKPOINT has happened since last log truncation

• Active Transaction(s)

• E.g., long-running transaction, transaction is deferred

• Replication

• Undelivered transactions from Publisher to Subscriber.

• Database Mirroring

• Paused, or mirror database is significantly behind principle database.

Checkpoints

• Write all dirty data and log pages to disk.

• Happens when a backup occurs.

• Can set with the recovery interval

Transaction log management

Page 26: Slides Exam 70-432

There is a way to shrink the transaction log, but it should be used with caution!

Backup the log, with truncate_only

The use SHRINKFILE manually (with T-SQL)

• Set new file size.

Using this method, you lose your ability to do point-in-time restores (but can save

your hide in an emergency!)

• Once a transaction log completely fills up a disk, the risk of losing ALL of your data

greatly increases.

• Perform a FULL backup as soon as possible after a truncate_only command.

• Resume transaction log backups immediately.

Transaction log management

Page 27: Slides Exam 70-432

SQL Agent and jobs

• SQL Server Agent service must be running for jobs ro tun

• Agent’s user account (for Windows Service) must be a member of the SQL Server fixed server role sysadmin.

• Domain account is most flexible, but local user acceptable if jobs don’t need remote server access.

• Create and schedule jobs

• Jobs can have multiple steps, can change order of steps

• Can run SSIS Packages, T-SQL Scripts, PowerShell, ActiveX script, Replication tools, Analysis Server commands, and more.

• Schedule

• Jobs can have multiple schedules.

• Notifications

• Email, Windows Event Log, Pager.

• Can automatically delete job upon completion (one-off jobs).

• Alerts

• E.g., Insufficient Permission (to run job), T-SQL syntax error, Fatal Errors,

• Can respond to condition, and notify as needed

• Logging

• Can log SQL job historyto table, output to file, or log in job history

Maintaining SQL Server Instances

Page 28: Slides Exam 70-432

SQL Operator

• Used by the SQL Server Agent to send notification from alerting and SQL Agent jobs.

• SQL Server Agent -> Jobs -> (right-click -> Job Properties) -> Notifications

• Contains user name, email, pager information, etc.

• Not used for server/instance/database security

• Can view notifications sent to user by SQL Agent jobs

• Can set Operator notification schedules

Policies

• Powerful way to manage security and enforce standards

• Create expressions to match conditions.

• Examples:

• Ensure all views start with “uv_”

• Can set default database

• Enforce password complexity

• Index creation

Maintaining SQL Server instances (cont.)

Page 29: Slides Exam 70-432

Roles

Allows administrators ability to group and manage security and permissions for instance, server and databases – roughly analogous to Active Directory (AD) or Windows groups.

• Fixed, built-in Server Roles:

• Includes dbcreator, sysadmin, diskadmin, public, and others.

• For managing configuration and maintenance tasks (backups, creating databases, security, etc.)

• Database Roles

• Database-specific roles (db_owner, db_datareader, db_datawriter, etc.)

• Security -> Logins -> (login Properties) -> User Mapping.

• New SQL Server login/user only has “Public” database role assigned by default.

• Custom Roles – T-SQL

Logins

• Can be user from Active Directory, or can be SQL-specific Authentication (SQL only account)

• The “sa” account is a SQL Server login.

• Can be assigned to server roles

• Can be assigned database roles

• Using Securables, can apply more fine-grained permissions to servers, endpoints, and logins.

• Logins can be disabled, have password policy, other controls similar to Windows or AD account.

Maintaining SQL Server Security

Page 30: Slides Exam 70-432

Object permissions

• Allows administrators ability to group and manage security and permissions for instance, server and databases – roughly analogous to Active Directory (AD) or Windows groups.

• Can secure almost any object: table, view, procedures, schemas, TVFs, and many others!

• In the example below, we create a new user (BGates), and give him permission to the AdventureWorks “Sales” schema. This creates a server login (Bgates), and database user (BillGates).

SQL Server Agent Proxies

Allows you to impersonate users in SQL Agent jobs, via Credentials (Security -> Credentials node in SSMS).

1. Create Credential (select local or domain user/group used for impersonation)

2. Create Proxy – Use credential specified above, then choose Subsystem (CmdExec, PowerShell, Replication*, etc.)

3. Inside SQL Agent job step, select the corresponding subsystem you selected above in the Type dropdown.

Now, that particular step will run under the identity you identified with Credential.

Maintaining SQL Server Security

Page 31: Slides Exam 70-432

SQL Server security auditing

• Can be server (instance) or database-specific

• Steps to happy auditing

• Create Audit object (Security -> Audits -> (right-click) -> New Audit).

• Give Audit Name, queue delay, destination (file, security or application log),

• Can force server shutdown if audit fails (if permissible)

• Server Audit: (Security -> Server Audit Specifications (right-click) -> New Server Audit

Specification)

• Select Audit object created earlier.

• Audit Action Type (e.g., BACK_RESTORE_GROUP, FAILED_LOGIN_GROUP,

SUCCESSFUL_LOGIN_GROUP, etc.)

• Object Class: Database, Object, Schema

• Database Audit: (Databases -> <database_name> -> Security -> Database Audit

Specification (right-click) -> New Database Audit…

• Same as Server Audit -> select Action Type, object, schema, etc.

• Database-specific Audit Action Types

Maintaining SQL Server Security (cont.)

Page 32: Slides Exam 70-432

• How to create Audit and specification with T-SQL. Example below writes events to the

Windows Security event log.

• Enable new Audit (right click -> Enable)

• Create Audit Specification

• Enable Audit Specification (right-click -> Enable)

• Test by attempting to login with bad account

• Review Windows Security event log

Maintaining SQL Server Security (cont.)

Page 33: Slides Exam 70-432

• sp_configure

• Display and/or change configuration settings.

• Admin trick: to find out if a change requires a SQL Service restart, and run SELECT *

FROM sys.Configurations; if is_dynamic = 1 (yes/true), then no service restart required.

Maintaining SQL Server Security (cont.)

Page 34: Slides Exam 70-432

Import and Export data

• SQL Server Import and Export Wizard

• Helpful for one off data import/export.

• Can import/export from Excel, CSV, Microsoft Access, Oracle, ODBC, and others.

• Can save as SSIS (SQL Server Integration Services) package, for later edit/scheduling via a Sql Server Agent job.

• Can also run SSIS package from command line: bcp.exe

• Bulk Insert

• Set Recovery Model to bulk-logged to avoid filling up SQL transaction logs.

• Inserts comma-separated values from a text file into the AdventureWorks Sales.Customer table. Set/resets recovery model to BULK_LOGGED then back to FULL - to minimally log you bulk load of data (your transaction log will thank you!)

• SSIS Package

• Use BIDS to create everything from simple one-off jobs to complex ETL (Extract/Transform/Load) packages.

Performing Data Management Tasks

Page 35: Slides Exam 70-432

Partitioning – Table and Index

• Helpful for large tables or indexes – can drastically increase performance, especially operations like

loading data. Transparent to end-users (e.g., queries, view, functions, etc. all work the same)

• CREATE_PARTITION_FUNCTION

• RANGE (LEFT, RIGHT)

• FOR VALUES (<boundry_value>)

• SPLIT RANGE

• Used to add a partition to the partition function

• MERGE RANGE

• Used to drop a partition, and move it’s data to an existing partition

• CREATE_PARTITION_SCHEME

• Partitions use filegroups. This statement maps partitions to filegroups (physical files).

• Data moved to partitions based on user-defined criteria (e.g., create_date > ’6-06-2011’ or IDENTITY

column (OrderId > 100000).

Performing Data Management Tasks

Page 36: Slides Exam 70-432

Indexing

• Clustered Indexes

• One per table. If table has a PRIMARY KEY, then it will be used for a clustered index if none it set.

• Define logical order of the table. (note, not sort order).

• Clustered indexes actually hold their data (at the leaf level)

• Can use multiple columns to create index.

• Non-clustered indexes

• Multiple non-clustered indexes per table (999 in SQL Server 2008)

• Can use on Views.

• Good candidates are fields frequently included in a WHERE clause, as well as JOIN and GROUP BY statements.

• Performance

• Although indexes can speed up data access, there is a performance overhead associated with data edits, as indexes have

to update as well. Particularly apparently when dealing with very large indexes.

• Types of indexes

• Filtered index

• Allows a WHERE clause on index.

• Spatial

• Geometric data (points, lines, polygons)

• XML

• Same rules apply as other index types.

Performing Data Management Tasks

Page 37: Slides Exam 70-432

Performance tuning

Blocks, locks, and deadlocks, oh my!

• Locking is normal part of database engine function. Ensure transactions are atomic and isolated.

• Blocking happens when a transaction is preventing another transaction from running.

• Some blocking is normal, but excessive blocking can severely hinder performance.

• Essential for maintaining concurrency.

• Block is NOT deadlocking!

• Deadlocks

• Severe blocking can lead to deadlocks: where two transactions are competing for the same resource; a

vicious circle, as both tasks will wait endlessly for each other.

• Multiple way to find deadlocks:

• Right click database -> Reports -> Standard Reports -> All Blocking Transactions

• T-SQL/DMV (Dynamic Management Views)

Monitoring and Troubleshooting

Page 38: Slides Exam 70-432

Activity Monitor

Ctrl-Alt-A

Shows a variety of useful information.

Monitoring and Troubleshooting (cont.)

Page 39: Slides Exam 70-432

Dynamic Management Views (DMVs)

• Introduced in SQL 2005. Used to diagnosis problems, as well as for performance tuning.

• Robust information about the current state of the server.

• Server-scoped: stored in Master database. Database-scoped: specific to each database

• Don’t reinvent the wheel! DMVs work best when joined to other DMVs, and they get complex quick!

• Use online resources to find useful DMVs you can use/alter.

• See example below (from http://sqlserverperformance.wordpress.com/2008/01/21/five-dmv-queries-that-will-make-

you-a-superhero/), ran against a SharePoint 2007 server.

Monitoring and Troubleshooting (cont.)

Page 40: Slides Exam 70-432

Logging/viewing of events

• Windows Event Logs (start -> run -> type in eventvwr, press enter)

• SQL Server Logs

• <database instance> -> Management -> SQL Server Logs (Current, Archive, etc.)

• Can view info about database engine, SQL Agent, database mail, and even the Windows event log!

• SQL Agent Jobs

• View history of SQL Agent job execution (right-click job, -> View History)

• Error Logs: SQL Server Agent -> Error Logs (Current, Archive, etc.)

• SQL Server Agent troubleshooting

Monitoring and Troubleshooting (cont.)

Page 41: Slides Exam 70-432

Running SQL Traces

• SQL Server Profiler. Save trace to file or database table.

Database Engine Tuning Advisor (DTA)

• Learn how DTA and SQL Profiler work together

• Workloads

• Analyze workload from a captured trace

Dynamic Management Views

• Useful for gathering system information

• Located in the “sys” schema

• Server-scoped: Stored in Master database

• Memory (e.g., sys.physical_memory_in_bytes)

• Threads (e.g. sys.max_workers_thread)

• Database scoped: Specific to each database

• Disk Space (e.g., sys. dm_db_file_space_usage)

• Query stats (e.g. sys.dm_exec_query_stats)

Optimize SQL Server performance

Page 42: Slides Exam 70-432

Resource Governor

• Monitor and control CPU and memory workloads.

• <server instance> -> Management -> Resource Governor

• A picture says a thousand words!

Optimize SQL Server performance (cont.)

Page 43: Slides Exam 70-432

Data Collection – Performance Studio

• New in SQL 2008. Requires the SQL Server Agent to be running.

• Database report, on steroids!

• First, must setup data warehouse to house data.

• Configure Management Data Warehouse (Management -> Data Collection)

• “Create or upgrade a management data warehouse”

• Second, run wizard again, and choose “Set up data collection”

• Be prepared for fast data growth – can be upwards of 500 MB/day in some cases.

• 3-4 % potential performance overhead

• View reports of collected data: Management -> Data Collection -> (right-click) ->

Reports -> Management Data Warehouse ->

• Server Activity History

• Disk Usage Summary

• Query Statistics History

Optimize SQL Server performance (cont.)

Page 44: Slides Exam 70-432

Performance Studio – Server Activity History

Optimize SQL Server performance (cont.)

Page 45: Slides Exam 70-432

Replication

• Publisher/Subscriber model.

• Articles: Tables, views, stored procedures, user defined functions

• Filter: Use WHERE clause in deciding what data to replicate

• Transactional

• Good for high-availability, or offloading queries.

• Database changes are streamed from the publisher to the subscriber automatically.

• Merge

• Good for mobile/remote databases that need to merge changes when connected.

• SQL Compact Edition

• Snapshot

• Can provide initial data for merge or transactional replication. Can also be used to refresh the data.

• Can use as basis for reports (to minimize server performance impact of reporting-style queries)

• Push/Pull

• Snapshot Agent

• Manages the snapshot of published DB objects, including generating the file, and synchronization.

• Distribution Agent

• Moves the snapshots and transactions to the Subscribers.

• How Microsoft does it!

• http://msdn.microsoft.com/en-us/library/dd263442.aspx

Implementing High Availability

Page 46: Slides Exam 70-432

Mirroring

• Principle (Standard or Enterprise edition)

• Witness (Standard, Enterprise, Workgroup, Express)

• Server must first be configured (security, TCP port, etc.).

• Database only.

• Operating Mode

• High-performance (asynchronous)

• Commit at principle first, then witness if successful

• High-safety (synchronous)

• Commit changes on both servers

• High safety with automatic failover (synchronous)

• Commit changes on both servers

• Witness control failover if principle goes down

Failover Clustering (Standard or Enterprise edition)

• Nodes: Each SQL instance is a node. Up to 16 nodes.

• Entire instance (Mirroring is per-database only).

• Single copy of database in shared storage array.

• Failback policy

• Can fall back immediately or during scheduled time.

• Upon failover, transactions are rolled forward, incomplete transactions are rolled back, etc.

• Encryption – can use encrypted connections, via certificates.

Implementing High Availability (cont.)

Page 47: Slides Exam 70-432

Log Shipping

• Transaction logs can be sent to separate server, for a warm standby.

• Recovery model needs to be Full or bulk-logged (with NO RECOVERY)

• Requires SQL Server Agent be running.

• Primary, Secondary, optional Monitoring server.

• Full backup is taken on Primary server, shipped to Secondary server. Additional transaction

logs are shipped over, as needed.

• Can also be used as a reporting solution (to offload performance hits on the primary server

for potentially complex reporting queries).

Implementing High Availability (cont.)

Page 48: Slides Exam 70-432

• Study a variety of material

• Nothing beats hands-on experience

• Study from at least two (or more) books

• Run through the examples

• Eliminate answers you know are not correct

• Mark to review, and come back later

• Manage your time

• Don’t Panic!

• Review all your answers at the end

Test Taking Tips

Page 50: Slides Exam 70-432

Q&A