Beginning SQL Server. 2012 Administration. Apress. Rob Walters Grant Fritchey



Similar documents
SQL Server 2008 Administration

MOC 20462C: Administering Microsoft SQL Server Databases

6231A - Maintaining a Microsoft SQL Server 2008 Database

50238: Introduction to SQL Server 2008 Administration

SQL Server for Database Administrators Course Syllabus

Upgrading Your SQL Server 2000 Database Administration (DBA) Skills to SQL Server 2008 DBA Skills Course 6317A: Three days; Instructor-Led

Microsoft SQL Server 2012 Administration. Real-World Skills for MCSA Certification and Beyond (Exams , , and )

Below are the some of the new features of SQL Server that has been discussed in this course

SQL Server 2014

6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

10775A Administering Microsoft SQL Server 2012 Databases

Administering Microsoft SQL Server Databases MOC 20462

Administering a Microsoft SQL Server 2000 Database

10775 Administering Microsoft SQL Server Databases

Basic knowledge of the Microsoft Windows operating system and its core functionality Working knowledge of Transact-SQL and relational databases

Microsoft SQL Database Administrator Certification

Maintaining a Microsoft SQL Server 2008 Database

Course Outline: Course 6317: Upgrading Your SQL Server 2000 Database Administration (DBA) Skills to SQL Server 2008 DBA Skills

Administering Microsoft SQL Server Databases

Administering a Microsoft SQL Server 2000 Database

NUTECH COMPUTER TRAINING INSTITUTE 1682 E. GUDE DRIVE #102, ROCKVILLE, MD WEB: TEL:

Explain how to prepare the hardware and other resources necessary to install SQL Server. Install SQL Server. Manage and configure SQL Server.

Administering Microsoft SQL Server Databases

Administering a SQL Database Infrastructure

Microsoft SQL Server 2014: MS SQL Server Administering Databases

Administering a SQL Database Infrastructure 20764; 5 Days; Instructor-led

Administering Microsoft SQL Server Databases

MS Administering Microsoft SQL Server Databases

SQL Server 2008 Designing, Optimizing, and Maintaining a Database Session 1

Course 20462C: Administering Microsoft SQL Server Databases

Administering Microsoft SQL Server 2012 Databases

MOC Administering Microsoft SQL Server 2014 Databases

Course Syllabus. At Course Completion

ADMINISTERING MICROSOFT SQL SERVER DATABASES

Before attending this course, participants should have:

Microsoft SQL Server 2008 Administrator's Pocket Consultant

MCTS Microsoft SQL Server 2005 Implementation & Maintenance

Administering Microsoft SQL Server Databases

Course. Overview. Length: 5 Day(s) Published: English. IT Professionals. Level: Type: Method: Delivery. Enroll now (CAL)

Administering Microsoft SQL Server 2012 Databases

Administering Microsoft SQL Server Databases

Designing, Optimizing and Maintaining a Database Administrative Solution for Microsoft SQL Server 2008

ExecuTrain Course Outline MOC 6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

Administering Microsoft SQL Server 2012 Databases

Administering a SQL Database Infrastructure (MS )

Administering Microsoft SQL Server Databases

MS Design, Optimize and Maintain Database for Microsoft SQL Server 2008

MS-10775: Administering Microsoft SQL Server 2012 Databases. Course Objectives. Required Exam(s) Price. Duration. Methods of Delivery.

Designing Database Solutions for Microsoft SQL Server 2012 MOC 20465

Introduction. Part I: Finding Bottlenecks when Something s Wrong. Chapter 1: Performance Tuning 3

MS SQL Server DBA Training Course. Table of Contents

Microsoft SQL Server Beginner course content (3-day)

Upon completion of the program, students are given a full support to take and pass Microsoft certification examinations.

How To Manage A Database Server 2012

Administering Microsoft SQL Server Databases

Administering Microsoft SQL Server Databases

Administering Microsoft SQL Server Databases

Administering Microsoft SQL Server Databases 20462C; 5 days

SQL Azure vs. SQL Server

Course 6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

Administering a Microsoft SQL Server 2000 Database

Designing and Deploying Messaging Solutions with Microsoft Exchange Server 2010 Service Pack B; 5 days, Instructor-led

Course: Administering Microsoft SQL Server Databases Overview

$99.95 per user. SQL Server 2008/R2 Database Administration CourseId: 157 Skill level: Run Time: 47+ hours (272 videos)

6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

20462C: Administering Microsoft SQL Server Databases

Implementing a Microsoft SQL Server 2005 Database

MS 20465C: Designing a Data Solution with Microsoft SQL Server

20462 Administering Microsoft SQL Server Databases

Microsoft Administering Microsoft SQL Server Databases

Development and Management

Microsoft Administering a SQL Database Infrastructure

Microsoft Official Courseware

MS 20465: Designing Database Solutions for Microsoft SQL Server 2012

Designing a Data Solution with Microsoft SQL Server 2014

Mind Q Systems Private Limited

Microsoft SQL Server 2012 Administration

"Charting the Course... MOC C Designing a Data Solution with Microsoft SQL Server Course Summary

SQL Server 2012 Database Administration With AlwaysOn & Clustering Techniques

Designing Database Solutions for Microsoft SQL Server 2012

Course 20462: Administering Microsoft SQL Server Databases

SQL SERVER DEVELOPER Available Features and Tools New Capabilities SQL Services Product Licensing Product Editions Will teach in class room

MS SQL Server 2014 New Features and Database Administration

AV-005: Administering and Implementing a Data Warehouse with SQL Server 2014

AppFabric. Pro Windows Server. Stephen Kaufman. Danny Garber. Apress. INFORMATIONSBIBLIOTHbK TECHNISCHE. U N! V En SIT AT S R!

Would-be system and database administrators. PREREQUISITES: At least 6 months experience with a Windows operating system.

Administering Microsoft SQL Server Databases

Administering Microsoft SQL Server Databases

W I S E. SQL Server 2012 Database Engine Technical Update WISE LTD.

Designing a Data Solution with Microsoft SQL Server

Demystified CONTENTS Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals CHAPTER 2 Exploring Relational Database Components

Course 20465: Designing a Data Solution with Microsoft SQL Server

Designing a Data Solution with Microsoft SQL Server

40008A - UPDATING YOUR DATABASE SKILLS TO MICROSOFT SQL SERVER 2012 Training Course Outline. Course: 40008A

$99.95 per user. SQL Server 2005 Database Administration CourseId: 152 Skill level: Run Time: 30+ hours (158 videos)

Transcription:

Beginning SQL Server 2012 Administration Rob Walters Grant Fritchey Apress

Contents at a Glance About the Authors About the Technical Reviewer Acknowledgments Introduction xv xvi xvii xviii Chapter 1: The Database Administration Profession 1 Chapter 2: Planning and Installing SQL Server 2012 13 Chapter 3: What's in the Toolbox? 43 Chapter 4: SQL Server Development 77 Chapter 5: Creating Tables and Other Objects 105 Chapter 6: Transact-SQL, 125 Chapter 7: SQL Server Internals 147 Chapter 8: Database Backup Strategies 157 Chapter 9: Database Restore Strategies 185 Chapter 10: Common Database Maintenance Tasks 213 Chapter 11: SQL Server Security 249 Chapter 12: Auditing, Encryption, and Compliance 271 Chapter 13: Performance Tuning and Optimization 299 Chapter 14: Fault Tolerance 339 Chapter 15: Cloud Computing for the DBA 365 Chapter 16: SQL Server Private Cloud 387 Chapter 17: Where to Go Next?.401 Index 407 iii

Contents About the Authors About the Technical Reviewer Acknowledgments Introduction xv xvi xvii xviii Chapter 1: The Database Administration Profession 1 Why Do We Need a DBA? Access Runs Great! 1 What Exactly Does a DBA Do Anyway? 2 Database Maintenance 2 Security and Regulatory Compliance 3 Disaster Recovery 3 Design and Performance Improvement 3 Documentation 4 Salary Information 4 Words from Real-World DBAs 4 Grant Fritchey, Principal DBA 5 Roman Rehak, Principal Database Architect 7 Charlie Pyne, Senior DBA 8 Ed Clapper, Database Product Architect Manager 9 Michael Esposito, Senior Technical Consultant and DBA 11 Summary 12 iv

m CONTENTS Chapter 2: Planning and Installing SQL Server 2012..13 Understanding the Editions 14 Demystifying 32-Bit and 64-Bit Architectures 14 Server Editions 14 SQL Server Terminology 16 Planning Your Installation 17 Assessing the Environment 17 Choosing the Right Edition 18 Validating Hardware and Software Requirements 19 Installing SQL Server Evaluation Edition 19 Step 1: Downloading SQL Server Evaluation Edition 19 Step 2: Understanding the SQL Server Installation Center 20 Step 3: Installing an Instance of SQL Server 28 Upgrading SQLServer 37 Summary 40 IChapter 3: What's in the Toolbox? 43 Connecting to SQL Server 43 Issuing Queries Using SSMS 46 Managing Multiple Servers 53 Monitoring Server Activity 55 Other Tools from the Start Menu 61 Analysis Services Folder 63 Configuration Tools Folder 63 Documentation and Community Folder 68 Integration Services Folder 68 Performance Tools Folder 69 Import and Export Data Wizard 70 SQL Server Data Tools 70 v

i CONTENTS Command-Line Tools 70 SQLCMD 71 PowerShell Provider for SQL Server 73 Summary 74 Chapter 4: SQL Server Development 77 Touring SSMS Through the Eyes of a Developer 77 IntelliSense 77 Query Designer 78 Templates 81 Debugging in T-SQL 84 Data-Tier Applications 85 Defining a Data-Tier Application 85 Deploying a Data-Tier Application 89 Registering an Existing Database as a Data-Tier Application 90 Monitoring a Data-Tier Application Using the SQL Server Utility 90 SQL Server Developer Tools 95 Working with SSDT in Connected Mode 96 Working with SSDT in Offline Mode 99 Application Versioning 102 SQL Server LocalDB 102 Summary 103 SChapter 5: Creating Tables and Other Objects 105 Navigating the Object Explorer Tree 105 Scripting the Actions of an SSMS Dialog Box 106 Transact-SQL (T-SQL) Primer 109 Data Definition Language (DDL) 109 Data Manipulation Language (DML) 109 Data Control Language (DCL) 110 vi

m CONTENTS Creating Tables 110 Creating Tables from the Table Designer 111 Issuing the CREATE TABLE Statement 112 Altering Tables 114 Adding Constraints 114 NULL Constraints 114 CHECK Constraints 114 Primary Keys and Unique Constraints 115 Foreign Key Constraints 116 Dropping Tables 117 Creating Indexes 119 Summary 123 Chapter 6: Transact-SQL 125 The VetClinic Sample Database Revisited 125 Data Types 126 Unicode vs. ANSI 127 Living with NULL 128 Data Manipulation Language 128 SELECT 128 INSERT 133 UPDATE 135 DELETE 135 Transactions 136 Executing Transactions 136 Isolating Transactions 136 Deadlocks 137 Stored Procedures 139 Creating Stored Procedures Using Templates 140 vii

m CONTENTS Modifying Stored Procedures 142 System Stored Procedures 142 Functions 143 Creating a Function 143 Invoking a Function 143 Triggers 144 Summary I45 Chapter 7: SQL Server Internals 147 Databases I47 Master Database 147 Tempdb Database 147 Model Database 148 MSDB Database 148 Resource Database 149 Repairing Corrupt System Databases 149 Writing Data to Disk 149 SQL Server Services 150 Single-User Mode 152 Placing an Already-Started Database into Single-User Mode 153 Starting SQL Server in Single-User Mode 153 Summary 156 Chapter 8: Database Backup Strategies 157 Defining the Types of Backups 157 Full Backups 158 Differential Backups 163 File and Filegroup Backups 164 Backing Up the Logs 166 Initiating Fully Recovery Mode 167 viii

i CONTENTS Log Backup Using Management Studio "168 Log Backup Using T-SQL 169 Backing Up a Copy of the Database 169 Automating the Backup Process 169 Encrypting Backup Files for Security 179 Compressing Backups to Save Space 180 Designing a Backup Plan 182 Summary 184 Chapter 9: Database Restore Strategies 185 Restoring a Database from the Management Studio GUI 186 Specifying Restore Options from the GUI 192 Restoring a Database Using T-SQL 194 Executing a Simple Restore 194 Creating a Copy of a Database 195 Retrieving Logical and Physical File Names 196 Displaying General Information About a Backup 198 Cleaning Up 200 Restoring Differential Backups 200 Restoring Log Backups 201 Restoring File Backups 205 Testing Backups 207 Developing a Full Disaster Recovery Plan 207 Gathering Information About the Business 208 Establishing the Disaster Plan 209 Testing the Disaster Plan 210 Summary 211 ix

CONTENTS Chapter 10: Common Database Maintenance Tasks 213 Backing Up and Restoring Databases 213 Moving Data 214 Moving a Database Using the "Detach and Attach" Method 214 Moving a Database Using the Copy Database Wizard 216 Moving Data Using the Import and Export Wizard 220 Moving Data Using the Bulk Copy Program (BCP) 227 Checking Database Integrity 229 Maintaining Indexes 230 Detecting Fragmentation 231 Defragmenting Indexes 233 Distribution Statistics 234 Understanding Distribution Statistics 234 Updating Statistics 237 Creating Maintenance Plans 237 Scheduling Maintenance Tasks 244 Creating Log Files 245 Summary 247 Chapter 11: SQL Server Security 249 Terminology 249 Authentication 249 Authentication Mode 250 Authorization 250 Server Instance vs. the Database 250 SQL Server Instance Security 252 Creating a SQL Server Login 252 Server Roles Server Permissions 253 255 x

s CONTENTS Endpoints 256 User-Defined Server Roles 258 Database Security 259 Database Users 259 Schemas 259 Fixed Database Roles 262 Database Permissions 263 Flexible Database Roles 265 Security Functions 266 Contained Databases 267 Summary 269 Chapter 12: Auditing, Encryption, and Compliance 271 Auditing in SQLServer 272 Auditing Objects 273 Server Audit Object 274 Server Audit Specification Object 277 Database Audit Specification Object 280 User-Defined Audit Event 283 Encryption 284 Encryption Primer 285 Password-Based Encryption 285 Certificate-Based Encryption 288 Transparent Data Encryption 290 Validating Server Configuration 291 The Need for a Policy 291 Create Policy on a Local Server 291 xi

b CONTENTS Evaluate the Policy 294 Using the Central Management Server 295 Summary 296 Chapter 13: Performance Tuning and Optimization 299 Measuring SQL Server Performance 299 Understanding Performance Counters 300 Performance Monitor 302 Dynamic Management Objects 305 Data Collector 307 Setting Up the Data Collector 308 Viewing the Data Collector Data 311 Tuning Queries 319 Understanding Execution Plans 319 Gathering Query Information with Extended Events 326 Using the Database Engine Tuning Advisor 331 Managing Resources 333 Limiting Resource Use 334 Leveraging Data Compression 336 Summary 336 lichapter 14: Fault Tolerance 339 Defining a Service Level Agreement (SLA) 339 The "Nines" 340 Other Metrics 340 High Availability Features in SQL Server 341 Backup and Restore 341 Log Shipping 341 Replication 348 Database Mirroring 349 xii

CONTENTS AlwaysOn Failover Clustering 354 AlwaysOn Availability Groups 355 Configuring an AlwaysOn Availability Group 355 Creating a Windows Server Failover Cluster 356 Configuring the SQL Server Instance 358 Creating an Availability Group 359 Summary 363 Chapter 15: Cloud Computing for the DBA 365 Cloud Service Models 366 Infrastructure as a Service 366 Software as a Service 366 Platform as a Service 366 Windows Azure 367 Roles 368 Storage 369 AppFabric 369 Case Study. OCCMundial.com 369 Case Study: 3M 370 SQL Azure 372 Understanding SQL Azure 372 Getting Started 373 Managing a SQL Azure Database 378 Migrating Data into SQL Azure 380 Understanding SQL Azure specific views 384 Backing Up and Restoring Data with SQL Azure 385 Storing More Than Relational Data 385 Summary 386 xiii

CONTENTS s Chapter 16: SQL Server Private Cloud 387 Virtualization 389 Resource Pooling 389 Discovering SQL Server Sprawl 389 Upgrading SQL Server 395 Elasticity 398 Self-Service 399 Control and Customization 399 Implementation Options 399 Summary 400 Chapter 17: Where to Go Next? 401 Visit SQL Server Books Online 401 Keep Up with Public SQL Server Websites 401 Attend a Conference 402 Find a Local Users Group 402 Create a Lab System and Practice 403 Create a virtual machine using Virtual PC 2007 403 Get Certified! 405 Summary 405 Index 407 xiv