11 Copyright © Oracle Corporation, 2001. All rights reserved. Managing Tables.

Slides:



Advertisements
Similar presentations
Using the SQL Access Advisor
Advertisements

Structured Query Language (SQL)
AP STUDY SESSION 2.
1
Kapitel 9. Copyright © Houghton Mifflin Company. All rights reserved.9 | 2 1. Reflexive pronouns.
Feichter_DPG-SYKL03_Bild-01. Feichter_DPG-SYKL03_Bild-02.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 3 CPUs.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
RXQ Customer Enrollment Using a Registration Agent (RA) Process Flow Diagram (Move-In) Customer Supplier Customer authorizes Enrollment ( )
Refreshing Materialized Views
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Exit a Customer Chapter 8. Exit a Customer 8-2 Objectives Perform exit summary process consisting of the following steps: Review service records Close.
Custom Statutory Programs Chapter 3. Customary Statutory Programs and Titles 3-2 Objectives Add Local Statutory Programs Create Customer Application For.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Year 6 mental test 10 second questions
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
9 Copyright © 2006, Oracle. All rights reserved. Automatic Performance Management.
13 Copyright © 2005, Oracle. All rights reserved. Monitoring and Improving Performance.
PP Test Review Sections 6-1 to 6-6
EU market situation for eggs and poultry Management Committee 20 October 2011.
Bright Futures Guidelines Priorities and Screening Tables
9 Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Displaying Data from Multiple Tables
Data Definition Language (DDL)
Vanderbilt Business Objects Users Group 1 Reporting Techniques & Formatting Beginning & Advanced.
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
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.
XML and Databases Exercise Session 3 (courtesy of Ghislain Fourny/ETH)
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
VOORBLAD.
8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Using Explicit Cursors.
Benchmark Series Microsoft Excel 2013 Level 2
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Materialized Views.
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
25 seconds left…...
Analyzing Genes and Genomes
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Essential Cell Biology
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Energy Generation in Mitochondria and Chlorplasts
13 Copyright © Oracle Corporation, All rights reserved. Controlling User Access.
12 Copyright © Oracle Corporation, All rights reserved. Managing Indexes.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 7 Basic Table Management.
7 Copyright © 2004, Oracle. All rights reserved. Managing Schema Objects.
15 Copyright © Oracle Corporation, All rights reserved. Managing Users.
Managing Tables.
Presentation transcript:

11 Copyright © Oracle Corporation, All rights reserved. Managing Tables

11-2 Copyright © Oracle Corporation, All rights reserved. Objectives After completing this lesson, you should be able to do the following: Identify the various methods of storing data Outline Oracle data types Distinguish between an extended versus a restricted ROWID Outline the structure of a row Create regular and temporary tables Manage storage structures within a table Reorganize, truncate, drop a table Drop a column within a table

11-3 Copyright © Oracle Corporation, All rights reserved. Storing User Data Regular table Cluster Partitioned table Index-organized table

11-4 Copyright © Oracle Corporation, All rights reserved.

11-5 Copyright © Oracle Corporation, All rights reserved.

11-6 Copyright © Oracle Corporation, All rights reserved. Oracle Built-in Data Types CHAR(N), NCHAR(N) VARCHAR2(N), NVARCHAR2(N) NUMBER(P,S) DATE TIMESTAMP RAW(N) BLOB, CLOB, NCLOB, BFILE LONG, LONG RAW ROWID, UROWID VARRAY TABLE REF Data type Built-in User-defined ScalarRelationshipCollection

11-7 Copyright © Oracle Corporation, All rights reserved.

11-8 Copyright © Oracle Corporation, All rights reserved.

11-9 Copyright © Oracle Corporation, All rights reserved.

11-10 Copyright © Oracle Corporation, All rights reserved. ROWID Format Extended ROWID Format Restricted ROWID Format OOOOOOBBBBBBFFFRRR Data object number Relative file number Row numberBlock number BBBBBBBBFFFFRRRR Block numberRow numberFile number..

11-11 Copyright © Oracle Corporation, All rights reserved.

11-12 Copyright © Oracle Corporation, All rights reserved. Structure of a Row Database block Row header Column length Column value

11-13 Copyright © Oracle Corporation, All rights reserved. Creating a Table CREATE TABLE hr.employees( employee_id NUMBER(6), first_nameVARCHAR2(20), last_name VARCHAR2(25), VARCHAR2(25), phone_number VARCHAR2(20), hire_date DATE DEFAULT SYSDATE, job_id VARCHAR2(10), salary NUMBER(8,2), commission_pct NUMBER (2,2), manager_id NUMBER(6), department_id NUMBER(4) );

11-14 Copyright © Oracle Corporation, All rights reserved.

11-15 Copyright © Oracle Corporation, All rights reserved.

11-16 Copyright © Oracle Corporation, All rights reserved.

11-17 Copyright © Oracle Corporation, All rights reserved. Creating a Table: Guidelines Place tables in separate tablespaces. Use locally-managed tablespaces to avoid fragmentation. Use few standard extent sizes for tables to reduce tablespace fragmentation.

11-18 Copyright © Oracle Corporation, All rights reserved. Creating Temporary Tables Created using the GLOBAL TEMPORARY clause Tables retain data only for the duration of a transaction or session DML locks are not acquired on the data Can create indexes, views, and triggers on temporary tables CREATE GLOBAL TEMPORARY TABLE hr.employees_temp AS SELECT * FROM hr.employees;

11-19 Copyright © Oracle Corporation, All rights reserved. (Average Row Size - Initial Row Size) * 100 Average Row Size -- Average Row Size * PCTFREE - Available Data Space Setting PCTFREE and PCTUSED Compute PCTFREE Compute PCTUSED

11-20 Copyright © Oracle Corporation, All rights reserved. Before updateAfter update Pointer Row Migration and Chaining

11-21 Copyright © Oracle Corporation, All rights reserved. Changing Storage and Block Utilization Parameters ALTER TABLE hr.employees PCTFREE 30 PCTUSED 50 STORAGE(NEXT 500K MINEXTENTS 2 MAXEXTENTS 100);

11-22 Copyright © Oracle Corporation, All rights reserved.

11-23 Copyright © Oracle Corporation, All rights reserved.

11-24 Copyright © Oracle Corporation, All rights reserved. Manually Allocating Extents ALTER TABLE hr.employees ALLOCATE EXTENT(SIZE 500K DATAFILE /DISK3/DATA01.DBF);

11-25 Copyright © Oracle Corporation, All rights reserved. Nonpartitioned Table Reorganization When a nonpartitioned table is reorganized, its structure is kept, but not its contents. Used to move a table to a different tablespace or reorganize extents. ALTER TABLE hr.employees MOVE TABLESPACE data1;

11-26 Copyright © Oracle Corporation, All rights reserved. Truncating a Table Truncating a table deletes all rows in a table and releases used space. Corresponding indexes are truncated. TRUNCATE TABLE hr.employees;

11-27 Copyright © Oracle Corporation, All rights reserved. Dropping a Table DROP TABLE hr.department CASCADE CONSTRAINTS;

11-28 Copyright © Oracle Corporation, All rights reserved.

11-29 Copyright © Oracle Corporation, All rights reserved. Dropping a Column Removing a column from a table: Removes the column length and data from each row, freeing space in the data block. Dropping a column in a large table takes a considerable amount of time. ALTER TABLE hr.employees DROP COLUMN comments CASCADE CONSTRAINTS CHECKPOINT 1000;

11-30 Copyright © Oracle Corporation, All rights reserved.

11-31 Copyright © Oracle Corporation, All rights reserved. Using the UNUSED Option Mark a column as unused: Drop unused columns: Continue to drop column operation: ALTER TABLE hr.employees SET UNUSED COLUMN comments CASCADE CONSTRAINTS; ALTER TABLE hr.employees DROP UNUSED COLUMNS CHECKPOINT 1000; ALTER TABLE hr.employees DROP COLUMNS CONTINUE CHECKPOINT 1000;

11-32 Copyright © Oracle Corporation, All rights reserved.

11-33 Copyright © Oracle Corporation, All rights reserved. Obtaining Table Information Information about tables can be obtained by querying the following views: DBA_TABLES DBA_OBJECTS

11-34 Copyright © Oracle Corporation, All rights reserved.

11-35 Copyright © Oracle Corporation, All rights reserved. Summary In this lesson, you should have learned how to: Distinguish between an extended versus a restricted ROWID Outline the structure of a row Create regular and temporary tables Manage storage structures within a table Reorganize, truncate, and drop a table Drop a column within a table

11-36 Copyright © Oracle Corporation, All rights reserved. Practice 11 Overview This practice covers the following topics: Creating a table Viewing, marking as unused, and dropping columns within a table Allocating extents manually Truncating a table Obtaining table information

11-37 Copyright © Oracle Corporation, All rights reserved.

11-38 Copyright © Oracle Corporation, All rights reserved.