Chapter 4 SQL. SQL server Microsoft SQL Server is a client/server database management system. Microsoft SQL Server is a client/server database management.

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

Transaction Log file:.ldf Extent: 8 contiguous 8KB pages Page: 8KB Primary Data file:.mdf Secondary data file:.ndf Primary Data file:.mdf Secondary.
Basic SQL Introduction Presented by: Madhuri Bhogadi.
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Module 4 Working with Databases. Module Overview Overview of SQL Server Databases Working with Files and Filegroups Moving Database Files.
Chapter 9 Auditing Database Activities
Module 3: Creating and Managing Databases. Overview Creating Databases Creating Filegroups Managing Databases Introduction to Data Structures.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 9-1 COS 346 Day 21.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Harvard University Oracle Database Administration Session 5 Data Storage.
Microsoft SQL Server Administration for SAP SQL Server Architecture.
Chapter 5 Data Manipulation and Transaction Control Oracle 10g: SQL
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
AGENDA Tools used in SQL Server 2000 Graphical BOL Enterprise Manager Service Manager CLI Query Analyzer OSQL BCP.
Database Configuration and Maintenance Database Configuration and Maintenance Exam / 30.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
1 Chapter Overview Understanding Backup Terms, Media, and Devices Backing Up Databases, Files, Filegroups, and Transaction Logs Restoring a User Database.
Session 7 Creating and Managing Databases. RDBMS and Data Management/ Session 7/2 of 27 Session Objectives Describe the system and user-defined databases.
Overview What is SQL Server? Creating databases Administration Security Backup.
1 Chapter Overview Creating a User Database Setting Database Options Managing User Database Size Placing Database Files on Multiple Disks.
Database Lecture # 1 By Ubaid Ullah.
Chapter 9 SQL and RDBMS Part C. SQL Copyright 2005 Radian Publishing Co.
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)
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Module 3: Managing Database Files. Overview Introduction to Data Structures Creating Databases Managing Databases Placing Database Files and Logs Optimizing.
Database Technical Session By: Prof. Adarsh Patel.
Agenda for Today Chapter 5 –Skip Lesson 2 Review questions Midterm Chapter 6 Review questions.
Databases Lesson 5.
Architecture Rajesh. Components of Database Engine.
Company LOGO 1 Database Creation and Maintenance Jorge G. Martinez.
Introduction to SEQUEL. What is SEQUEL? Acronym for Structural English Query Language Acronym for Structural English Query Language Standard language.
1 SQL Server 2000 Administration Kashef Mughal MSB.
SQL/Lesson 4/Slide 1 of 45 Using Subqueries and Managing Databases Objectives In this lesson, you will learn to: *Use subqueries * Use subqueries with.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Module 5: Upgrading to SQL Server 7.0. Overview Planning an Upgrade Preparing to Upgrade Verifying the Upgrade Setting a Compatibility Level.
1 Chapter Overview Preparing to Upgrade Performing a Version Upgrade from Microsoft SQL Server 7.0 Performing an Online Database Upgrade from SQL Server.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 9 Auditing Database Activities.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
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.
Permissions Lesson 13. Skills Matrix Security Modes Maintaining data integrity involves creating users, controlling their access and limiting their ability.
Oracle 11g: SQL Chapter 7 User Creation and Management.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
SQL SERVER AUDITING. Jean Joseph DBA/Consultant Contact Info: Blog:
Hands-On Microsoft Windows Server 2008 Chapter 7 Configuring and Managing Data Storage.
SQL Server 2012 Session: 1 Session: 6 Creating and Managing Databases Data Management Using Microsoft SQL Server.
1 Database Fundamentals Introduction to SQL. 2 SQL Overview Structured Query Language The standard for relational database management systems (RDBMS)
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
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.
Advanced Database & Client Server Introduction to MS SQL Server 2000 and Transact SQL -
Introduction to SQL Server  Working with MS SQL Server and SQL Server Management Studio.
Enterprise Database Systems Introduction to SQL Server Dr. Georgia Garani Dr. Theodoros Mitakos Technological.
SQL Basics Review Reviewing what we’ve learned so far…….
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
In this session, you will learn to: Manage databases Manage tables Objectives.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
Understanding Core Database Concepts Lesson 1. Objectives.
Table spaces.
Introduction To Database Systems
Chapter Overview Understanding the Database Architecture
Microsoft SQL Server 2014 for Oracle DBAs Module 3
مقدمة في قواعد البيانات
SQL .. An overview lecture3.
Chapter 11 Managing Databases with SQL Server 2000
Understanding Core Database Concepts
Presentation transcript:

Chapter 4 SQL

SQL server Microsoft SQL Server is a client/server database management system. Microsoft SQL Server is a client/server database management system. A client/server database management system consists of two components: A client/server database management system consists of two components: A front-end component (the client), which is used to present and manipulate data; A front-end component (the client), which is used to present and manipulate data; A backend component (the database server), which is used to store, retrieve, and protect the databases. A backend component (the database server), which is used to store, retrieve, and protect the databases.

Components of SQL Server The commands you primarily use to query a database on a database server are The commands you primarily use to query a database on a database server are part of the Structured Query Language (SQL). part of the Structured Query Language (SQL). The Structured Query Language is a standardized set of commands used to work with databases. The Structured Query Language is a standardized set of commands used to work with databases. Microsoft SQL Server 2000 supports an enhanced version of SQL referred to as Transact-SQL Microsoft SQL Server 2000 supports an enhanced version of SQL referred to as Transact-SQL Transact-SQL commands used to create, maintain, and query databases Transact-SQL commands used to create, maintain, and query databases Microsoft Microsoft SQL Server supports the most recently published standards for ANSI SQL. Sometimes, the version of SQL implemented in SQL Server referred to as SQL-92. SQL Server supports the most recently published standards for ANSI SQL. Sometimes, the version of SQL implemented in SQL Server referred to as SQL-92.

Transact-SQL Data Definition Language (DDL) statements, which enable you to create database objects. Data Definition Language (DDL) statements, which enable you to create database objects. Data Manipulation Language (DML) statements, which enable you to query or modify data. Data Manipulation Language (DML) statements, which enable you to query or modify data. Data Control Language (DCL) statements, which enable you to determine,set, or revoke users’ permissions to SQL databases and their objects Data Control Language (DCL) statements, which enable you to determine,set, or revoke users’ permissions to SQL databases and their objects

Microsoft SQL Server 2000 supports two login authentication modes : Microsoft SQL Server 2000 supports two login authentication modes : Windows Authentication mode Windows Authentication mode Mixed mode Mixed mode

Database Master – Information about the operation of SQL Server,including user accounts, other SQL servers,environment variables,error messages,databases, storage space allocated to databases,and the tapes and disk drives on the SQL server. Master – Information about the operation of SQL Server,including user accounts, other SQL servers,environment variables,error messages,databases, storage space allocated to databases,and the tapes and disk drives on the SQL server. Model – A template for creating new databases. SQL Server automatically copies the objects in this database to each new database you create. Model – A template for creating new databases. SQL Server automatically copies the objects in this database to each new database you create. Msdb – Information about all scheduled jobs,defined alerts,and operators on your server. This information is used by the SQL Server Agent service. Msdb – Information about all scheduled jobs,defined alerts,and operators on your server. This information is used by the SQL Server Agent service. Tempdb –Temporary information. This database is used as a scratchpad by SQL Server. Tempdb –Temporary information. This database is used as a scratchpad by SQL Server. Northwind, pubs – A sample database for learning SQL Server. Northwind, pubs – A sample database for learning SQL Server.

Components of SQL Server The SQL Server Services The SQL Server Services

SQL Server Enterprise Manager can also create your own server groups to organize your SQL servers can also create your own server groups to organize your SQL servers

SQL Query Analyzer Use SQL Query Analyzer to run SQL queries as well as to optimize the performance of the queries. Use SQL Query Analyzer to run SQL queries as well as to optimize the performance of the queries. A query is simply a command you send to your server. This query can request data from the server, change data, or delete information. A query is simply a command you send to your server. This query can request data from the server, change data, or delete information.

SQL Query Analyzer

Using SQL Query Analyzer

SQL Server Database Structure the term database refers to a collection of tables and other database objects such as indexes the term database refers to a collection of tables and other database objects such as indexes A table consists of rows and columns; these rows and columns contain the data for the table. A table consists of rows and columns; these rows and columns contain the data for the table. A database can contain a virtually unlimited number of tables; each table can contain a maximum of 1,024 columns (fields). A database can contain a virtually unlimited number of tables; each table can contain a maximum of 1,024 columns (fields).

Designing and Implementing Databases To design, create, and manage databases: To design, create, and manage databases: Identify the issues for designing databases Identify the issues for designing databases Create and configure databases Create and configure databases Manage databases Manage databases

Identifying Database Design Issues Databases and Files: Databases and Files: A database is a collection of database objects; these objects include tables, indexes, views, and stored procedures. A database is a collection of database objects; these objects include tables, indexes, views, and stored procedures. At a minimum, each database consists of a primary data file with an extension of.mdf. At a minimum, each database consists of a primary data file with an extension of.mdf. In addition to its primary data file,you can optionally configure SQL Server to store a database in a secondary data file. These files use the extension of.ndf. In addition to its primary data file,you can optionally configure SQL Server to store a database in a secondary data file. These files use the extension of.ndf.

Identifying Database Design Issues Transaction Logs:In addition to a database’s primary data file, you must also create a transaction log for each database. Transaction Logs:In addition to a database’s primary data file, you must also create a transaction log for each database. SQL Server automatically assigns the extension of.ldf to each transaction log file. SQL Server automatically assigns the extension of.ldf to each transaction log file. SQL Server uses the transaction log to make it possible to either recover (roll forward) or undo (roll back) a transaction to protect your database from corruption in the event of a server crash.. SQL Server uses the transaction log to make it possible to either recover (roll forward) or undo (roll back) a transaction to protect your database from corruption in the event of a server crash..

File groups When create a database, SQL Server automatically creates a default filegroup that contains your database’s primary data file When create a database, SQL Server automatically creates a default filegroup that contains your database’s primary data file

SQL Server uses disk space in 8 KB pages. SQL Server uses disk space in 8 KB pages. SQL Server uses some pages to keep track of the space allocated within a database SQL Server uses some pages to keep track of the space allocated within a database Within a database, SQL Server allocates space for database objects such as tables and indexes in extents. Within a database, SQL Server allocates space for database objects such as tables and indexes in extents. An extent is a contiguous block of eight pages for a total of 64 KB of disk space. An extent is a contiguous block of eight pages for a total of 64 KB of disk space. A database consists of 16 extents per megabyte. A database consists of 16 extents per megabyte.

Creating Databases Create a database by using: Create a database by using: the CREATE DATABASE Transact-SQL statement. the CREATE DATABASE Transact-SQL statement. the Create Database Wizard. the Create Database Wizard. SQL Server Enterprise Manager SQL Server Enterprise Manager

Using the Create Database Wizard

Creating a Database Using Transact-SQL CREATE DATABASE logical_database_name ON PRIMARY (NAME = logical_file_name, FILENAME = 'path\file_name', SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth_increment) LOG ON (NAME = logical_file_name, FILENAME = 'path\file_name', SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth_increment)

Creating a Database Using Transact-SQL CREATE DATABASE SalesDb ON (NAME = SalesDb_dat, FILENAME = 'c:\data\salesDB_dat.mdf', SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5) LOG ON (NAME = 'SalesDb_log', FILENAME = 'c:\data\salesDB_log.ldf', SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 10%) GO

Creating a Database Using Transact-SQL Creating Filegroup CREATE DATABASE logical_database_name ON PRIMARY (NAME = logical_file_name, FILENAME = 'path\file_name.mdf', SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth_increment) FILEGROUP filegroup_name (NAME = logical_file_name, FILENAME = 'path\file_name.ndf', SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth_increment) LOG ON (NAME = logical_file_name, FILENAME = 'path\file_name', SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth_increment)

ALTER DATABASE Adding Filegroups to an Existing Database ALTER DATABASE logical_database_name ADD FILEGROUP new_filegroup_name Adding Files ALTER DATABASE logical_database_name ADD FILE (NAME = logical_file_name, FILENAME = 'path\file_name.ndf', SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth_increment) TO FILEGROUP filegroup_name

ALTER DATABASE Configuring Database Options ALTER DATABASE database_name SET option[, status] ALTER DATABASE movies SET READ_ONLY

ALTER DATABASE Expanding a Database and its Transaction Log ALTER DATABASE database_name MODIFY FILE (NAME = 'logical_name', SIZE = size, MAXSIZE = maxsize, FILEGROWTH = filegrowth_increment) support unrestricted file growth by using the clause MAXSIZE = UNLIMITED

Deleting a Database DROP DATABASE database_name.

Using SQL Server Enterprise Manager