oracle 10g admin workshops pptless 09

Upload: mahiroux

Post on 29-May-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    1/32

    Copyright 2004, Oracle. All rights reserved.

    Managing Data

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    2/32

    9-2 Copyright 2004, Oracle. All rights reserved.

    Objectives

    Aftercompleting thislesson, youshouldbe able todo

    thefollowing:

    Manipulatedata through SQL

    Use Data Pump toexport data

    Use Data Pump to import data

    Loaddata with SQL Loader

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    3/32

    9-3 Copyright 2004, Oracle. All rights reserved.

    Manipulating Data Through SQL

    SQL> INSERT INTO employees VALUES2 (9999,'Bob','Builder','[email protected]',NULL,SYSDATE,3 'IT_PROG',NULL,NULL,100,90);

    1 row created.

    SQL> UPDATE employees SET SALARY=6000

    2 WHERE EMPLOYEE_ID = 9999;

    1 row updated.

    SQL> DELETE from employees2 WHERE EMPLOYEE_ID = 9999;

    1 row deleted.

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    4/32

    9-4 Copyright 2004, Oracle. All rights reserved.

    TheINSERT Command

    Createonerow at a time.

    Insert many rowsfrom anothertable.

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    5/32

    9-5 Copyright 2004, Oracle. All rights reserved.

    TheUPDATE Command

    Use tochange zeroormorerowsofa table.

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    6/32

    9-6 Copyright 2004, Oracle. All rights reserved.

    TheDELETE Command

    Use toremove zeroormorerowsfrom a table.

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    7/32

    9-7 Copyright 2004, Oracle. All rights reserved.

    TheCOMMIT andROLLBACKCommands

    Used tofinish a transaction.

    Commit: Makes thechangepermanent

    Rollback: Undoes thechange

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    8/32

    9-8 Copyright 2004, Oracle. All rights reserved.

    Integrity Constraints and DML

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    9/32

    9-9 Copyright 2004, Oracle. All rights reserved.

    Data Pump Export

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    10/32

    9-10 Copyright 2004, Oracle. All rights reserved.

    Data Pump Export

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    11/32

    9-11 Copyright 2004, Oracle. All rights reserved.

    Data PumpImport

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    12/32

    9-12 Copyright 2004, Oracle. All rights reserved.

    Data PumpImport

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    13/32

    9-13 Copyright 2004, Oracle. All rights reserved.

    DIRECTORY Objects

    SQL>CREATE DIRECTORY dpump_dir12 AS '/usr/apps/datafiles';

    Directory created.

    SQL> SELECT * FROM DBA_DIRE

    CTORIES2 WHERE DIRECTORY_NAME = 'DPUMP_DIR1';

    OWNER DIRECTORY_NAME DIRECTORY_PATH------- --------------- --------------------SYS DPUMP_DIR1 /usr/apps/datafiles

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    14/32

    9-14 Copyright 2004, Oracle. All rights reserved.

    SQL*Loader

    Input

    data files

    Control

    File

    SQL*LoaderLog

    fileBad

    files

    Discard

    files

    Tables and indexes

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    15/32

    9-15 Copyright 2004, Oracle. All rights reserved.

    SQL*Loader

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    16/32

    9-16 Copyright 2004, Oracle. All rights reserved.

    The SQL*LoaderControl File

    Theloadercontrolfile tells SQL*Loader:

    Where tofind theloaddata

    Thedata format

    Configuration details:

    Memory management

    Recordrejection

    Interruptedload handling details

    How tomanipulate thedata

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    17/32

    9-17 Copyright 2004, Oracle. All rights reserved.

    The SQL*LoaderControl File

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    18/32

    9-18 Copyright 2004, Oracle. All rights reserved.

    The SQL*LoaderControl File

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    19/32

    9-19 Copyright 2004, Oracle. All rights reserved.

    Control File SyntaxConsiderations

    Thesyntax isfree-format.

    Syntax is not casesensitive.

    Commentsextendfrom the two hyphens (--) that

    mark thebeginning ofthecomment to theendoftheline.

    TheCONSTANT keyword isreserved.

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    20/32

    9-20 Copyright 2004, Oracle. All rights reserved.

    Input Data and Data Files

    SQL*Loaderreadsdata fromoneormorefiles

    specified in thecontrolfile.

    From SQL*Loadersperspective, thedata in the

    data file isorganized asrecords. Adata filecan be in oneof threeformats:

    Fixed-recordformat

    Variable-recordformat

    Stream-recordformat

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    21/32

    9-21 Copyright 2004, Oracle. All rights reserved.

    Input Data and Data Files

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    22/32

    9-22 Copyright 2004, Oracle. All rights reserved.

    Input Data and Data Files

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    23/32

    9-23 Copyright 2004, Oracle. All rights reserved.

    Loading Methods

    ConventionalDirectpath

    Array

    insert

    Block

    writes

    Table

    SGA

    High-watermark

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    24/32

    9-24 Copyright 2004, Oracle. All rights reserved.

    Loading Methods

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    25/32

    9-25 Copyright 2004, Oracle. All rights reserved.

    Comparing Direct andConventional

    Path Loads

    Conventional Load

    UsesCOMMIT tomake

    changespermanent

    Redoentries alwaysgenerated

    Enforces allconstraints

    INSERT triggersfire

    Can load intoclustered

    tables

    Otheruserscan make

    changes to tables

    Direct Path Load

    Usesdata saves

    Generatesredoonly underspecificconditions

    Enforcesonly PRIMARY KEY,UNIQUE, andNOT NULL

    INSERT triggersdo not fire

    Cannot load into

    clustered tables

    Otheruserscannot

    makechanges to tables

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    26/32

    9-26 Copyright 2004, Oracle. All rights reserved.

    Comparing Direct andConventional

    Path Loads- Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    27/32

    9-27 Copyright 2004, Oracle. All rights reserved.

    Loading Data with SQL*Loader

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    28/32

    9-28 Copyright 2004, Oracle. All rights reserved.

    Loading Data with SQL*Loader

    Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    29/32

    9-29 Copyright 2004, Oracle. All rights reserved.

    Summary

    In thislesson, youshould havelearned how to:

    Manipulatedata through SQL

    Use Data Pump toexport data

    Use Data Pump to import data

    Loaddata with SQL Loader

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    30/32

    9-30 Copyright 2004, Oracle. All rights reserved.

    Practice 9:

    Using Data Pump Export andImport

    Thispracticecovers thefollowing:

    Creating a directory object

    Extracting theHR schema objects

    Using Data Pump import toload tables into adifferent schema

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    31/32

    9-31 Copyright 2004, Oracle. All rights reserved.

    Practice 9 Using Data Pump Export and

    Import - Full Notes Page

  • 8/9/2019 Oracle 10g Admin workshops PPTLess 09

    32/32

    9-32 Copyright 2004, Oracle. All rights reserved.