Prentice Hall © 20041 Chapter 11: SQL Server Database Administration SQL for SQL Server Bijoy Bordoloi and Douglas Bock.

Slides:



Advertisements
Similar presentations
MCTS GUIDE TO MICROSOFT WINDOWS 7 Chapter 10 Performance Tuning.
Advertisements

Chapter 9 Auditing Database Activities
Chapter 9 Chapter 9: Managing Groups, Folders, Files, and Object Security.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 9-1 COS 346 Day 21.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 5: Managing File Access.
1 Distributed File System, and Disk Quotas (Week 7, Thursday 2/21/2007) © Abdou Illia, Spring 2007.
System Administration Accounts privileges, users and roles
Hands-On Microsoft Windows Server 2003 Administration Chapter 5 Administering File Resources.
Concepts of Database Management Sixth Edition
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Hands-On Microsoft Windows Server 2003 Administration Chapter 6 Managing Printers, Publishing, Auditing, and Desk Resources.
Prentice Hall © COS 346 Day Agenda Questions? Assignment 8 Corrected –3 A’s, 3 B’s & 2 D’s Assignment 9 Due Assignment 10 will be posted.
Chapter 10 Overview  Implement Microsoft Windows Authentication Mode and Mixed Mode  Assign login accounts to database user accounts and roles  Assign.
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.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
1 Chapter Overview Creating User and Computer Objects Maintaining User Accounts Creating User Profiles.
Session 7 Creating and Managing Databases. RDBMS and Data Management/ Session 7/2 of 27 Session Objectives Describe the system and user-defined databases.
1 Chapter Overview Managing Data Storage Creating Dynamic Disks Implementing Storage Quotas Managing Compression and Encryption.
Overview What is SQL Server? Creating databases Administration Security Backup.
Working with Drivers and Printers Lesson 6. Skills Matrix Technology SkillObjective DomainObjective # Understanding Drivers and Devices Install and configure.
1 Chapter Overview Monitoring Server Performance Monitoring Shared Resources Microsoft Windows 2000 Auditing.
Hands-On Microsoft Windows Server 2008
MCTS Guide to Microsoft Windows Server 2008 Applications Infrastructure Configuration (Exam # ) Chapter Two Deploying Windows Servers.
Chapter 4 SQL. SQL server Microsoft SQL Server is a client/server database management system. Microsoft SQL Server is a client/server database management.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
September 18, 2002 Introduction to Windows 2000 Server Components Ryan Larson David Greer.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
1 Group Account Administration Introduction to Groups Planning a Group Strategy Creating Groups Understanding Default Groups Groups for Administrators.
MCTS Guide to Microsoft Windows 7
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.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 5: Managing File Access.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Database-Driven Web Sites, Second Edition1 Chapter 5 WEB SERVERS.
1 Chapter Overview Configuring Account Policies Configuring User Rights Configuring Security Options Configuring Internet Options.
MICROSOFT SQL SERVER 2005 SECURITY  Special Purpose Logins and Users  SQL Server 2005 Authentication Modes  Permissions  Roles  Managing Server Logins.
IS 221: DATABASE ADMINISTRATION Lecture 6:Create Users & Manage Users. Information Systems Department 1.
MISSION CRITICAL COMPUTING Moving Data and Other Planning Considerations.
Module 4: Managing Security. Overview Implementing an Authentication Mode Assigning Login Accounts to Users and Roles Assigning Permissions to Users and.
1 Chapter Overview Publishing Resources in Active Directory Service Redirecting Folders Using Group Policies Deploying Applications Using Group Policies.
Module 1: Exploring Replication. Overview Understanding SQL Server Replication Setting Up Replication Understanding Agents in Replication Securing Replication.
Module 10 Assigning Server and Database Roles. Module Overview Working with Server Roles Working with Fixed Database Roles Creating User-defined Database.
Module 5: Upgrading to SQL Server 7.0. Overview Planning an Upgrade Preparing to Upgrade Verifying the Upgrade Setting a Compatibility Level.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
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 Understanding User Accounts Planning New User Accounts Creating, Modifying, and Deleting User Accounts Setting Properties for User Accounts.
Configuring the User and Computer Environment Using Group Policy Lesson 8.
Microsoft Access 2010 Chapter 10 Administering a Database System.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 9 Auditing Database Activities.
2. SQL Security Objectives –Learn SQL Server 2000 components Contents –Understanding the Authentication Process –Understanding the Authorization Process.
Working with Disks Lesson 4. Skills Matrix Technology SkillObjective DomainObjective # Configuring Data Protection Configure data protection6.4 Using.
1 Chapter Overview Managing Object and Container Permissions Locating and Moving Active Directory Objects Delegating Control Troubleshooting Active Directory.
4. SQL Backup tasks Objectives –Secure the databases and the database server Contents –Understanding Backup Terms, –Backing Up Databases, Files, Filegroups,
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
1 Chapter Overview Granting Database-Specific Permissions Using Application Roles Designing an Access and Permissions Strategy.
1 Chapter Overview Using Group Objects Understanding Default Groups Creating Group Objects Managing Administrative Access.
SQL Server 2012 Session: 1 Session: 6 Creating and Managing Databases Data Management Using Microsoft SQL Server.
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 Database Management
Administrating a Database
Module 1: SQL Server Overview
Microsoft SQL Server 2014 for Oracle DBAs Module 8
Introduction to Operating Systems
Database Security.
Database Security.
Managing Privileges.
Administrating a Database
Presentation transcript:

Prentice Hall © Chapter 11: SQL Server Database Administration SQL for SQL Server Bijoy Bordoloi and Douglas Bock

Prentice Hall © Objectives Develop a general understanding of database administration.Develop a general understanding of database administration. Understand the duties of a database administrator.Understand the duties of a database administrator. Learn about the organization of a SQL Server database file structure.Learn about the organization of a SQL Server database file structure. Create a database.Create a database. Learn concepts concerning the SQL Server system catalog and database catalogs.Learn concepts concerning the SQL Server system catalog and database catalogs. Learn about the special dbo database user account.Learn about the special dbo database user account. Become familiarized with the Enterprise Manager software.Become familiarized with the Enterprise Manager software. Create system and database user accounts.Create system and database user accounts. Grant, deny, and revoke permissions.Grant, deny, and revoke permissions. Create and allocate roles.Create and allocate roles.

Prentice Hall © Database administration is a specialized area within a large information systems department.Database administration is a specialized area within a large information systems department. A database administrator (DBA) works closely with application developers to support application development efforts.A database administrator (DBA) works closely with application developers to support application development efforts. Database Administration Overview

Prentice Hall © Database Administrator Duties Install database management system software and upgrades.Install database management system software and upgrades. Design and create a database including the allocation of system disk storage for current and future database storage requirements.Design and create a database including the allocation of system disk storage for current and future database storage requirements. Start up and shut down database services.Start up and shut down database services. Create user accounts and monitor user activities.Create user accounts and monitor user activities. Grant database permissions to control data security and data access.Grant database permissions to control data security and data access. Backup and recover a database in the event of system failure.Backup and recover a database in the event of system failure. Tune a database to optimize database performance.Tune a database to optimize database performance. Manage database network connectivity.Manage database network connectivity. Migrate a database to a new version of the DBMS software.Migrate a database to a new version of the DBMS software.

Prentice Hall © Enterprise Manager SQL Server 2000’s Enterprise Manager software is a Microsoft Management Console snap-in.SQL Server 2000’s Enterprise Manager software is a Microsoft Management Console snap-in. Enterprise Manager provides a graphical user interface for administering SQL Server databases. Use it to:Enterprise Manager provides a graphical user interface for administering SQL Server databases. Use it to: –Create databases. –Create tables and other objects. –Create and manage user accounts. –Allocate system and object permissions. –Manage security and schedule tasks. –Perform database backups.

Prentice Hall © Enterprise Manager Graphical User Interface The initial window in unexpanded Tree view.

Prentice Hall © Expanded Tree Pane – Company Database

Prentice Hall © Database Types Two groups of databases were displayed on the previous slide:Two groups of databases were displayed on the previous slide: –(1) System databases – includes Master, Model, MSDB, and Tempdb. –(2) User-Defined Application databases. Those shown include the Company and Riverbend databases used in this textbook and two databases provided by Microsoft as examples – Northwind and Pubs.

Prentice Hall © System Databases Master – stores database information about other databases for a given instance of the SQL Server Also tracks disk space usage, configuration of the DBMS, and information on database objects.Master – stores database information about other databases for a given instance of the SQL Server Also tracks disk space usage, configuration of the DBMS, and information on database objects. Model – a database template that is copied whenever you create a new database.Model – a database template that is copied whenever you create a new database. Tempdb --- stores temporary objects/data such as those created by ORDER BY and JOIN operations.Tempdb --- stores temporary objects/data such as those created by ORDER BY and JOIN operations. MSDB – used to schedule tasks such as database backup.MSDB – used to schedule tasks such as database backup.

Prentice Hall © Database Files Physical windows files – includes a primary data file and transaction log file as a minimum.Physical windows files – includes a primary data file and transaction log file as a minimum. Primary data file – stores application data and startup information.Primary data file – stores application data and startup information. Transaction log files – stores transaction data to support database recovery.Transaction log files – stores transaction data to support database recovery. Secondary data files – stores application data that will not fit into the primary data file – generally added to additional disk drives.Secondary data files – stores application data that will not fit into the primary data file – generally added to additional disk drives.

Prentice Hall © Database Files Contd.

Prentice Hall © Disk Storage Database objects are stored using two units of storage – page and extent.Database objects are stored using two units of storage – page and extent. Database files are divided into pages while several pages are grouped into extents.Database files are divided into pages while several pages are grouped into extents. Pages are 8Kb in size.Pages are 8Kb in size. A data row cannot span pages in SQL Server – the maximum row size is 8,060 bytes.A data row cannot span pages in SQL Server – the maximum row size is 8,060 bytes. Data pages store table row data; Index pages store index values; Text/Image pages store data of type TEXT, NTEXT, and IMAGE.Data pages store table row data; Index pages store index values; Text/Image pages store data of type TEXT, NTEXT, and IMAGE. Extents are contiguous pages allocated with 8 pages/extent.Extents are contiguous pages allocated with 8 pages/extent.

Prentice Hall © Creating an SQL Server Database The CREATE DATABASE statement can be used with SQL Query Analyzer to create a database.The CREATE DATABASE statement can be used with SQL Query Analyzer to create a database. Enterprise Manager is easier to use – right-click the database node or use the Action menu - New Database option.Enterprise Manager is easier to use – right-click the database node or use the Action menu - New Database option.

Prentice Hall © Database Properties – General Tab

Prentice Hall © Database Properties – Data Files Tab The Database Properties dialog box – Data Files tab is used to specify file names for the primary data file. The example shown on the next slide is named TestDatabase_Data.The Database Properties dialog box – Data Files tab is used to specify file names for the primary data file. The example shown on the next slide is named TestDatabase_Data. It is stored to a folder named C:\Data.It is stored to a folder named C:\Data. The data file has an initial size of 1Mb and is set to automatically grow in 10% increments.The data file has an initial size of 1Mb and is set to automatically grow in 10% increments.

Prentice Hall © Database Properties – Data Files Tab Contd.

Prentice Hall © Database Properties – Transaction Log Tab The figure shown on the next slide is the Transaction Log tab used to specify file names for the transaction log file.The figure shown on the next slide is the Transaction Log tab used to specify file names for the transaction log file. Here the transaction log is named TestDatabase_Log on drive C: in the folder named C:\DataLogs.Here the transaction log is named TestDatabase_Log on drive C: in the folder named C:\DataLogs.

Prentice Hall © Database Properties – Transaction Log Tab Contd.

Prentice Hall © Files and File Groups Larger databases with several secondary data files are easier to manage by defining a filegroup object type – a logical container to hold files as a unit.Larger databases with several secondary data files are easier to manage by defining a filegroup object type – a logical container to hold files as a unit. This makes it easier to backup files.This makes it easier to backup files. Use Enterprise Manager to create a filegroup by a right-click of the database in the Tree panel and selection of the Properties menu.Use Enterprise Manager to create a filegroup by a right-click of the database in the Tree panel and selection of the Properties menu.

Prentice Hall © Files and File Groups Contd. Select the Filegroups tab and name the filegroup. You can then use the Properties dialog box to create secondary files and assign them to the filegroup.Select the Filegroups tab and name the filegroup. You can then use the Properties dialog box to create secondary files and assign them to the filegroup.

Prentice Hall © Create Database Options to Create Filegroups The example shown here creates a primary data file along with a filegroup and secondary data files and log files.The example shown here creates a primary data file along with a filegroup and secondary data files and log files. /* SQL Example 11.1 */ CREATE DATABASE TestDatabase ON PRIMARY ( NAME = TestDatabase_Data, FILENAME = 'C:\Data\TestDatabase_Data.Mdf', FILENAME = 'C:\Data\TestDatabase_Data.Mdf', SIZE = 10, MAXSIZE = 50, FILEGROWTH = 25% ), SIZE = 10, MAXSIZE = 50, FILEGROWTH = 25% ), FILEGROUP TestDatabaseGroup1 ( NAME = TestDatabaseSecondary1_Data, FILENAME = 'D:\Data\TestDatabaseSecondary1_Data.Ndf', FILENAME = 'D:\Data\TestDatabaseSecondary1_Data.Ndf', SIZE = 20, MAXSIZE = 50, FILEGROWTH = 5% ), SIZE = 20, MAXSIZE = 50, FILEGROWTH = 5% ),

Prentice Hall © Create Database Options to Create Filegroups Contd. FILEGROUP TestDatabaseGroup1 ( NAME = TestDatabaseSecondary1_Data, FILENAME = 'D:\Data\TestDatabaseSecondary1_Data.Ndf', FILENAME = 'D:\Data\TestDatabaseSecondary1_Data.Ndf', SIZE = 20, MAXSIZE = 50, FILEGROWTH = 5% ), SIZE = 20, MAXSIZE = 50, FILEGROWTH = 5% ), ( NAME = TestDatabaseSecondary2_Data, FILENAME = 'E:\Data\TestDatabaseSecondary2_Data.Ndf', FILENAME = 'E:\Data\TestDatabaseSecondary2_Data.Ndf', SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5% ) SIZE = 10, MAXSIZE = 50, FILEGROWTH = 5% ) LOG ON ( NAME = 'TestDatabase_Log', FILENAME = 'G:\Datalogs\TestDatabase_Log.Ldf', FILENAME = 'G:\Datalogs\TestDatabase_Log.Ldf', SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 5MB ); SIZE = 5MB, MAXSIZE = 25MB, FILEGROWTH = 5MB );

Prentice Hall © SQL Server System Catalog The SQL Server system catalog consists of system tables in the Master database.The SQL Server system catalog consists of system tables in the Master database. System tables stored in individual databases are the database catalog.System tables stored in individual databases are the database catalog. The system catalog stores information about the structure of database objects such as databases, tables, views, and indexes – termed metadata (data about data).The system catalog stores information about the structure of database objects such as databases, tables, views, and indexes – termed metadata (data about data). Only SQL Server should modify the system catalog.Only SQL Server should modify the system catalog.

Prentice Hall © SQL Server and Database Accounts Both SQL Query Analyzer and Enterprise Manager can create SQL Server login accounts.Both SQL Query Analyzer and Enterprise Manager can create SQL Server login accounts. Within SQL Query Analyzer, you can execute several different procedures to create logins and to modify passwords.Within SQL Query Analyzer, you can execute several different procedures to create logins and to modify passwords. /* SQL Example Creating a Login */ EXEC sp_addlogin ‘thumb’, ‘secret’, ‘Company’; /* Changing password */ EXEC sp_password ‘secret’, ‘newsecret’, ‘thumb’;

Prentice Hall © Using Enterprise Manager to Create Login Accounts Select Tools menu, Wizards option and expand the Database tree.Select Tools menu, Wizards option and expand the Database tree. Select the Create Login Wizard option shown here.Select the Create Login Wizard option shown here.

Prentice Hall © Creating Login Accounts – Contd.

Prentice Hall © Creating Login Accounts – Contd.

Prentice Hall © Creating Login Accounts – Contd.

Prentice Hall © Default Database User Accounts Users needing access to specific application databases must have a valid database user account for that database.Users needing access to specific application databases must have a valid database user account for that database. Each database has two default accounts: dbo and guest.Each database has two default accounts: dbo and guest. The dbo account owns a database and the account cannot be dropped.The dbo account owns a database and the account cannot be dropped. The guest account is used by users who have no specific database user account.The guest account is used by users who have no specific database user account.

Prentice Hall © Creating Database User Accounts The sp_grantdbaccess procedure can be executed within SQL Query Analyzer to create a database user account and associate it with an existing Windows users account or SQL Server security login account.The sp_grantdbaccess procedure can be executed within SQL Query Analyzer to create a database user account and associate it with an existing Windows users account or SQL Server security login account. This example associates a database user account named robertsmith with a Windows user account named rsmith.This example associates a database user account named robertsmith with a Windows user account named rsmith. EXEC sp_grantdbaccess ‘rsmith’, ‘robertsmith’

Prentice Hall © Creating Database User Accounts Contd. Enterprise Manager can be used as shown here to create database user accounts.Enterprise Manager can be used as shown here to create database user accounts. Expand the database tree and select New Database user – use the dialog box to enter the login and user name and grant permissions to the user.Expand the database tree and select New Database user – use the dialog box to enter the login and user name and grant permissions to the user.

Prentice Hall © Revoking Database User Accounts Through Enterprise Manager

Prentice Hall © Roles Roles make it easier for a DBA to manage the allocation of permissions.Roles make it easier for a DBA to manage the allocation of permissions. A role is like a container of a group of permissions for a specific type of system user such as an accountant.A role is like a container of a group of permissions for a specific type of system user such as an accountant. Each accountant hired will be authorized the permissions contained in the role named Accountant.Each accountant hired will be authorized the permissions contained in the role named Accountant. This also applies to other jobs such as Clerk.This also applies to other jobs such as Clerk.

Prentice Hall © Roles Contd.

Prentice Hall © Fixed Server Roles Fixed server roles exist at the server level external to databases.Fixed server roles exist at the server level external to databases. Several fixed server roles exist. These include:Several fixed server roles exist. These include: –Sysadmin – a role granted all permissions for SQL Server and associated with the system administrator (sa) login and dbo user. –DbCreator – a role with permission to create/modify databases. –DiskAdmin – permission to manage disk files. –Other fixed server roles also exist and are described in the chapter reading.

Prentice Hall © Allocating Fixed Server Roles – Enterprise Manager Expand the security folder and select the Server Roles option. Right-click the role as shown.Expand the security folder and select the Server Roles option. Right-click the role as shown.

Prentice Hall © Allocating Fixed Server Roles – Enterprise Manager Contd. Click the Add button to display the Add Members window as shown and add the members desired and click OK.Click the Add button to display the Add Members window as shown and add the members desired and click OK.

Prentice Hall © Fixed Database Roles These roles exist for each database and are grouped according to purpose. They include:These roles exist for each database and are grouped according to purpose. They include: –Db_owner – users who perform most database activities. –Db_accessadmin – permission to add/remove users. –Db_datareader – SELECT permission on any database table/view. –Db_datawriter – Can run any DML statement on any database table/view. –Other roles exist as described in the chapter.

Prentice Hall © Application Roles These roles are used to allocate specific permissions for specific applications such as payroll or inventory management.These roles are used to allocate specific permissions for specific applications such as payroll or inventory management. Application roles are allocated to login sessions.Application roles are allocated to login sessions. Application roles require a password.Application roles require a password. While connected to an application role, the database user loses all other allocated permissions except those associated with the application role.While connected to an application role, the database user loses all other allocated permissions except those associated with the application role. /* Example */ EXEC sp_addapprole ‘payroll’, ‘payroll_password’

Prentice Hall © User-Defined Database Roles This is the more traditional use of roles – to allocate permissions to groups of users as was described earlier.This is the more traditional use of roles – to allocate permissions to groups of users as was described earlier. Suppose a role named Clerk has several permissions needed by a newly hired clerk named dbock. This EXEC will create the Clerk role owned by bbordoloi. The role is then granted to dbock.Suppose a role named Clerk has several permissions needed by a newly hired clerk named dbock. This EXEC will create the Clerk role owned by bbordoloi. The role is then granted to dbock. /* Example Granting Role */ /* Example Granting Role */ EXEC sp_addrole ‘clerk’, ‘bbordoloi’ EXEC sp_addrole ‘clerk’, ‘bbordoloi’ EXEC sp_addrolemember ‘clerk’, ‘dbock’ EXEC sp_addrolemember ‘clerk’, ‘dbock’

Prentice Hall © Permissions Permissions authorize database users to perform various operations such as CREATE DATABASE and SELECT.Permissions authorize database users to perform various operations such as CREATE DATABASE and SELECT. Permissions are divided into two categories: statement and object.Permissions are divided into two categories: statement and object.

Prentice Hall © Granting Statement Permissions Use the GRANT statement to grant permissions. Statement permissions include:Use the GRANT statement to grant permissions. Statement permissions include: –CREATE DATABASE –CREATE DEFAULT –CREATE FUNCTION –CREATE PROCEDURE –CREATE RULE –CREATE TABLE –CREATE VIEW –BACKUP DATABASE –BACKUP LOG

Prentice Hall © Granting Statement Permissions – Contd. Grant all permissions to dbock.Grant all permissions to dbock. GRANT ALL TO dbock; GRANT ALL TO dbock; Grant two permissions to tthumb and bbordoloiGrant two permissions to tthumb and bbordoloi GRANT CREATE TABLE, CREATE VIEW TO tthumb, bbordol; tthumb, bbordol; Grant permissions to a role.Grant permissions to a role. GRANT CREATE PROCEDURE, CREATE FUNCTION TO clerk; TO clerk;

Prentice Hall © Granting Object Permissions Contd. Object permissions apply to a specific database object such as a table.Object permissions apply to a specific database object such as a table. Permissions include SELECT, UPDATE, INSERT, DELETE, and other object manipulations.Permissions include SELECT, UPDATE, INSERT, DELETE, and other object manipulations.

Prentice Hall © Granting Object Permissions Contd. General form of the GRANT statement:General form of the GRANT statement: GRANT [ALL | permission_list] ON [table/view [column_list] | procedure] TO account_list [WITH GRANT OPTION] [AS {group_name | role_name}] [WITH GRANT OPTION] [AS {group_name | role_name}] The object is specified with the ON clause.The object is specified with the ON clause. The TO clause specifies who receives the permission.The TO clause specifies who receives the permission. The WITH GRANT OPTION enables the grantee to grant the permission to others.The WITH GRANT OPTION enables the grantee to grant the permission to others.

Prentice Hall © Granting Object Permissions – Contd. Grant SELECT on the dependent table.Grant SELECT on the dependent table. GRANT SELECT ON dependent TO bbordoloi; GRANT SELECT ON dependent TO bbordoloi; Grant SELECT and DELETE on the dependent table.Grant SELECT and DELETE on the dependent table. GRANT SELECT, DELETE ON dependent TO dbock; GRANT SELECT, DELETE ON dependent TO dbock; Grant UPDATE on specific table columns.Grant UPDATE on specific table columns. GRANT UPDATE ON dependent( dep_name, dep_gender) GRANT UPDATE ON dependent( dep_name, dep_gender) TO bbordoloi; TO bbordoloi; Grant ALL permissions to everyone (PUBLIC).Grant ALL permissions to everyone (PUBLIC). GRANT ALL ON dependent TO PUBLIC; GRANT ALL ON dependent TO PUBLIC;

Prentice Hall © Granting Object Permissions – Enterprise Manager

Prentice Hall © Denying Permissions Denying permissions removes existing permissions from a database user account or role and prevents granting the permission to the database user account by accident through any other defined role.Denying permissions removes existing permissions from a database user account or role and prevents granting the permission to the database user account by accident through any other defined role. /* Examples */ DENY CREATE TABLE TO tthumb; DENY SELECT, UPDATE ON dependent TO dbock; TO dbock;

Prentice Hall © Revoking Permissions You can revoke both statement and object permissions. Permissions that are revoked can later be allocated again.You can revoke both statement and object permissions. Permissions that are revoked can later be allocated again. /* Examples */ REVOKE SELECT ON dependent FROM PUBLIC; REVOKE UPDATE ON dependent FROM dbock; You can also revoke GRANT options and cause system users who have been granted permissions by a specific database user to also lose their permissions through the CASCADE clause.You can also revoke GRANT options and cause system users who have been granted permissions by a specific database user to also lose their permissions through the CASCADE clause. REVOKE GRANT OPTION FOR DELETE ON dependent FROM dbock CASCADE; dependent FROM dbock CASCADE;

Prentice Hall © System Procedures System procedures such as the sp_help procedure can be used to display information about database objects.System procedures such as the sp_help procedure can be used to display information about database objects. /* SQL Example */ EXEC sp_help dependent Name Owner Type dependent dbo user table Column_name Type Computed Length dep_emp_ssn char no 9 dep_name varchar no 50 dep_gender char no 1 other information is also listed...

Prentice Hall © System Procedures – Cont. Other system procedures such as sp_depends can display dependency information among objects such as tables and views. This example shows dependency information for the employee table.Other system procedures such as sp_depends can display dependency information among objects such as tables and views. This example shows dependency information for the employee table. /* SQL Example */ EXEC sp_depends employee; In the current database, the specified object is referenced by the following: Name type dbo.ck_emp_salary check cns

Prentice Hall © Summary A SQL Server installation is managed through the Enterprise Manager.A SQL Server installation is managed through the Enterprise Manager. A SQL Server database includes physical and logical objects such as files and filegroups.A SQL Server database includes physical and logical objects such as files and filegroups. The system catalog stores metadata for a SQL Server instance and all databases. Each database has a database catalog.The system catalog stores metadata for a SQL Server instance and all databases. Each database has a database catalog. You learned to create SQL Server login accounts, database accounts, and roles.You learned to create SQL Server login accounts, database accounts, and roles. You also learned to allocate, deny, and revoke system and object permissions to/from accounts and roles.You also learned to allocate, deny, and revoke system and object permissions to/from accounts and roles.