Introduction to SQL Server  Working with MS SQL Server and SQL Server Management Studio.

Slides:



Advertisements
Similar presentations
Creating Databases and E/R Diagrams with SQL Server Management Studio Svetlin Nakov Telerik Corporation
Advertisements

Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Copyright ®xSpring Pte Ltd, All rights reserved Versions AuthorDateDescription 1.0NBL2012/05First version. Modified from Enterprise edition.
Telerik Software Academy Telerik School Academy.
Copyright ®xSpring Pte Ltd, All rights reserved Versions AuthorDateDescription 1.0NBL2012/05First version. Modified from Enterprise edition.
Chapter 9 Chapter 9: Managing Groups, Folders, Files, and Object Security.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
1 1. SQL SERVER OVERVIEW zWhat Is SQL Server? zInterfaces To Use SQL Server zSQL Server Services zTypes Of Databases zSQL Server Security.
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.
Week 2 - Installation SQL SERVER2000 ENTERPRISE EDITION INSTALLATION.
Passage Three Introduction to Microsoft SQL Server 2000.
SQL Server Management Studio Introduction
A Technical Overview of Microsoft SQL Server 2005 Melville Thomson IT Pro Evangelist (UK)
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Svetlin Nakov Telerik Software Academy Manager Technical Training
Chapter 2 Administrating DB Engine. Database Engine  The Database Engine is the core service for storing, processing, and securing data.  It provides.
Today’s Agenda Chapter 12 Admin Tasks Chapter 13 Automating Admin Tasks.
Overview What is SQL Server? Creating databases Administration Security Backup.
Module 1: Introduction to Microsoft SQL Server 7.0.
Overview of SQL Server Alka Arora.
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.
Microsoft Azure Introduction ISYS 512. Microsoft Azure Microsoft Azure is a cloud.
Maintaining a Mirrored Database Tips and Tricks by Paul G. Hiles.
1 SQL Server 2000 Administration Kashef Mughal MSB.
MICROSOFT SQL SERVER 2005 SECURITY  Special Purpose Logins and Users  SQL Server 2005 Authentication Modes  Permissions  Roles  Managing Server Logins.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
Module 14 Configuring Security for SQL Server Agent.
Module 1: Exploring Replication. Overview Understanding SQL Server Replication Setting Up Replication Understanding Agents in Replication Securing Replication.
Module 4 : Installation Jong S. Bok
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 Preparing to Upgrade Performing a Version Upgrade from Microsoft SQL Server 7.0 Performing an Online Database Upgrade from SQL Server.
SQL Server 2012 Session: 1 Session: 3 Introduction to SQL Server 2012 Data Management Using Microsoft SQL Server.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
A Brief Documentation.  Provides basic information about connection, server, and client.
2. SQL Security Objectives –Learn SQL Server 2000 components Contents –Understanding the Authentication Process –Understanding the Authorization Process.
1 Chapter Overview Defining Operators Creating Jobs Configuring Alerts Creating a Database Maintenance Plan Creating Multiserver Jobs.
BSG Group - Dau Anh Trong1 Introduction about MS SQL Server 2005.
Hosting Websites and Web Applications with Microsoft ® SQL Server ® 2008.
Learningcomputer.com SQL Server 2008 – Management Studio.
IMS 4212 Lab: Lab Introduction 1 Dr. Lawrence West, MIS Dept., University of Central Florida Subject—Topics Installing.
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
SSMS SQL Server Management System. SQL Server Microsoft SQL Server is a Relational Database Management System (RDBMS) Relational Database Management System.
Creating Simple and Parallel Data Loads With DTS.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
Introduction to SQL Server for Windows Administrators Presented to WiNSUG 02/05/09 Bret Stateham Owner, Net Connex Blogs.netconnex.com.
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
1 BCS 4 th Semester. Step 1: Download SQL Server 2005 Express Edition Version Feature SQL Server 2005 Express Edition SP1 SQL Server 2005 Express Edition.
SQL Server Security The Low Hanging Fruit. Lindsay Clark Database Administrator at American Credit Acceptance
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
DBMS Programs MS SQL Server & MySQL
How to Start SQL Server and SSDT BI in Local
Administrating a Database
Module 1: SQL Server Overview
Managing, Storing, and Executing DTS Packages
Microsoft SQL Server 2014 for Oracle DBAs Module 8
Lecture 6 VB.Net SQL Server.
Deploying and Configuring SSIS Packages
Automating SQL Server Management
Using JDeveloper.
8 6 MySQL Special Topics A Guide to MySQL.
Chapter 11 Managing Databases with SQL Server 2000
Administrating a Database
Ch 1 .Installing and configuring SQL Server 2005
06 | SQL Server and the Cloud
Presentation transcript:

Introduction to SQL Server  Working with MS SQL Server and SQL Server Management Studio

Table of Contents 1. SQL Server Overview 2. SQL Server Services 3. Types of Databases 4. Authentication and Permissions 5. SQL Server Management Studio 6. Moving a SQL Server Database  Through Backups and Restore  By Detaching and Attaching 2

MS SQL ServerMS SQL Server Overview

What is Microsoft SQL Server?What is Microsoft SQL Server?  MS SQL Server  Relational Database Management System (RDBMS) from Microsoft  The main language in SQL Server  Transact SQL (T-SQL), an extension of SQL  Powerful, trustworthy, easy-to-use DB server  The most recent version is SQL Server 2014  Works only on Windows systems 4

How to Install SQL Server? 1. Download SQL Server 2014  SQL Server 2014 Express (free distribution)   DreamSpark – you can register with academic DreamSpark 5

SQL Server Services Background-Running Processes

Services of SQL Server 2012Services of SQL Server 2012  SQL Server – the database engine  Responsible for database management, data storage, queries, data manipulation, data integrity, transactions, locking, users, security, etc.  Executes SQL / T-SQL queries  SQL Server Agent – DB monitoring  Executes scheduled tasks  Monitors the SQL Server  Sends notifications about problems 7

Services in SQL Server 2012 (2)Services in SQL Server 2012 (2)  Distributed Transaction Coordinator (MSDTC)  Manages database transactions across multiple processes  Supports transactions that span multiple databases  Coordinates committing the distributed transaction across all the servers that are enlisted in the transaction  Implements 2-phase commit 8

SQL Server Databases msdb Northwind tempdb msdb

SQL Server DatabasesSQL Server Databases  SQL Server has system and user databases  System databases  Maintain internal information about MS SQL Server as a system  Don't play with them!  User databases  Databases created by users (developers)  Store user's schemas and data  Use the system databases internally 10

Types of SQL Server DatabasesTypes of SQL Server Databases 11 System Databases User Databases model tempdb msdb distribution pubsNorthwind… master

System DatabasesSystem Databases – meta-database keeping data about  Master – meta-database keeping data about  User accounts  Configurable environment variables  System error messages – a prototype for new databases  Model – a prototype for new databases – storage for temporary tables and database objects  Tempdb – storage for temporary tables and database objects – alerts and scheduled tasks  MSdb – alerts and scheduled tasks 12

SQL Server DatabasesSQL Server Databases  Each SQL Server database consists of two files: file .mdf file  Contains the core data in the database  Schema, tables data, and other database objects file .ldf file  Transaction log – keeps track of transactions  You need both these files to use the database 13

SQL Server AuthenticationSQL Server Authentication Users, Roles, Permissions

Connecting to SQL ServerConnecting to SQL Server  Connecting to SQL Server requires  The name of the server (e.g. localhost )  The name of the DB instance (e.g. SQLEXPRESS )  The name of the database (e.g. Northwind )  Username / password (if using SQL Server authentication)  Types of authentication in SQL Server  Windows (by using a Windows user credentials)  Mixed (both Windows and SQL Server) 15

SQL Server Users PermissionsSQL Server Users Permissions  Each user has certain permissions and roles for a database (Database User Account)  A role defines a group of users with the same permissions  There are 3 types of roles in MS SQL Server  Fixed server roles  Fixed database roles  User-defined database roles 16

Fixed Database RolesFixed Database Roles – maintains all default permissions for users in a database  Public – maintains all default permissions for users in a database – performs any database role activity  Db_owner – performs any database role activity – add or remove database users, groups, and roles  Db_accessadmin – add or remove database users, groups, and roles – add, modify, or drop database objects  Db_ddladmin – add, modify, or drop database objects – assign statement and object permissions  Db_securityadmin – assign statement and object permissions  Others … 17

SQL Server Authentication Live Demo

SQL Server Management StudioSQL Server Management Studio A Powerful Management Tool for Administrators and DevelopersA Powerful Management Tool for Administrators and Developers

SQL Server Management Studio (SSMS)SQL Server Management Studio (SSMS)  SQL Server Management Studio (SSMS) is a powerful graphical DB management tool  Administrate databases (create, modify, backup / restore DB)  Create and modify E/R diagrams  View / modify table data and other DB objects  Execute SQL queries  Free and easy to use tool  Works with all SQL Server versions 20

SQL Server Management Studio – Screenshot 21

SSMS Setting Server AccountSSMS Setting Server Account  You can use SSMS to create database user / give permissions to Windows users  Follow these steps: 1. Right click on the [Security / Login] folder in Object Explorer and choose "New Login…" 22

SSMS Setting Server Account (2)SSMS Setting Server Account (2) 2. In the next dialog click the [Search] button  Select one of the Windows accounts in a typical Windows fashion  Leave the authentication method set to Windows authentication  Click [OK]  Thus you create an SQL Server User account  Account permissions could be assigned later  Windows administrators already have access 23

SSMS Setting Database AccountSSMS Setting Database Account 1. Right click on the "Security" under some of the databases and choose "New"  "User" 2. Enter username and select one of the Server accounts to use 3. Assign the roles for this user 4. Click [OK] to confirm  By selecting the [Name-of-Database]  "Properties"  "Permissions" you can also set specific permissions for the accounts 24

Creating Accounts and Assigning Permissions in SQL Server

Using SQL Server Management StudioUsing SQL Server Management Studio  SSMS can be used to visually edit the structure or data in a database  It can execute T-SQL queries  Select the database you want to work with in the Object Explorer  Click the [New Query] button  Write the query in the window to the right of Object Explorer  Click the [Execute] button 26

Executing SQL – Screenshot 27

Executing Simple SQL Queries in SQL Server Management Studio

Moving an SQL Server DatabaseMoving an SQL Server Database Backup / Restore, Detach / Attach

Moving a SQL Server DatabaseMoving a SQL Server Database  Necessary when we install a certain application at the customer environment  Ways of moving an SQL Server database:  By backup and restore  Create backup and restore it on the other server  By detaching and attaching the database files  The 2 servers must be the same versions!  By dumping the database as SQL script  Export the database to SQL script and import it into a new server 30

Moving DB by Backup and RestoreMoving DB by Backup and Restore  Backup and restore database through SSMS 31

Moving DB by Detaching and AttachingMoving DB by Detaching and Attaching  On the source server:  Choose the database in SQL Server Management Studio  From the context menu we choose the Detach command  We copy the database files from the source server to the destination server: .mdf .ldf  Typical location: C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA 32

Moving DB by SQL Script Export / Import  Export a MS SQL database as SQL script  Database  Tasks  Generate Scripts  Advanced  Types of data to script  Schema and data 33

Moving a Database by Detaching and Attaching

SQL Server LocalDB Auto-Started MSQL Databases

SQL Server LocalDB  SQL Server Express LocalDB  Special version of SQL Server Express for developers  Lightweight, dynamically attachable MSSQL databases  Auto-started upon connection request  Console-based administration  List all LocalDB engine instances:  Start a LocalDB engine instance:  Stop a LocalDB engine instance: 36 sqllocaldb info sqllocaldb start MSSQLLocalDB sqllocaldb stop MSSQLLocalDB

Connecting to SQL Server LocalDB  SQL Server LocalDB uses special connection strings:  SQL Server Express 2012 LocalDB:  SQL Server Express 2014 LocalDB:  The database engine is auto-started on demand (upon connection request) 37 (localdb)\v11.0 (localdb)\MSSQLLocalDB

SQL Server LocalDB

Summary  What is RDBMS?  What is the purpose of SQL Server Agent service? ?  What is MSdb ?  Why we need the.ldf file?  How do we backup / restore a database?  How do we export a DB to SQL script?  How do we import a DB from a SQL script?  What is SQL Server Express LocalDB ? 39