55 Creating Data Dictionary Views and Standard Packages.

Slides:



Advertisements
Similar presentations
Data Definition Language (DDL)
Advertisements

Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
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.
5 Copyright © Oracle Corporation, All rights reserved. Using Data Dictionary and Dynamic Performance Views Cui Zhou Oracle Certified Professional.
IT Database Administration Section 04. The Oracle 9i Data Dictionary  A set of tables and views owned by SYS and accessible using SQL  Can be.
5 Copyright © Oracle Corporation, All rights reserved. 使用数据库字典和动态性能视图.
5 Copyright © Oracle Corporation, All rights reserved. Using Data Dictionary and Dynamic Performance Views.
Advanced Package Concepts. 2 home back first prev next last What Will I Learn? Write packages that use the overloading feature Write packages that use.
3 Copyright © 2004, Oracle. All rights reserved. Creating Packages.
System Administration Accounts privileges, users and roles
Harvard University Oracle Database Administration Session 2 System Level.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Oracle Database Architecture An Oracle server: –Is a database management system that provides an open, comprehensive, integrated approach to information.
Oracle Database Architecture An Oracle server: –Is a database management system that provides an open, comprehensive, integrated approach to information.
INTRODUCTION TO ORACLE
Adapted from Afyouni, Database Security and Auditing Database Application Auditing – Ch. 8.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 6 Virtual Private Databases.
CSIS 4310 – Advanced Databases Virtual Private Databases.
7202ICT Database Administration Lecture 7 Managing Database Storage Part 2 Orale Concept Manuel Chapter 3 & 4.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 7 PL/SQL Packages.
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.
1 Database Administration. 2 Objectives  Understand, create, and drop views  Grant and revoke users’ privileges  Understand and obtain information.
Using Procedures & Functions Oracle Database PL/SQL 10g Programming Chapter 9.
What is a schema ? Schema is a collection of Database Objects. Schema Objects are logical structures created by users to contain, or reference, their data.
Lecture 8 Creating Stored Functions. Objectives  After completing this lesson, you should be able to do the following:  What is Function?  Types of.
IST 318 Database Administration Lecture 10 Managing Roles.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
Roles & privileges privilege A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object. The.
Database Administration 3.Using Administration Tools.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
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,
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
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 Oracle10g Developer: PL/SQL Programming Chapter 8 Program Unit Dependencies.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Chapter 6 Virtual Private Databases
PRACTICE OVERVIEW PL/SQL Part Your stored procedure, GET_BUDGET, has a logic problem and must be modified. The script that contains the procedure.
Stored Procedures / Session 4/ 1 of 41 Session 4 Module 7: Introducing stored procedures Module 8: More about stored procedures.
Oracle9i Developer: PL/SQL Programming Chapter 5 Functions.
Creating Functions. Overview of Stored Functions A function is a named PL/SQL block that returns a value. A function is a named PL/SQL block that returns.
1 Database Fundamentals Introduction to SQL. 2 SQL Overview Structured Query Language The standard for relational database management systems (RDBMS)
8 Copyright © 2005, Oracle. All rights reserved. Managing Schema Objects.
1 Chapter 5: Advanced PL/SQL Programming. 2 Anonymous PL/SQL Programs Write code in text editor, execute it in SQL*Plus Code can be stored as text in.
4 Copyright © 2004, Oracle. All rights reserved. Advanced Interface Methods.
Oracle9i Developer: PL/SQL Programming Chapter 6 PL/SQL Packages.
1 Copyright © 2004, Oracle. All rights reserved. PL/SQL Programming Concepts: Review.
6 Copyright © 2009, Oracle. All rights reserved. Using Dynamic SQL.
Controlling User Access
TABLES AND INDEXES Ashima Wadhwa.
Managing Privileges.
Using Data Dictionary and Dynamic Performance Views
Creating Packages.
Chapter 7 Program Unit Dependencies Oracle9i Developer:
PL/SQL Scripting in Oracle:
DATABASE MANAGEMENT SYSTEM
PRACTICE OVERVIEW PL/SQL Part - 2.
Database Management Systems 2
Managing Objects with Data Dictionary Views
Managing Objects with Data Dictionary Views
A Guide to SQL, Eighth Edition
PRACTICE OVERVIEW PL/SQL Part - 1.
Prof. Arfaoui. COM390 Chapter 6
Prof. Arfaoui. COM390 Chapter 7
Presentation transcript:

55 Creating Data Dictionary Views and Standard Packages

5-2 Objectives Constructing the data dictionary views Using the data dictionary Preparing the PL/SQL environment using the administrative scripts Administering stored procedures and packages Constructing the data dictionary views Using the data dictionary Preparing the PL/SQL environment using the administrative scripts Administering stored procedures and packages

5-3 Using the Data Dictionary The data dictionary provides information about: Logical and physical database structure Names, definitions, and space allocation of schema objects Integrity constraints Database users and privileges Auditing The data dictionary provides information about: Logical and physical database structure Names, definitions, and space allocation of schema objects Integrity constraints Database users and privileges Auditing

5-4 Base Tables and Data Dictionary Views Base tables: - Normalized - Created, as user SYS, with the sql.bsq script Data dictionary views: - Views simplify the base table information - Created, as user SYS, with the catalog.sql script

5-5 Data Dictionary Views USER_xxx ALL_xxx DBA_xxx objects owned by the user objects can be accessed by the user objects of the entire database

5-6 Data Dictionary: Views Examples and Categories Views Description dba_users dba_sys_privs dba_roles dba_tables dba_objects dba_lobs dba_tab_columns dba_constraints General overview Information about user privileges and roles Information related to the user objects such as tables, constraints, large objects and columns Dictionary, dba_views dict_columns

5-7 Data Dictionary Views: Examples and Categories dba_extents dba_free_space dba_segments Views Description Space allocation for database objects dba_rollback_segs dba_data_files dba_tablespaces General database structures Auditing information dba_audit_trail dba_audit_objects dba_audit_obj_opts

5-8 Script catalog.sql catproc.sql Purpose Creates commonly used data dictionary views Runs all scripts required for PL/SQL on the server Creating Data Dictionary Views Remember: run the scripts as user SYS

5-9 Administrative Scripts cat*.sql dbms*.sql prvt*.plb utl*.sql Catalog and data dictionary information Database package specifications Views and tables for database utilities Wrapped database package code The following naming conventions exist for the sql scripts: Convention Description

5-10 Stored Procedures and Packages Instance PLUS>execute dbms_session.set_role(..) SVRMGR>execute dbms_session.set_role(..) begin... dbms_session.set_role(..)... end; begin... dbms_session.set_role(..)... end; Database applications Shared pool DBMS_SESSION SET_ROLE begin... end; SGA

5-11 What Are Stored Procedures? Are procedures or functions Are stored in the data dictionary Can be used by many users Can accept and return parameters Can be used in SQL functions Are procedures or functions Are stored in the data dictionary Can be used by many users Can accept and return parameters Can be used in SQL functions

5-12 What Are Packages? Group logically related PL/SQL types, items, and subprograms Have two parts: – A specification – A body Allow Oracle to read multiple objects into memory at once Group logically related PL/SQL types, items, and subprograms Have two parts: – A specification – A body Allow Oracle to read multiple objects into memory at once

5-13 Procedure A declaration Procedure B definition Packagespecification Packagebody Procedure A definition Local variable Package

5-14 Package specification from dbmsutil.sql Package body from prvtutil.plb Example procedure set_role (role_cmd varchar2); create or replace package dbms_session is procedure set_role (role_cmd varchar2); abcd abcd abcd abcd... create or replace package body dbms_session wrapped 0 abcd abcd abcd abcd...

5-15 Oracle-Supplied Packages DBMS_LOB—Provides routines for operations on BLOB and CLOB datatypes DBMS_SESSION—Generates SQL commands like ALTER SESSION or SET ROLE DBMS_UTILITY—Provides various utility routines DBMS_SPACE—Provides segment space availability information DBMS_ROWID—Provides ROWID information DBMS_SHARED_POOL—Keeps and unkeeps information in the shared pool DBMS_LOB—Provides routines for operations on BLOB and CLOB datatypes DBMS_SESSION—Generates SQL commands like ALTER SESSION or SET ROLE DBMS_UTILITY—Provides various utility routines DBMS_SPACE—Provides segment space availability information DBMS_ROWID—Provides ROWID information DBMS_SHARED_POOL—Keeps and unkeeps information in the shared pool

5-16 Obtaining Information About Stored Objects Data dictionary view DBA_OBJECTS: – OWNER – OBJECT_NAME – OBJECT_TYPE – STATUS (VALID, INVALID) DESCRIBE command: Data dictionary view DBA_OBJECTS: – OWNER – OBJECT_NAME – OBJECT_TYPE – STATUS (VALID, INVALID) DESCRIBE command: describe dbms_session.set_role

5-17 Troubleshooting The status of dependent objects may be INVALID: If DDL commands are executed on referenced objects After creating the objects using the IMPORT utility The status of dependent objects may be INVALID: If DDL commands are executed on referenced objects After creating the objects using the IMPORT utility

5-18 Summary Creating and using the data dictionary views Using the administrative scripts Obtaining information about stored procedures and packages Creating and using the data dictionary views Using the administrative scripts Obtaining information about stored procedures and packages