SQL Server Basics for non-DBAs Anil Desai. Speaker Information Anil Desai –Independent consultant (Austin, TX) –Author of several SQL Server books –Instructor,

Slides:



Advertisements
Similar presentations
Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Advertisements

Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Chapter 9 Security. Endpoints  A SQL Server endpoint is the point of entering into SQL Server.  It is implemented as a database object that defines.
Logins, Roles and Credentials Lesson 14. Skills Matrix.
SQL Server Data Protection and High Availability Anil Desai.
Anil Desai SQL Saturday #35 (Dallas, TX).  Anil Desai ◦ Independent consultant (Austin, TX) ◦ Author of several SQL Server books ◦ Instructor, “Implementing.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 4 Profiles, Password Policies, Privileges, and Roles.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
AGENDA Tools used in SQL Server 2000 Graphical BOL Enterprise Manager Service Manager CLI Query Analyzer OSQL BCP.
Passage Three Introduction to Microsoft SQL Server 2000.
Mike Fal - SQL SERVER SECURITY GRANTING, CONTROLLING, AND AUDITING DATABASE ACCESS March 17, 2011.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Chapter 2 Administrating DB Engine. Database Engine  The Database Engine is the core service for storing, processing, and securing data.  It provides.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Administration of Users Dr. Gabriel. 2 Documentation of User Administration Part of the administration process Reasons to document: –Provide a paper trail.
Overview What is SQL Server? Creating databases Administration Security Backup.
Introduction to SQL 2005 Security Nick Ward SQL Server Specialist Nick Ward SQL Server Specialist
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
Chapter 4 SQL. SQL server Microsoft SQL Server is a client/server database management system. Microsoft SQL Server is a client/server database management.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Chapter 2: Designing Physical Storage MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design Study Guide (70-443)
Module 3: Managing Database Files. Overview Introduction to Data Structures Creating Databases Managing Databases Placing Database Files and Logs Optimizing.
Today’s Objectives Chapters 10 and 11 Security in SQL Server –Manage server logins and database users. –Manage server-level, database-level, and application.
Module 7: Fundamentals of Administering Windows Server 2008.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 4 Profiles, Password Policies, Privileges, and Roles.
Chapter 6 : Designing SQL Server Service-Level Security MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design Study Guide.
DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.
Security David Frommer Principal Architect Business Intelligence Microsoft Partner of the Year 2005 & 2007.
Chokchai Junchey Microsoft Product Specialist Certified Technical Training Center.
MICROSOFT SQL SERVER 2005 SECURITY  Special Purpose Logins and Users  SQL Server 2005 Authentication Modes  Permissions  Roles  Managing Server Logins.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Module 4: Managing Security. Overview Implementing an Authentication Mode Assigning Login Accounts to Users and Roles Assigning Permissions to Users and.
© Wiley Inc All Rights Reserved. MCSE: Windows Server 2003 Active Directory Planning, Implementation, and Maintenance Study Guide, Second Edition.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Module 1: Exploring Replication. Overview Understanding SQL Server Replication Setting Up Replication Understanding Agents in Replication Securing Replication.
Copyright © 2013 Curt Hill Database Security An Overview with some SQL.
Module 16: Performing Ongoing Database Maintenance
Module 10 Assigning Server and Database Roles. Module Overview Working with Server Roles Working with Fixed Database Roles Creating User-defined Database.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Securing SQL Server 2005 Anil Desai. Speaker Information Anil Desai –Independent consultant (Austin, TX) –Author of several SQL Server books –Instructor,
1 Chapter Overview Defining Operators Creating Jobs Configuring Alerts Creating a Database Maintenance Plan Creating Multiserver Jobs.
Permissions Lesson 13. Skills Matrix Security Modes Maintaining data integrity involves creating users, controlling their access and limiting their ability.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
Module 11 Authorizing Users to Access Resources. Module Overview Authorizing User Access to Objects Authorizing Users to Execute Code Configuring Permissions.
SQL School is strongly committed to provide COMPLETE PRACTICAL REALTIME Trainings on SQL Server Technologies – Dev, SQL DBA, MSBI (SSIS, SSAS, SSRS) and.
INTRO TO SQL SERVER SECURITY By Robert Biddle
System Center Lesson 4: Overview of System Center 2012 Components System Center 2012 Private Cloud Components VMM Overview App Controller Overview.
Database Security Cmpe 226 Fall 2015 By Akanksha Jain Jerry Mengyuan Zheng.
Module 1 Introduction to SQL Server® 2008 R2 and its Toolset.
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
SQL Server Administration. Overview  Security  Server roles  Database roles  Object permissions  Application roles  Managing data  Backups  Restoration.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Introduction to SQL Server  Working with MS SQL Server and SQL Server Management Studio.
Introduction to SQL Server for Windows Administrators Presented to WiNSUG 02/05/09 Bret Stateham Owner, Net Connex Blogs.netconnex.com.
SQL Server Security The Low Hanging Fruit. Lindsay Clark Database Administrator at American Credit Acceptance
SQL Basics Review Reviewing what we’ve learned so far…….
WELCOME! SQL Server Security. Scott Gleason This is my 9 th Jacksonville SQL Saturday Over ten years DBA experience Director of Database Operations
SQL Database Management
Administrating a Database
Module 1: SQL Server Overview
Microsoft SQL Server 2014 for Oracle DBAs Module 8
Access, Users, Permissions
Copyright © 2013 – 2018 by Curt Hill
PT2520 Unit 8: Database Security I
Chapter 11 Managing Databases with SQL Server 2000
Administrating a Database
Sql Saturday Philadelphia
We Need To Talk Security
Presentation transcript:

SQL Server Basics for non-DBAs Anil Desai

Speaker Information Anil Desai –Independent consultant (Austin, TX) –Author of several SQL Server books –Instructor, “Implementing and Managing SQL Server 2005” (Keystone Learning) –Info: or

Overview and Agenda I.SQL Server 2005 Platform Overview II.Managing Databases III.Database Maintenance and Data Protection IV.Securing SQL Server V.Managing Database Objects / Best Practices

SQL Server 2005 Platform Overview Understanding SQL Server’s features, services, and administrative tools

Relational Database Server Goals ReliabilityAvailabilityScalability Performance Data Integrity and Protection Transaction Isolation Reporting Data Analysis

SQL Server 2005 Architecture SQL Server Database Engine –Storage Engine –Query Engine Databases –Logical collections of related objects Instances –Separate running services of SQL Server Default instance and named instances

SQL Server Services Instance-Specific (one service per instance) : –SQL Server –SQL Server Agent –Analysis Services –Reporting Services –Full-Text Search Instance-unaware –Notification Services –Integration Services –SQL Server Browser –SQL Server Active Directory Helper –SQL Writer

SQL Server 2005 Admin. Tools SQL Server Management Studio –Database management GUI Object browser; templates, reports, etc. –Based on Visual Studio 2005 IDE –Support for writing and executing queries SQL Business Intelligence Dev. Studio –Analysis Services, Reporting Services, SSIS

SQL Server 2005 Admin. Tools SQL Server Profiler Database Engine Tuning Advisor SQL Server Configuration Manager –Manages services and protocols Surface Area Configuration SQL Server Books Online

Configuring SQL Server Default options are set during installation SQL Server Management Studio Server Properties: –Memory –Processors –Security (Windows, SQL Server); Auditing –Database settings (default file locations)

Managing Databases An overview of working with physical and logical database files

SQL Server Physical Data Files Database storage –Primarily table data and index data Database Files: –Primary data file (*.mdf) –Secondary data files (*.ndf) –Transaction log file(s) (*.ldf) Filegroups: –Logical collections of files –Objects can be created on filegroups

Monitoring Disk Usage SQL Server Management Studio Reports –Server: Server Dashboard –Database: Disk Usage (several reports) Transact-SQL –Stored Procedures: sp_Help, sp_HelpDB, sp_SpaceUsed –System Tables / Views Sys.Database_Files

Designing Data Storage Goals: –Maximize performance by reducing contention –Simplify administration Best practices: –Monitor and analyze real-world workloads –Separate data files and transaction log files

Comparing RAID Levels RAID LevelRAID DescriptionDisk Space CostRead Performance Write Performance RAID 1Disk Mirroring 50% of total disk space No change RAID 5Stripe Set with Parity Equivalent to the size of one disk in the array. IncreasedDecreased RAID or RAID 10 Mirrored Stripe Sets50% of total disk space IncreasedNo change

Monitoring Disk Usage

Moving and Copying Databases Copy Database Wizard Attaching and detaching databases –Allows directly copying data/log files –Database must be taken offline Backup / Restore Other methods: –SQL Server Integration Services (SSIS) –Generating scripts for database objects –Bulk copy / BULK INSERT

Database Maintenance & Data Protection Methods for maintaining, backing up, and restoring databases

Database Backup Types Recovery Models –Full –Bulk-logged –Simple Backup operations –Full Backups –Differential Backups –Transaction Log Backups Allows point-in-time recovery

Recovery Processes Recovery process: –Latest full backup (Required) –Latest differential backup (Optional) –Unbroken sequence of transaction log backups (Optional) All transaction logs should be restored with NO RECOVERY option (except for the last one) –Prevents database from being accessed while restore process is taking place

Database Maintenance Plans Maintenance Tasks Check database integrity Shrink database Rebuild / reorganize indexes Update statistics Miscellaneous Tasks Execute SQL Server Agent Job Maintenance Cleanup Task Backup Databases Full Backup Differential Backup Transaction Log Backup

Maintenance Plan Wizard Scheduling –Single schedule for all tasks –Multiple schedules Databases: –System, All, All User, or specific databases Wizard Options: –Order of operations Manages logging and history of operations

Reliability & Availability Options Database Mirroring Log-shipping SQL Server Fail-Over Clusters Distributed Federated Servers Replication Load-Balancing (at network or OS level)

Securing SQL Server Understanding SQL Server 2005’s security architecture and objects

SQL Server Security Overview Layered Security Model: –Windows Level –SQL Server Level –Database Schemas (for database objects) Terminology: –Principals –Securables –Permissions Scopes and Inheritance

Security Overview (from Microsoft SQL Server 2005 Books Online)

Security Best Practices Make security a part of your standard process Use the principle of least privilege Implement defense-in-depth (layered security) Enable only required services and features Regularly review security settings Educate users about the importance of security Define security roles based on business rules

SQL Server Service Accounts Local Service Account –Permissions of “Users” group (limited) –No network authentication Network Service Account –Permissions of Users group –Network authentication with Computer account Domain User Accounts –Adds network access for cross-server functionality

SQL Server Surface Area Configuration Default installation: Minimal services SAC for Services and Connections –Allow Remote Connections –Access to Reporting Services, SSIS, etc. SAC for Features –Remote queries –.NET CLR Integration –Database Mail –xp_cmdshell

Managing Logins Windows Logins –Authentication/Policy managed by Windows SQL Server Logins –Managed by SQL Server Based on Windows policies –Password Policy Options: HASHED (pw is already hashed) MUST_CHANGE CHECK_EXPIRATION CHECK_POLICY

Creating Logins Transact-SQL –CREATE LOGIN statement Replaces sp_AddLogin and sp_GrantLogin –SQL Server Logins –Windows Logins SQL Server Management Studio –Setting server authentication options –Login Auditing –Managing Logins

Database Users and Roles Database Users –Logins map to database users Database Roles –Users can belong to multiple roles –Guest (does not require a user account) –dbo (Server sysadmin users) Application Roles –Used to support application code

Creating Database Users and Roles CREATE USER –Replaces sp_AddUser and sp_GrantDBAccess –Can specify a default schema –Managed with ALTER USER and DROP USER CREATE ROLE –Default owner is creator of the role SQL Server Management Studio –Working with Users and Roles

Built-In Server / Database Roles Server Roles SysAdmin ServerAdmin SetupAdmin SecurityAdmin ProcessAdmin DiskAdmin DBCreator BulkAdmin Database Roles db_accessadmin db_BackupOperation db_DataReader db_DataWriter db_DDLAdmin db_DenyDataReader db_DenyDataWriter db_Owner db_SecurityAdmin public

Understanding Database Schemas Schemas –Logical collection of related database objects –Part of full object name: Server.Database.Schema.Object –Default schema is “dbo” Managing Schemas –CREATE, ALTER, DROP SCHEMA –SQL Server Management Studio –Can assign default schemes to database users: WITH DEFAULT_SCHEMA ‘SchemaName’

Configuring Permissions Scopes of Securables –Server –Database –Schema –Objects Permission Settings: –GRANT –REVOKE –DENY Options –WITH GRANT OPTION –AS (Sets permissions using another user or role)

Managing Execution Permissions Transact-SQL Code can run under a specific execution context –By default, will execute as the caller EXECUTE AS clause: –Defined when creating an object or procedure –Options: CALLER (Default) SELF: Object creator Specified database username

Other Security Options Database Encryption –Encrypting Object Definitions –Data encryption SQL Server Agent –Proxies based on subsystems allow lock- down by job step types Preventing SQL Injection attacks –Use application design best practices

Managing Database Objects Understanding database design, tables, and indexes

Overview of Database Objects Tables Data storage & Retrieval Referential integrity Indexes Improves query performance Clustered Non-clustered Views Logical result sets Based on SELECT queries Programmability Stored Procedures Functions Triggers Constraints

Designing a database Normalization –Reduces redundancy and improves data modification performance –Denormalization is often done to enhance reporting performance (at the expense of disk space and redundancy) Referential Integrity –Maintains the logical relationships between database objects

The 1-Minute * SQL Overview The Structured Query Language (SQL) defines a standard for interacting with relational databases –Most platforms support ANSI-SQL 92 –Most platforms provide many non-ANSI-SQL additions Most important data modification SQL statements: –SELECT: Returning rows –UPDATE: Modifying existing rows –INSERT: Creating new rows –DELETE: Removing existing rows * Presenter makes no guarantee about the time spent on this slide

Indexing Overview Index Considerations –Can dramatically increase query performance –Adds overhead for index maintenance Best Practices –Base design on real-world workloads SQL Profiler; Execution Plans –Scenarios: Retrieving ranges of data Retrieving specific values

Index Types Clustered index –Controls the physical order of rows –Does not require disk space –One per table (may inc. multiple columns) –Created by default on tables’ Primary Key column Non-Clustered Index –Physical data structures that facilitate data retrieval –Can have many indexes –Indexes may include many columns

Database Management Best Practices Maintenance and optimization of SQL Server 2005

SQL Server Maintenance Monitor real-world (production) database usage Communicate and coordinate with application developers and users Develop policies and roles for database administration Optimize database administration –Automate common operations –Generate scripts for routine maintenance

SQL Server Maintenance Regular tasks –Monitor disk space usage –Monitor application performance –Monitor physical and logical disk space –Maintain indexes and data files –Review backup and recovery operations –Review security –Review SQL Server Logs and/or Windows logs –Verify the status of all jobs

SQL Server Management Features SQL Server Agent –Jobs –Alerts –Operators SQL Server Logs Database Mail Linked Servers

For More Information Resources from Anil Desai –Web Site ( – Keystone Learning Course: “Microsoft SQL Server 2005: Implementation and Maintenance (Exam )” The Rational Guide to Managing Microsoft Virtual Server 2005 The Rational Guide to Scripting Microsoft Virtual Server 2005

Questions & Discussion