Presentation is loading. Please wait.

Presentation is loading. Please wait.

IT 456-01 System Administration Lesson 3 Dr Jeffrey A Robinson.

Similar presentations


Presentation on theme: "IT 456-01 System Administration Lesson 3 Dr Jeffrey A Robinson."— Presentation transcript:

1 IT 456-01 System Administration Lesson 3 Dr Jeffrey A Robinson

2 Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and Using a Database Week 4 - Using the SQL Server Agent Service Week 5 - Disaster Recovery Week 6 - SQL Server Security Week 7 - Performance Monitoring Week 8 - Performance Optimization Week 9 - High Availability

3 Unit 3 Programmable objects allow efficient reuse of code. User-defined functions can return a single value or a tabular value set. A stored procedure can provide security and performance benefits. Triggers can extend business rule enforcement beyond the realm of constraints. These programmable objects, as well as data types and aggregates, can be created from common language runtime (CLR) code that can be integrated into SQL Server.

4 SQL Server Management Studio (SSMS) has the capability of capturing the Transact-SQL (T- SQL) code corresponding to an administrative task, such as database creation, performed in the graphical user interface (GUI). This allows the administrator to perform tasks using the familiar and intuitive GUI interface, but also to capture the code for disaster recovery or other purposes. The fully qualified name of a database object is server.database.schema.object.

5 SQL SQL is a set-based query language used to retrieve and modify data in a relational database. There are American National Standards Institute (ANSI) standards that most versions of SQL adhere to. The version of SQL used by Microsoft SQL Server is Transact-SQL, or T- SQL.

6 Stored Procedures There are two aspects of stored procedures that make them powerful: There are two aspects of stored procedures that make them powerful: –sprocs are efficient, –and they can have optional input and output parameters. –and they can have optional input and output parameters.

7 Stored Procedures The efficiency comes from the fact that after the first time they are executed, the query plan for their execution is stored in SQL Server's procedure cache in RAM. This eliminates the steps of parsing (checking for correct query syntax), creation of a query tree (all referenced objects are translated into their object IDs), and compilation (the query optimizer's deciding on a query plan and placing the query plan in procedure cache). Efficiency of network traffic is achieved because when a front-end application on a client computer calls a stored procedure on a back-end SQL Server, only the call is sent across the network.

8 Stored Procedures A stored procedure can take input parameters. Here is an example that would produce a list of all orders placed by a particular customer and since a particular date What are the parameters?

9 When the above sproc is called, the input variables may be specified in one of two ways: (1) in order When the above sproc is called, the input variables may be specified in one of two ways: (1) in order EXEC Sales.pCustomerOrderList 25, '2007-01-01'; EXEC Sales.pCustomerOrderList 25, '2007-01-01'; or (2) by giving the name of the input parameter, in which case the parameters may be listed in any order or (2) by giving the name of the input parameter, in which case the parameters may be listed in any order EXEC Sales.pCustomerOrderList @SinceDate = '2007-01-01', @custid = 25; EXEC Sales.pCustomerOrderList @SinceDate = '2007-01-01', @custid = 25; Of course, when using the by parameter option, you must know the names of the parameters within the sproc's definition

10 Triggers What is a trigger? (Hint: they can occur with INSERT, UPDATE or DELETE queries) Types:AFTER INSTEAD OF

11 Unit 3 assignment Write a 200–300 word response to each of the following topics. 1. Define five options used when creating a database and identify the importance of each option. 2. Define the options for the recovery method available when creating a database. Identify the strengths and weaknesses of each option. 3. Define the terms stored procedure and function. Identify a scenario in which each is used.

12 Unit 3 Project For this Unit's Project you will: –Develop a stored procedure within the NWTraders database to evaluate characteristics of a customer and his/her purchases or employee and the purchases he/she have been involved in the procurement. Examples include the evaluation of purchases by customer by region, zip code with items or evaluation of employees by title, birthdate, region or zipcode. –

13 Introduction to Tlogs What is a transaction log? What are COMMITS? What is an UNCOMMIT? What is the relevance of a TLOG

14 TLOG TLOGS allow: UNDOs Real Time recovery Multi-threading of users Transaction history, traceability, security auditing Multiple machine synchronization (transaction shipping) Secondary and Tertiary machines

15 More on TLOGS What price TLOG? I/O bandwidth Disk space and growth Overhead PROS and CONS

16 Next week Week 4 - Using the SQL Server Agent Service More stuff on TLOGs

17 Unit 4 Using the SQL Server Agent Service The SQL Server Agent service runs the components of task automation. Jobs, maintenance plans, and alerts may be configured to ensure that repetitive tasks and responses to problems execute automatically. Jobs can have multiple job steps, with flow from one job step to another based on the success or failure of a step. A job step for a Database Engine job may be a transact-SQL script, a Windows executable, or an ActiveX script.


Download ppt "IT 456-01 System Administration Lesson 3 Dr Jeffrey A Robinson."

Similar presentations


Ads by Google