PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 8 Program Unit Dependencies.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Advertisements

Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 8 Application Data Auditing.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 8 Application Data Auditing.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 12 System and Object Privileges.
Creating Triggers.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
2 Copyright © 2004, Oracle. All rights reserved. Creating Stored Functions.
Adapted from Afyouni, Database Security and Auditing Database Application Auditing – Ch. 8.
Oracle10g Developer: PL/SQL Programming1 Objectives Manipulating data with cursors Managing errors with exception handlers Addressing exception-handling.
Chapter 4 Cursors and Exception Handling Oracle10g Developer:
Chapter 6 Additional Database Objects
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 11 Introduction to Dynamic SQL and Object Technology.
Week 6 Lecture 2 System and Object Privileges. Learning Objectives  Identify and manage system and object privileges  Grant and revoke privileges to.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 7 PL/SQL Packages.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 6 Functions.
PL/SQLPL/SQL Oracle11g : PL/SQL Programming Chapter 6 Functions.
Controlling User Access. Objectives After completing this lesson, you should be able to do the following: Create users Create roles to ease setup and.
Using Procedures & Functions Oracle Database PL/SQL 10g Programming Chapter 9.
Lecture 8 Creating Stored Functions. Objectives  After completing this lesson, you should be able to do the following:  What is Function?  Types of.
17 Copyright © Oracle Corporation, All rights reserved. Managing Roles.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
12 Copyright © 2004, Oracle. All rights reserved. Understanding and Influencing the PL/SQL Compiler.
CHAPTER 9 Views, Synonyms, and Sequences. Views are used extensively in reporting applications and also to present subsets of data to applications. Synonyms.
Controlling User Access Fresher Learning Program January, 2012.
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
Objectives Database triggers and syntax
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
PL/SQLPL/SQL Oracle11g: PL/SQL Programming Chapter 4 Cursors and Exception Handling.
Chapter 9: Advanced SQL and PL/SQL Guide to Oracle 10g.
Dynamic SQL. 2 home back first prev next last What Will I Learn? Recall the stages through which all SQL statements pass Describe the reasons for using.
PL/SQLPL/SQL Oracle11g: PL/SQL Programming Chapter 9 Database Triggers.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
Oracle11g: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
PL/SQLPL/SQL Oracle11g: PL/SQL Programming Chapter 10 Oracle-Supplied Packages, Dynamic SQL, and Hiding Source Code.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Oracle 11g: SQL Chapter 7 User Creation and Management.
13 Copyright © Oracle Corporation, All rights reserved. Controlling User Access.
PRACTICE OVERVIEW PL/SQL Part Your stored procedure, GET_BUDGET, has a logic problem and must be modified. The script that contains the procedure.
Oracle10g Developer: PL/SQL Programming1 Objectives Named program units How to identify parameters The CREATE PROCEDURE statement Creating a procedure.
Oracle9i Developer: PL/SQL Programming Chapter 5 Functions.
 CONACT UC:  Magnific training   
8 Copyright © 2005, Oracle. All rights reserved. Managing Schema Objects.
Oracle9i Developer: PL/SQL Programming Chapter 6 PL/SQL Packages.
15 Copyright © Oracle Corporation, All rights reserved. Managing Users.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Oracle11g: PL/SQL Programming Chapter 5 Procedures.
Managing Privileges.
Controlling User Access
Controlling User Access
Managing Privileges.
PL/SQL MULTIPLE CHOICE QUESTION.
Chapter 8 Dependencies, Privileges and Compilation Oracle11g:
IS221: Database Management
Chapter 7 Program Unit Dependencies Oracle9i Developer:
DBM 405 Innovative Education- -snaptutorial.com
Chapter 1 Introduction to PL/SQL Oracle10g Developer:
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Managing Privileges.
PRACTICE OVERVIEW PL/SQL Part - 1.
Prof. Arfaoui. COM390 Chapter 9
Procedures Oracle & MySQL
Prof. Arfaoui. COM390 Chapter 6
Handling Data in PL/SQL Blocks
Prof. Arfaoui. COM390 Chapter 7
Presentation transcript:

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 8 Program Unit Dependencies

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming2 Chapter Objectives After completing this lesson, you should be able to understand: –Local program unit dependencies –Direct and indirect dependencies –Data dictionary information concerning dependencies –Running the dependency tree utility

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming3 Chapter Objectives (continued) After completing this lesson, you should be able to understand (continued): –Identifying the unique nature of package dependencies –Remote object dependency actions –Using remote dependency invalidation methods –Avoiding recompilation errors –Granting program unit privileges

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming4 Program Unit Dependencies Relationships or dependencies determine the validity of any program unit after modifications to database objects that the program unit references This validity determines the need for recompilation A procedure calls a function –The procedure is a dependent object and the function is the referenced object

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming5 Brewbean’s Challenge Need to take any steps possible to make the execution more efficient Users have been hitting some unexpected errors related to recent modifications to the database and program units In this light, need to review database dependencies and their impact

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming6 Local Dependency Activity Status of program unit can be checked using USER_OBJECTS When a referenced object is modified, the status of the dependent object changes to INVALID INVALID status indicates need for recompilation ALTER COMPILE command used to recompile a program unit

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming7 Automatic Recompilation Upon execution of a program unit with an INVALID status, the system will automatically recompile Drawbacks –Recompilation of dependent objects tests the changes to the referenced objects, which could raise errors at run time –Recompilation processing occurs during run time

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming8 Direct & Indirect Dependencies Direct – a procedure calls a function Indirect – a procedure calls a procedure which calls a function –The dependency between the first procedure and the function is indirect Indirect dependencies have same affect as direct dependencies

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming9 Data Dictionary USER_DEPENDENCIES identify direct dependencies Use WHERE clause on name column to analyze a particular object DBA_DEPENDENCIES will identify direct dependencies of objects in all schemas

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming10 Dependency Tree Utility Mechanism to map direct and indirect dependencies Execute utldtree.sql script once to set up the feature Deptree_fill procedure used to analyze an object Two views –Deptree: numeric scheme –Ideptree: indented scheme

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming11 Package Dependencies Modifications to package specification will change status of dependent objects Modifications to only the package body do NOT change status of dependent objects Separation of code in packages –Minimizes recompilation needs –Dependent objects to be developed prior to the package body being created

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming12 Remote Object Dependencies Database links are used to connect to other Oracle databases Links allow calls to objects in other databases –These objects are called remote objects When remote objects are modified, local dependent objects are not initially flagged as INVALID Remote dependencies are not checked until run time

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming13 Remote Invalidation Methods Timestamp: compares the last date of modification of dependent and referenced objects Signature: compares the parameter modes, data types, and order Timestamp is the default method Databases in different time zones generate unnecessary recompilation using the timestamp method

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming14 Avoiding Recompilation Errors Use %TYPE and %ROWTYPE attributes Use the ‘*’ notation in queries to select all columns Use a column list in INSERT statements

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming15 Program Unit Privileges System PrivilegeExplanation CREATE PROCEDUREAllows a user to create, modify, and drop program units within their own schema. CREATE ANY PROCEDUREAllows a user to create program units in any schema. Does not allow the modification or dropping of the program units. ALTER ANY PROCEDUREAllows a user to modify program units in any schema. DROP ANY PROCEDUREAllows a user to drop program units in any schema. EXECUTE ON program_unit_nameAllows a user to execute a specific program unit. EXECUTE ANY PROCEDUREAllows a user to execute program units in any schema.

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming16 Privileges - Data Dictionary View NameDescription SESSION_PRIVSShows all privileges of the current schema, direct and indirect SESSION_ROLESShows all roles granted to the current schema USER_SYS_PRIVSShows only direct privileges of the current schema USER_ROLE_PRIVSShows only direct roles granted to the current schema

PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming17 Summary Program unit status changes when referenced object is modified INVALID status indicates a need for recompilation Direct and indirect dependencies both affect status Dependency tree utility allows mapping of both direct and indirect dependencies

PL/SQLPL/SQL Summary (continued) Packages minimize recompilation needs Remote dependencies do not update status until run time Appropriate privileges needed to create and use program units Oracle10g Developer: PL/SQL Programming18