Presentation is loading. Please wait.

Presentation is loading. Please wait.

5 Copyright © Oracle Corporation, 2001. All rights reserved. Using Data Dictionary and Dynamic Performance Views Cui Zhou Oracle Certified Professional.

Similar presentations


Presentation on theme: "5 Copyright © Oracle Corporation, 2001. All rights reserved. Using Data Dictionary and Dynamic Performance Views Cui Zhou Oracle Certified Professional."— Presentation transcript:

1 5 Copyright © Oracle Corporation, 2001. All rights reserved. Using Data Dictionary and Dynamic Performance Views Cui Zhou Oracle Certified Professional and Master cui_zhou6463@hotmail.com

2 5-2 Copyright © Oracle Corporation, 2001. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Identify built-in database objects Identify the contents and uses of the data dictionary Describe how data dictionary views are created Identify data dictionary view categories Query the data dictionary and dynamic performance views Describe administrative script naming conventions

3 5-3 Copyright © Oracle Corporation, 2001. All rights reserved. Built-In Database Objects Other objects created with the database: Data dictionary Performance tables PL/SQL packages Database event triggers

4 5-4 Copyright © Oracle Corporation, 2001. All rights reserved. Data Dictionary Central to every Oracle database Describe the database and its objects Contains read-only tables and views Stored in the SYSTEM tablespace Owned by the user SYS Maintained by the Oracle Server Accessed with SELECT Control files Data files Redo Log files Database Data Dictionary tables

5 5-5 Copyright © Oracle Corporation, 2001. All rights reserved. Base Tables & DD Views The data dictionary contains two parts: Base tables –Stores description of the database –Created with CREATE DATABASE Data dictionary views –Used to simplify the base table information –Accessed through public synonyms –Created with the catalog.sql script

6 5-6 Copyright © Oracle Corporation, 2001. All rights reserved. Create Data Dictionary Scripts Usage catalog.sql Create Data Dictionary View and Synonyms catproc.sqlRuns all scripts required for or used with PL/SQL.

7 5-7 Copyright © Oracle Corporation, 2001. All rights reserved. Data Dictionary Contents The data dictionary provides information about: Logical and physical database structures Definitions and space allocations of objects Integrity constraints Users Roles Privileges Auditing

8 5-8 Copyright © Oracle Corporation, 2001. All rights reserved. How the DD Is Used Primary uses: Oracle server uses it to find information about –Users –Schema objects –Storage structures Oracle server modifies it when a DDL statement is executed. Users and DBAs use it as a read-only reference for information about the database.

9 5-9 Copyright © Oracle Corporation, 2001. All rights reserved. DD View Categories Three sets of static views Distinguished by their scope: –DBA:What is in all the schemas –ALL:What the user can access –USER:What is in the user's schema USER_xxx Objects owned by the current user ALL_xxx Objects accessible by the current user DBA_xxx All of the objects in the database

10 5-10 Copyright © Oracle Corporation, 2001. All rights reserved.

11 5-11 Copyright © Oracle Corporation, 2001. All rights reserved. Data Dictionary Examples General Overview: –DICTIONARY, DICT_COLUMNS Schema Objects: –DBA_TABLES, DBA_INDEXES, DBA_TAB_COLUMNS, DBA_CONSTRAINTS Space allocation: –DBA_SEGMENTS, DBA_EXTENTS Database structure: –DBA_TABLESPACES, DBA_DATA_FILES

12 5-12 Copyright © Oracle Corporation, 2001. All rights reserved. Dynamic Performance Tables Virtual tables Record current database activity Continually updated while the database is operational Information is accessed from memory and control file, spfile Used to monitor and tune the database Owned by SYS user Synonyms begin with V$ Listed in V$FIXED_TABLE

13 5-13 Copyright © Oracle Corporation, 2001. All rights reserved. DP Examples V$CONTROLFILE V$DATABASE V$DATAFILE V$INSTANCE V$PARAMETER V$SESSION V$SGA $SPPARAMETER V$TABLESPACE V$THREAD V$VERSION

14 5-14 Copyright © Oracle Corporation, 2001. All rights reserved.

15 5-15 Copyright © Oracle Corporation, 2001. All rights reserved. Admin Script Naming Convention cat*.sql dbms*.sql prvt*.plb utl*.sql Description Catalog and data dictionary information Database package specificatoins Wrapped database package code Views and tables for database utilties

16 5-16 Copyright © Oracle Corporation, 2001. All rights reserved. Summary In this lesson, you should have learned how to: Identify built-in database objects Identify the contents and uses of the data dictionary Describe how data dictionary view are created Identify data dictionary view categories Query the data dictionary and dynamic performance views Describe administrative script naming conventions

17 5-17 Copyright © Oracle Corporation, 2001. All rights reserved. Practice 5 Overview This prctice covers the following topics: Identifying the components and contents of the data dictionary Querying the data dictionary and dynamic performance views

18 5-18 Copyright © Oracle Corporation, 2001. All rights reserved. 1. Which of the following statemnets are true about the data dictionary? a The data dictionary describes the database and its objects. b The data dictionary includes two types of objects: base tables and data dictionary views. c The data dictionary is a set of tables d The data dictionary records and verifies information about its associated database. 2. Base tables are created using the catalog.sql script. a True b False 3. Which three of the following statements are true about how the data dictionary is used? a The Oracle server modifies it when a DML statement is executed. b It is used to find information about users, schema objects, and storage structures. c It is used by users and DBAs as a reference. d The data dictionary is a necessary ingredient for the database to function. 4 Data dictionary views are static views. a True b False

19 5-19 Copyright © Oracle Corporation, 2001. All rights reserved. 5 The information for a dynamic performance view is gathered from the control file. a True a False 6 Which of the following questions might a dynamic performance view answer? a Is the object online and available? b What locks are being held? c Who owns the object? d What privileges do users have? e Is session active? 7 Connect as SYSTEM/MANAGER and find a list of the data dictionary views. 8 Identify the database name, instance name, and size of the database blocks Hint:Query the V$DATABASE,V$THREAD,and V$PARAMETER dynamic performance views. 9 List the name of the data files. Hint:Qyery the V$DATAFILE dynamic performance view.

20 5-20 Copyright © Oracle Corporation, 2001. All rights reserved. 10 Identify the data file that makes up the SYSTEM tablespace. Hint: Query the DBA_DATA_FILES data dictionary view to identify the SYSTEM tablespace data file. 11 How much free space is available in the database and how much is already used? Hints: - Query the DBA_FREE_SPACE data dictionary view to show how much free space is available in the database. - Query the DBA_SEGMENTS data dictionary view to display how much space is already used. 12 List the name and creation date of the database users. Hint: Query the DBA_USERS data dictionary view to list the name and the creation of the database users.


Download ppt "5 Copyright © Oracle Corporation, 2001. All rights reserved. Using Data Dictionary and Dynamic Performance Views Cui Zhou Oracle Certified Professional."

Similar presentations


Ads by Google