1 / 27

Data Dictionary Views and Control Files

Chapter 11. Data Dictionary Views and Control Files. Mohd Shahizan Othman Jabatan Sistem Maklumat Fakulti Sains Komputer & Sistem Maklumat. Objectives. Use the data dictionary components and views List useful dynamic performance views View control file & redo log files information.

swain
Download Presentation

Data Dictionary Views and Control Files

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 11 Data Dictionary Views and Control Files Mohd Shahizan Othman Jabatan Sistem Maklumat Fakulti Sains Komputer & Sistem Maklumat

  2. Objectives • Use the data dictionary components and views • List useful dynamic performance views • View control file & redo log files information

  3. Data Dictionary Components Data Dictionary Views: • Use underlying tables owned by SYS. SYS owns the underlying tables and the data dictionary views • Can be queried like other views. Provide system-related information by querying the database’s internal management tables • Some of the views are available for anyone to query. Some are reserved for DBAs only • A user needs SELECT CATALOG privilege usually part of the CONNECT role

  4. Data Dictionary Components - 2 2 types of data dictionary views • Static data dictionary views • USER: Views focused on a user’s own objects. Ex. USER_TABLES, USER_VIEWS • ALL: Views about objects a user either owns or can query. Ex. ALL_TABLES, ALL_TAB-COLUMNS • DBA: Views for DBAs only, showing information about all objects in the database. Ex. DBA_TABLES, DBA_USERS • Dynamic performance views • V$: Views displaying current activities in the database • GV$: Views that combine activities across multiple instances

  5. Data Dictionary Components - 3 The DICTIONARY view lists data dictionary views with a short description

  6. Data Dictionary Views Uses for Data Dictionary Views • Supply information to the Enterprise Manager console • Help you build queries • Help you review naming standards • Help you find invalid views

  7. Data Dictionary Views - 2 • Use the SQL* Plus DESCRIBE (or DESC) command to list the column names and data types. Ex. DESC DBA_TABLES • Information frequently obtained from data dictionary views such as users, tables, objects, indexes and roles. Ex. of the views used: USER_TABLE: tables you own USER_VIEWS: view name and query that created the view USER_INDEXES: indexes you own ALL_TAB_PRIVS_MADE: all grants given out by you for any table DBA_USERS: all users in the database and information about them

  8. Dynamic Performance Views • Dynamic performance views are similar to data dictionary views except: • The contents of the views change with database activity • They are used mostly for tuning and monitoring • Answer questions such as: • What session is using the most CPU time now? • How many users are currently logged on? • How much memory is being used?

  9. Dynamic Performance Views - 2 Example of some useful views include: • V$SYSSTAT: statistical details about all sessions running on the database • V$SQL: Details on individual SQL statements running on the database • V$SESSTAT: Information by session to help identify memory usage • V$DATAFILE: information on the file# and filename of all control log and datafiles

  10. Viewing Control File Data Use dynamic performance views to see control file information

  11. Viewing Redo File Data

  12. Chapter Summary • Data dictionary views and dynamic performance views are owned by SYS • Use normal queries on these views • Most data dictionary views have a prefix of USER, ALL, or DBA • Most dynamic performance views have a prefix of V$ or GV$

  13. Index Management

  14. Objectives • Learn the types of indexes (b-tree and bitmap) Oracle offers and when to use each type • Understand how to create b-tree and bitmap index

  15. Introduction to Indexes An index: • Is a database structure that speeds up data retrieval • Is automatically updated when rows are inserted updated or deleted

  16. Introduction to Indexes - 2 An index: • Enforces PRIMARY KEY and UNIQUE constraints • Can have up to 32 (30 for bitmap) columns • Stores an entry for rows except those with all nulls in indexed columns (except bitmap, which stores all rows)

  17. Introduction to Indexes - 3 Example of table and index data:

  18. Types and Uses of Indexes The types of indexes offered in Oracle are: • B-tree index • Bitmap index Oracle's default type Compact but limited

  19. Types and Uses of Indexes - 2 Syntax of CREATE INDEX command: CREATE UNIQUE|BITMAP INDEX <schema>.<indexname> ON <schema>.<tablename> (<colname>|<expression> ASC|DESC, <colname>|<expression> ASC|DESC, ..) TABLESPACE <tablespacename> STORAGE (<storage_settings>) LOGGING|NOLOGGING ONLINE COMPUTE STATISTICS NOCOMPRESS|COMPRESS <nn> NOSORT|REVERSE NOPARALLEL|PARALLEL <nn> PARTITION|GLOBAL PARTITION <partition_settings>

  20. Types and Uses of Indexes - 3 Components of CREATE INDEX command: • UNIQUE / BITMAP • (<colname>|<expression> ASC|DESC, ...) • COMPUTE STATISTICS • NOCOMPRESS / COMPRESS <nn> • NOSORT / REVERSE • NOPARALLEL / PARALLEL <nn> • PARTITION / NOPARTITION

  21. B-tree Index B-tree structure example:

  22. B-tree Index –2 Example: A unique, single column index: CREATE UNIQUE INDEX CLASSMATE.DEWEY_IX ON CLASSMATE.CH09LIBRARYBOOK (DEWEY_DECIMAL) INITRANS 2 PCTFREE 20 LOGGING COMPUTE STATISTICS;

  23. Bitmap Index A bitmap index: • Does not use b-tree algorithm • Stores information in a bitmap • More compact than b-tree index • Useful only in certain circumstances: • Columns with low cardinality • Queries comply to a list of criteria of the way data is accessed • Few if any updates • Not unique and not using the DESC clause

  24. Bitmap Index - 2 Example of bitmap structure:

  25. Bitmap Index - 3 Example: CREATE BITMAP INDEX PATIENT_BITMAP_X ON PATIENT (BLOOD_TYPE, GENDER);

  26. Dropping Indexes Use DROP INDEX to remove an index DROP INDEX <schema>.<indexname>;

  27. Data Dictionary Information on Indexes Data dictionary view: SELECT * FROM USER_IND_COLUMNS; • INDEX_NAME • TABLE_NAME • COLUMN_NAME • COLUMN_POSITION • COLUMN_LENGTH • CHAR_LENGTH • DESC

More Related