Oracle 10 Mins p

download Oracle 10 Mins p

of 138

Transcript of Oracle 10 Mins p

  • 8/12/2019 Oracle 10 Mins p

    1/138

    In the name of God, the most Gracious, the most Compassionate.

    OOrraaccllee99iiDDaattaabbaasseeAAddmmiinniissttrraattiioonniinn1100MMiinnuutteess

  • 8/12/2019 Oracle 10 Mins p

    2/138

    Oracle 9i Database Administration in 10 Minutes

    2

  • 8/12/2019 Oracle 10 Mins p

    3/138

    3

    OOrraaccllee99iiDDaattaabbaasseeAAddmmiinniissttrraattiioonn

    IInn

    1100MMiinnuutteess

    BBYY

    SIM BB SI

    ..::||::..TTaakkvveeeenn,,IInncc..

  • 8/12/2019 Oracle 10 Mins p

    4/138

    Oracle 9i Database Administration in 10 Minutes

    4

    Copyright 2005 Takveen, Inc. P.O. Box 1, South River, NJ08882. All rights reserved. No part of this publication may be

    stored in a retrieval system, transmitted, or reproduced in anyway, including but not limited to photocopy, photography,magnetic, or other record, without the prior agreement andwritten permission of the publisher and author.

    ISBN: 0-9770739-7-1

    Takveen and the Takveen logo are either registered trademarksor trademarks of Takveen, Inc. in the United States and/orother countries.

    The author and publisher have made their best effort to preparethis book, and the content is based upon final release softwarewhenever possible. Portion of the manuscript may be basedupon pre-release versions supplied by the software

    manufacturer(s). The author and the publisher make norepresentation or warranties of any kind with regard to thecompleteness or accuracy of the contents herein and accept noliability of ANY KIND including but no limited toperformance, merchantability, fitness for any particularpurpose, or any losses or damages of ANY KIND caused oralleged to be caused directly or indirectly from this book.

    Manufactured in the United States of America.

  • 8/12/2019 Oracle 10 Mins p

    5/138

    5

    DDeeddiiccaatteeddTTootthheeoonnllyyOOnnee

    TTootthheeoonnllyyOOnnee,,

    WWhhoosseeeesstthhrroouugghhoouurreeyyeess,,

    WWhhoolliisstteennsstthhrroouugghhoouurreeaarrss,,

    WWhhoohhaassnnooffeeaarr..

    TTootthheeoonnllyyOOnnee,,WWhhookknnoowwsswwhhaattssiinnssiiddeeoouurrhheeaarrtt,,

    WWhheetthheerriittssppuurreeoorrJJaarrvviikkhheeaarrtt,,

    TTootthheeoonnllyyOOnnee,,

    WWhhoogguuiiddeess,,WWhhoogglliiddeesstthheesshhiippssttootthheessiiddee,,

    WWhhooffiinnddsstthheeggrroooommssffoorrtthheebbrriiddeess..

    TTootthheeoonnllyyOOnnee,,

    WWhhoolleettyyoouuhhaavveeaaddrroopplleettffrroommHHiisssseeaa,,

    WWhhoolleettyyoouuddrriinnkkhhoonneeyyffrroommHHiissbbeeee..

    TTootthheeoonnllyyOOnnee,,

    WWhhoowwaasstthheebbeeggiinnnniinngg,,

    WWhhoowwiillllbbeetthheeeenndd,,

    WWhhoowwiillllddeecciiddeewwhheetthheerrIIwwiillllbbeeiinnHHeeaavveennoorrHHeellll,,

    WWhhaatteevveerrnnaammeeyyoouuggiivveeHHiimm,,AAssiimm!!

    IIkknnoowwoonneetthhiinnggffoorrssuurree,,

    HHeeiisstthheeoonnllyyOOnnee..

  • 8/12/2019 Oracle 10 Mins p

    6/138

    Oracle 9i Database Administration in 10 Minutes

    6

  • 8/12/2019 Oracle 10 Mins p

    7/138

    7

    About the Author

    Mr. Abbasi is President and CEO of Takveen, Inc. NJ, which isfirm providing information technology related OptimalSolutions to industry. He is also attached with three top-notchcomputer schools of NJ teaching Oracle DatabaseAdministration in Unix/Windows Server environments. Beforecoming to NJ, he used to teach Oracle in heart of NC, Raleighwhile working as Chief Technologist with a business solutions

    development firm.

    Mr. Abbasi has been attached intensely with the IT field forpast 13 years and has written dozens of softwares and tons ofcode from programming microcontrollers using Assemblylanguage to writing 3-tier multi-language web applications.

    He did B.Sc. Electrical Engineering from University of

    Engineering & Technology, Lahore, Pakistan(www.uet.edu.pk). He is Oracle Certified ProfessionalDatabase Administrator (OCP), Microsoft CertifiedProfessional (VB) and lots of other computer certifications.Besides certifications, he has lots of publications and has filed1 patent with United States Patent & Trade Mark Office.

    When asked Mr. Abbasi, he said that it all erupted with a

    saying of my engineering professor,

    Think yourself .

  • 8/12/2019 Oracle 10 Mins p

    8/138

    Oracle 9i Database Administration in 10 Minutes

    8

  • 8/12/2019 Oracle 10 Mins p

    9/138

    9

    Acknowledgements

    First, I am really thankful to God: The Designer of thisUniverse, everything within and beyond. I always rememberHim as Supreme Progneer (Programmer & Engineer). Theonly One whos every release is a final release and noupgrades, version releases or service packs after words. I saluteyour sea of computational and engineering skills my Lord andyour graciousness for letting me have a droplet from it.

    I really want to thank my father and mother for their wonderfulsupport. Although my father is no more living but hisexceptional sacrifices will never be forgotten

    I like to thank Arshia, Mateen and Abdul-Wadud for theirencouragement to let me work on this book even during thetime which I should had spent with them.

    Finally, I am thankful to all the wonderful instructors,professors, scholars, students and friends I had for their supportand encouragement.

  • 8/12/2019 Oracle 10 Mins p

    10/138

    Oracle 9i Database Administration in 10 Minutes

    10

  • 8/12/2019 Oracle 10 Mins p

    11/138

    11

    Table of Contents

    Minute 1: ......................................................................... 17Understanding the Oracle Environment

    Minute 2: ......................................................................... 23

    Understanding the Oracle Instance

    Minute 3: ......................................................................... 33

    Understanding the working of Oracle Instance

    Minute 4: ......................................................................... 39

    Understanding Oracle Database

    Minute 5: ......................................................................... 51

    Oracle 9i Software Installation

    Minute 6: ......................................................................... 57Oracle 9i Database Design using DBCA

    Minute 7: ......................................................................... 85

    Enabling Other Computers to Access Oracle

    Server

    Minute 8: ....................................................................... 107

    Oracle Enterprise Manger

    Minute 9: ....................................................................... 121

    Oracle Backup & Recovery -Simple Technique

    Minute 10: ..................................................................... 129

    Oracle Performance Tuning

    INDEX .......................................................................... 135

  • 8/12/2019 Oracle 10 Mins p

    12/138

    Oracle 9i Database Administration in 10 Minutes

    12

  • 8/12/2019 Oracle 10 Mins p

    13/138

    13

    FIGURE 1:THE COMPLETE ORACLE SYSTEM:ORACLE INSTANCE &ORACLE DATABASE.

    ................................................................................................... 20

    FIGURE 2:ORACLE INSTANCE CAN HEAR YOU FROM ANY CORNER OF GLOBE WHETHER ITS

    LANOR INTERNET. .......................................................................... 21FIGURE 3:BACKGROUND PROCESSES &MEMORY ARCHITECTURE INSIDE BRAIN. .. 26

    FIGURE 4:PHYSICALLY ALL HUMAN BRAINS ARE SIMILAR. .................................. 26

    FIGURE 5:ORACLE INSTANCE MEMORY ARCHITECTURE. ................................... 27

    FIGURE 6:ORACLE INSTANCE BACKGROUND PROCESSES;SHARED SERVER MODE. .. 35

    FIGURE 7:ORACLE INSTANCE BACKGROUND PROCESSES;DEDICATED SERVER MODE.36

    FIGURE 8:RESTAURANT RUNNING UNDER SHARED WAITRESS MODE................ 37

    FIGURE 9:RESTAURANT RUNNING UNDER DEDICATED WAITER MODE............... 38

    FIGURE 10:PHYSICAL ARCHITECTURE:ORACLE DATABASE............................... 42

    FIGURE 11:ORACLE DATABASE LOGICAL ARCHITECTURE. .................................. 44FIGURE 12:PHYSICAL &LOGICAL ARCHITECTURE RELATIONSHIP. ........................ 45

    FIGURE 13:TABLESPACES RELATES TO DATA FILES ONLY. .................................. 46

    FIGURE 14:ONE OBJECT (E.G.TABLE)CAN BE IN TWO OR MORE DATA FILES BUT ONLY IN

    ONE TABLESPACE. ............................................................................ 47

    FIGURE 15:REDO LOG FILES IN ACTION. ........................................................ 48

    FIGURE 16:THE FIRST TEXT BOX WILL ASK YOU THE LOCATION OF ORACLE SOFTWARE FILES

    THAT NEEDS TO BE INSTALLED.THE SECOND IS THE NAME TEXT BOX WHERE YOU

    WRITE THE ORACLE HOME NAME AND THE THIRD ONE IS THE DESTINATION

    LOCATION WHERE YOU WANT ORACLE SOFTWARE TO BE INSTALLED. .......... 53FIGURE 17:SECOND OPTION IS FOR INSTALLING A CLIENT AND WOULD LACK THE ABILITY TO

    CREATE THE DATABASE.THE THIRD OPTIONAL IS BASICALLY AN ADD-ON FEATURE

    WHICH WILL INSTALL ORACLE MANAGEMENT SERVER AND OTHER RELATED

    MANAGEMENT AND INTEGRATION TOO. ............................................... 54

    FIGURE 18:ORACLE ENTERPRISE EDITION IS FOR HIGH-VOLUME APPLICATIONS.STANDARD

    EDITION IS FOR DEPARTMENTAL APPLICATIONS WHEREAS PERSONAL EDITION OF

    ORACLE IS FOR SINGLE USER DEVELOPMENT ENVIRONMENT. .................... 55

    FIGURE 19:IF WE SELECT GENERAL PURPOSETHEN ORACLE UNIVERSAL INSTALLER

    (OUI)WILL NOT ONLY INSTALL THE SOFTWARE BUT WILL CREATE A STANDARD

    GENERAL PURPOSE DATABASE TOO BY DEFAULT.BUT WE WANT TO INSTALL

    SOFTWARE ONLY USING OUIAND THEN LATER LEARN HOW TO DEVELOP THE

    DATABASE. ..................................................................................... 56

    FIGURE 20:BEFORE USING DBCAWE HAVE TO SET CERTAIN OSENVIRONMENT

    VARIABLES. .................................................................................... 59

    FIGURE 21:IN WINDOWS OPERATING SYSTEM CLICK:,,

    ,AND FINALLY . ......................................................... 61

    FIGURE 22:FIRST WINDOW OF DBCAIS BASICALLY A WELCOME MESSAGE WITH A BRIEF

    DESCRIPTION ON THE PURPOSE OF THIS TOOL. ....................................... 62

  • 8/12/2019 Oracle 10 Mins p

    14/138

    Oracle 9i Database Administration in 10 Minutes

    14

    FIGURE 23:DBCACAN ASSIST DBAWITH 3OTHER TASKS BESIDES CREATING A NEW

    DATABASE I.E.CONFIGURING DATABASE OPTIONS IN A DATABASE,DELETE A

    DATABASE AND MANAGE TEMPLATES................................................... 63

    FIGURE 24:EACH TEMPLATE HAS PREDEFINED SETTINGS E.G.DATA WAREHOUSE

    TEMPLATE HAS SETTINGS GOOD FOR ANALYTICAL PROCESSING PURPOSES. .. 64

    FIGURE 25:YOU CAN ASSIGN ANY NAME TO GLOBAL DATABASE NAME............... 65

    FIGURE 26:THIS WINDOW IS MEANT FOR MAKE A DECISION WHETHER WE WANT TO RUN

    OUR ORACLE SERVER IN DEDICATED SERVER MODEOR THE SHARED SERVER

    MODE. ......................................................................................... 66

    FIGURE 27:CUSTOM OPTION WILL ALLOW YOU TO SELECT THE SGASIZE ACCORDING TO

    YOU NEEDS. ................................................................................... 67

    FIGURE 28:THIS WINDOW WILL ALLOW YOU TO SET UP ORACLE SERVER FOR ARCHIVING

    OF REDO LOG FILES. ......................................................................... 68FIGURE 29:THIS TAB WILL BE HAVING THE INFORMATION ABOUT LOCATION OF ALL

    ORACLE PHYSICAL FILES. ................................................................... 69

    FIGURE 30:THESE FOUR PARAMETERS ARE PRESENT IN INIT(SID).ORA FILE. ......... 70

    FIGURE 31:THIS WINDOW PROVIDES THE COMPLETE LIST OF INIT(SID).ORA FILE

    PARAMETERS.ORACLE INSTANCE READS THE FILE AT THE TIME OF STARTUP.71

    FIGURE 32:ACLOSE-UP OF FIGURE 31. ........................................................ 72

    FIGURE 33:EACH ORACLE DATABASE REQUIRES ONE CONTROL FILE AND THROUGH THIS

    WINDOW YOU CAN SET-UP YOUR CONTROL FILE LOCATION(S).MIRROR COPIES

    SHOULD BE ON DIFFERENT DRIVES FOR GREATER FAULT TOLERANCE. .......... 73FIGURE 34:SET THE MAXIMUM NUMBER OF DATAFILES,REDO LOG GROUPS ETC. .. 74

    FIGURE 35:CLICKING DATAFILESWILL CHANGE THE RIGHT PANE VIEW TO SHOW ALL

    DATAFILES. ..................................................................................... 74

    FIGURE 36:CLICKING 1UNDER REDO LOG GROUPS WILL CHANGE THE RIGHT PANE VIEW

    TO SHOW ALL THE MEMBER OF THAT PARTICULAR REDO LOG GROUP.EACH REDO

    LOG GROUP SHOULD HAVE AT LEAST ONE MEMBER. ................................ 75

    FIGURE 37:EITHER YOU CAN CHANGE THE DEFAULT FILE SIZE FOR REDO LOG MEMBER OR

    GO WHAT IS DEFAULT USING THIS WINDOW. ......................................... 76

    FIGURE

    38:Y

    OU CAN ALSO SAVE THE SETTINGS FOR YOUR DATABASE IN A TEMPLATE FOR

    CLONE DATABASE DEVELOPMENT. ....................................................... 77

    FIGURE 39:ITS BETTER TO CHANGE ALL THE DEFAULT PASSWORDS AT THIS POINT BY

    CLICKING THE BUTTON. ............................ 78

    FIGURE 40:CHANGE THE PASSWORD AND MAKE SURE THE ACCOUNT IS NOT HAVE A CHECK

    MARK IN THE CORRESPONDING LOCK ACCOUNT?FIELD. ....................... 79

    FIGURE 41:USE ORACLE ENTERPRISE MANAGER (OEM)TO TEST CONNECTION TO YOUR

    RECENTLY DEVELOPED DATABASE.OEMIS LOCATED UNDER ,,FOLDER. ...................................................... 80

    FIGURE 42:ACLOSE-UP OF THE FIGURE 41. .................................................. 80

    FIGURE 43:SELECT THE LAUNCH STANDALONEOPTION. ................................. 81

  • 8/12/2019 Oracle 10 Mins p

    15/138

    15

    FIGURE 44:THE TESTDATABASE WILL BE VISIBLE IN THE TREE HIERARCHY OF OEM

    (ORACLE ENTERPRISE MANAGER). ..................................................... 82

    FIGURE 45:CONNECTING AS SYSDBATO TESTDATABASE.............................. 82

    FIGURE 46:EXPAND THE TABLESPACESITEM IN THE TREE TO SEE THE LIST OF

    TABLESPACES WITHIN TESTDATABASE. ............................................... 83

    FIGURE 47:ORACLE NET NEEDS TO BE CONFIGURED ON SERVER AS WELL AS ON EACH

    CLIENT. ......................................................................................... 87

    FIGURE 48:ORACLE INSTANCE KNOWS HOW TO SPEAK WITH ORACLE NET LAYER WHEREAS

    ORACLE NET DEALS WITH DIFFERENT NETWORK PROTOCOLS. ................... 88

    FIGURE 49:ACCESSING ORACLE NET MANAGER (ONM):JAVA BASED PROGRAM,

    COMPLETELY INDEPENDENT OF OPERATING SYSTEM. .............................. 89

    FIGURE 50:EXPANDING LISTENERSSHOWS NO LISTENER PROCESS. ................. 90

    FIGURE 51:ORACLE NET MANAGER SHOWING NO SERVICE NAME. ................... 90FIGURE 52:CLICK THE LISTENERAND THEN THE +ICON TO CREATE NEW LISTENER

    PROCESS. ....................................................................................... 91

    FIGURE 53:ASSIGN THE NAME TO THE LISTENER PROCESS................................. 91

    FIGURE 54:ADD ADDRESSOF NEWLY ADDED LISTENER PROCESS TO TREE. ........ 93

    FIGURE 55:LISTENERS LOCATION FOR LISTENING REQUESTS. ............................ 94

    FIGURE 56:LISTENER PROCESS WILL BEQUEATH THE CONNECTION REQUEST FROM THE

    CLIENT TO THE DATABASE ADDED USING THE BUTTON. .. 95

    FIGURE 57:ENTER GLOBAL DATABASE NAME,DATABASE HOME DIRECTORY LOCATION

    AND FINALLY SID(NAME OF ORACLE INSTANCE). ................................... 96FIGURE 58:SAVE NETWORK CONFIGURATION AND START THE LISTENER. ............. 97

    FIGURE 59:IN WINDOWS SERVER 2003ENVIRONMENT,THE LISTENER PROCESS CAN BE

    ACTIVATED UNDER THE SERVICESWINDOW. ...................................... 98

    FIGURE 60:CLICK THE SERVICE NAMEITEM AND THEN CLICK THE +ICON TO ADD A

    NEW SERVICE NAME TO THE TREE. ....................................................... 99

    FIGURE 61:NET SERVICE NAME WILL BE THE NICK NAME ON THIS MACHINE FOR THE

    ORACLE DATABASE WE WANT TO CONNECT TO.IT CAN BE ANY NAME. ..... 100

    FIGURE 62:SELECT THE NETWORK PROTOCOL USED TO COMMUNICATE WITH ORACLE

    SERVER FROM THIS CLIENT

    . ............................................................. 101FIGURE 63:NET SERVICE NAME IS AN ALIAS GIVEN TO DETAILED LIST OF CONNECTION

    PARAMETERS.HOST NAME WILL BE THE NAME OF THE MACHINE ON THE NETWORK

    RUNNING ORACLE DATABASE SERVER. .............................................. 102

    FIGURE 64:SERVICE NAME WILL BE GLOBAL DATABASE NAME OF ORACLE DATABASE

    SERVER.LISTENER PROCESS WILL BE REQUESTED BY CLIENT TO BEQUEATH THE

    CONNECTION TO THIS ORACLE DATABASE SERVER. ............................... 103

    FIGURE 65:SERVICE NAME &NET SERVICE NAME IS NOT SAME.SERVICE NAME IS THE

    GLOBAL DATABASE NAME. ............................................................. 104

    FIGURE 66:SAVE NETWORK CONFIGURATION.ORACLE NET MANAGER WILL GENERATE

    TNSNAMES.ORA FILE CONTAINING NET SERVICE NAME (ALIAS)RESOLUTION TO

    MAKE A ORACLE SERVER CONNECTION. ............................................. 105

  • 8/12/2019 Oracle 10 Mins p

    16/138

    Oracle 9i Database Administration in 10 Minutes

    16

    FIGURE 67:ORACLE ENTERPRISE MANAGER (OEM)IS A JAVA BASED APPLICATION,

    COMPLETELY OPERATING SYSTEM INDEPENDENT. ................................. 109

    FIGURE 68:NO NEED TO REMEMBER SQLSTATEMENTS.MOST OF THE TIME RIGHT-CLICK

    SOLVES THE PROBLEM AND POPPED UP MENU PROVIDES YOU THE COMMAND YOU

    WERE LOOKING FOR. ...................................................................... 110

    FIGURE 69:CREATE THE NEW TABLESPACE USING THIS WINDOW. .................... 111

    FIGURE 70:STORAGE TAB WILL GIVES YOU THE OPTION TO SELECT LOCALLY MANAGED OR

    DICTIONARY MANAGED EXTENTS.YOU CAN ALSO SELECT TO MAKE THE TABLESPACE

    EXTEND AUTOMATICALLY IN CASE IT RUNS OUT OF SPACE BY SELECTING

    AUTOMATIC ALLOCATION. ........................................................... 112

    FIGURE 71:MANAGE DATA FILES USING ORACLE ENTERPRISE MANAGER (OEM).113

    FIGURE 72:MANAGE REDO LOG FILES &GROUPS USING ORACLE ENTERPRISE MANAGER

    (OEM). ...................................................................................... 114FIGURE 73:COMPLETE USERS MANAGEMENT USING ORACLE ENTERPRISE MANAGER

    (OEM). ...................................................................................... 115

    FIGURE 74:CREATE USERUSER WINDOW WILL POP UP ONCE YOU RIGHT CLICK ANY USER

    AND SELECT THE OPTION CREATE AS SHOWN IN THE SLIDE ABOVE.COMPLETE

    ORACLE INSTANCE MANAGEMENT USING ORACLE ENTERPRISE MANGER (OEM).

    ................................................................................................. 116

    FIGURE 75:MEMORY TAB GIVES YOU FULL CONTROL OVER ORACLE INSTANCE MEMORY

    ARCHITECTURE COMPONENTS. ......................................................... 117

    FIGURE 76:DATABASE RECOVERY ISSUES CAN BE MANAGED EASILY USING ORACLEENTERPRISE MANAGER (OEM). ...................................................... 118

  • 8/12/2019 Oracle 10 Mins p

    17/138

    17

    MMiinnuuttee11::

    Understanding the

    OracleEnvironment

  • 8/12/2019 Oracle 10 Mins p

    18/138

    Oracle 9i Database Administration in 10 Minutes

    18

  • 8/12/2019 Oracle 10 Mins p

    19/138

    19

    Oracle is such a complex system that without analogies itsvery hard to comprehend and grasp the concept of Oracle

    architecture and its working. Also once you understand theconcepts then there is nothing left for cramming.

    Oracle System is basically divided into two things namelyOracle Instance and Oracle Database. We have taken theanalogy of a Genie (Ghost/Djin): just like the one you mighthave seen in the movie/story of Aladdin & the Magic Lamp.When Aladdin rubbed the lamp; Genie became available andfulfilled all his commands. Similarly when you double clickOracle icon in your system, Oracle Instance gets alive andwaits for users information/data related commands to fulfill, asit is a magnificent Data Management Genie.

    Oracle Instance is something with which users interact in termsof storing and retrieving information. Anything that is goinginto the database or coming out of the database has to bethrough Oracle Instance and to communicate with Oracle

    Instance we need to learn Genies language: SQL. It stands forStructured Query Language and pronounced as See-Qual.

    The Oracle Database is basically Genies area to writeinformation and to make the changes permanent on the harddisk. The communication between Oracle and user takes placein a fashion that first user has to establish a connection withOracle server or more precisely oracle instance by providing

    his/her credentials (Username and password). Once verified,Oracle accepts the connection otherwise the connection requestwill get rejected.

  • 8/12/2019 Oracle 10 Mins p

    20/138

    Figure 1: The C

    In Oracle wconsidered aoracle server

    oracle servesessions drovery easy towords withhave a look oSELECT naFROM addre

    Once Oraclretrieve all

    Oracle 9i Database

    omplete Oracle

    orld each co session. If t, we can say

    . If one pers to two. Saster, as it is

    o or very litn following S

    e, phoness_book;

    Instance wihe name a

    Administration in

    ystem: Oracle In

    nected userere are threethat there ar

    on logs offL commandscomprised ofle abbreviatiL command

    ll receive thnd phone

    10 Minutes

    stance & Oracle

    ith oracle sconnected us three sessio

    then the nu are very simall full-lengthns. For exam

    s command,nformation f

    20

    atabase.

    rver isrs withns with

    ber ofple andEnglish

    ple lets

    it willom the

  • 8/12/2019 Oracle 10 Mins p

    21/138

    address_booIf there are 1

    sent to user c

    Figure 2: Oracl

    table and sen000 records o

    mputer.

    Instance can heL

    d it to the user rows in that

    r you from anyN or internet.

    who had asktable; all of t

    orner of globe w

    21

    d for it.em get

    hether its

  • 8/12/2019 Oracle 10 Mins p

    22/138

    Oracle 9i Database Administration in 10 Minutes

    22

  • 8/12/2019 Oracle 10 Mins p

    23/138

    23

    MMiinnuuttee22::

    UnderstandingOracle Instance

  • 8/12/2019 Oracle 10 Mins p

    24/138

    Oracle 9i Database Administration in 10 Minutes

    24

  • 8/12/2019 Oracle 10 Mins p

    25/138

    25

    The thing I want you to memorize if you havent memorized ityet, the definition of Oracle Instance i.e. the background

    processes and memory architecture constitute the OracleInstance. To better understand these two things I want to giveyou the analogy of the way human brain works. Human brainsworks pretty much the same way Oracle Instance works.

    Oracle System Human System

    Oracle Instance + OracleDatabase

    Human Brain + NoteBooks (Papers etc.)

    Oracle Instance iscomposed of backgroundprocesses & memoryarchitecture.

    Human brain is composedof background processes &memory architecture.

    Sources of input to OracleInstance are connectedusers.

    Sources of input to humanbrain are nose, eye, ear etc.

    Background processesreceives input fromconnected users and usingthe memory (RAM)architecture produce theoutput.

    Background processes(decision, alerts,relationships etc.) receivesinput from five senses andusing the brain memoryproduces the output(decision).

    Physically all OracleSystems are alike i.e. datafiles, control file, redo logfiles etc.

    Physically all human brainsare alike i.e. twohemispheres.

    Its the logical architecturewhich makes one Oraclesystem different from theother.

    Its the logical architecturewhich makes one braindifferent than other.

  • 8/12/2019 Oracle 10 Mins p

    26/138

    Figure 3: Ba

    Fi

    Oracle 9i Database

    kground Process

    ure 4: Physicall

    Administration in

    es & Memory A

    all human brain

    10 Minutes

    chitecture inside

    s are similar.

    26

    Brain.

  • 8/12/2019 Oracle 10 Mins p

    27/138

    Understan

    Architectu

    By saying,how RAM ismemory, occategories. Ocalled Non S

    F

    Oracle allocastarts and demandatory ar5. Optionalarises. In mBuffer Cache

    areas we hautilized forPL/SQL obje

    ing Oracl

    re

    emory architutilized by Oupied by O

    ne is called Sared Memor

    igure 5: Oracle I

    tes SGA (Systllocates it wheas and two orea means yndatory areaand Redo Lo

    e Large PoQL requests

    cts execution,

    Instances

    cture of Oraracle Instanceracle is diviared Memor

    .

    stance memory

    em Global Arn the Instanctional areas

    ou can have, we have Sg Buffer Cac

    l and Javacoming fromdata dictiona

    Memory

    le Instance. The RAM oed into twand the othe

    rchitecture.

    a) wheneverends. SGA h

    s shown in thit if the reqared Pool,e whereas in

    ool. Sharedthe connectey views, lock

    27

    e meansimplymajor

    r one is

    nstanceas three

    Figureirementatabaseptional

    Pool isusers,

    and so

  • 8/12/2019 Oracle 10 Mins p

    28/138

    Oracle 9i Database Administration in 10 Minutes

    28

    on. There is a special area inside Shared Pool that deals withSQL and PL/SQL, is called the Library Cache. If one user has

    executed the SQL statement that statement will get parsed andcomplied utilizing this area.

    The Data Dictionary Cache holds the most recently useddatabase dictionary information. Data Dictionary is basicallythe information about the data inside the database or in otherwords metadata in the form of tables and view about thedatabase.

    Database Buffer Cache holds the DB Blocks recently read fromthe data files. Database Buffer Cache has further three sub-caches. One is called KEEP, second one is RECYCLE and thethird one is DEFAULT. In KEEP, DB blocks will be retainedin the RAM and will not get aged out. Oracle Instance willremove stuff placed in RECYCLE from the RAM as soon asthey are not needed. DB Blocks without any assigned attribute(KEEP or RECYCLE) are placed in the DEFAULT buffer

    pool.

    Within whole Database Buffer Cache, there lie three differenttypes of buffers or in other words three different states ofbuffers. These three states are, Dirty Buffers, Free Buffers andPinned Buffers. Buffers that need to be written to the data filesare marked dirty and hence got the name Dirty Buffers. Oncewritten to the data files they are available to be over-written

    and those which never had any data, are called Free Buffers.Buffers that are currently being accessed or those that areexplicitly marked for future use, are called Pinned Buffers e.g.KEEP buffer pool.

    Redo Log Buffer Cache holds the information about thechanges that are being made to the database. Large Pool isoptionally required for specific database operation like backup

    or restore to avoid contention with rest of the good stuff ofSGA.

  • 8/12/2019 Oracle 10 Mins p

    29/138

    29

    Java Pool is another optional area and can be requested to

    provide memory for java objects within Oracle database. TheNon-Shared part of memory is called PGA (Program GlobalArea) and contains the data and control information for a serverprocess. Stack space in the PGA is utilized by server process tohold variables, arrays and other useful information pertainingto connected session.

    Understanding Oracle Instances BackgroundProcesses

    Oracle background processes have been assigned a specificjob. Each process gets executed under certain circumstances. Ifthose circumstances happen again, the process gets executedagain. Lets look at each of these processes one by one.

    DBWn

    DBWn or Database Writer process writes the contents of dirtybuffers of Database Buffer Cache to the data files.

    LGWR

    The Log Writer process writes the Redo Log Buffers from

    the Redo Log Cache to the Redo Log files.

    ARCn

    If we dont want the Redo Log files to be overwritten byLGWR process then we have to run the database inARCHIVELOG mode and we have to enable automatic

    archiving by setting LOG_ARCHIVE_START = True.

  • 8/12/2019 Oracle 10 Mins p

    30/138

    Oracle 9i Database Administration in 10 Minutes

    30

    Under this mode Archiver process (ARCn) become alive.ARCn process makes sure that the Redo Log files gets archived

    to the archived location before it gets overwritten by LGWRprocess. In Oracle 9i, we can have as many as ten Archiverprocesses (ARC0 to ARC9).

    CKPT (Checkpoint)

    CKPT process updates the header of data files and control file.Its a event that happens automatically and kicks the DBWRprocess to write the dirty buffers to data files.

    SMON, PMON

    SMON or System Monitor performs instance recovery, ifnecessary on system startup whereas PMON or ProcessMonitor frees up all the resources held by a user processwhenever it fails.

    Dnnn or Dispatcher Process(es)

    Dnnn or Dispatcher process is only available if you run Oraclesystem in Shared Server mode. Its prime job is to take therequest from the connected user and place it in the in theRequest Queue. Server process when its free picks up therequest form the request queue and put the response back in theResponse Queue after processing the request. Dispatcher

    process when its free picks that response from the responsequeue and sends it back to the user who submitted that request.You can have multiple Dnnn processes for single DatabaseInstance.

  • 8/12/2019 Oracle 10 Mins p

    31/138

    31

    Snnn or Shared Server Process(es)

    Shared Server processes (Snnn) utilizing the beauty ofDispatcher process and Request and Response Queue to servemore than one user. The number of Shared Server processescan be controlled using two init.ora parameters,SHARED_SERVERS and MAX_SHARED_SERVERS.

  • 8/12/2019 Oracle 10 Mins p

    32/138

    Oracle 9i Database Administration in 10 Minutes

    32

  • 8/12/2019 Oracle 10 Mins p

    33/138

    33

    MMiinnuuttee33::

    Understanding theWorking of OracleInstance

  • 8/12/2019 Oracle 10 Mins p

    34/138

    Oracle 9i Database Administration in 10 Minutes

    34

  • 8/12/2019 Oracle 10 Mins p

    35/138

    Oracle Servemode or as

    Instance wobeauty of shprocess handserver procesLGWR (LoSMON (SystOracle backmemory arbackgroundarea) to fulfil

    Figure 6: Or

    Figure 7 shomight haveespecially thResponse Quworking in D

    r can be conDedicated Se

    king underared server cles multiple ss reduces.

    Writer Prom Monitor),round proceshitecture ofrocess utilizrequests of a

    acle Instance bac

    s the same thnoticed thatre is no Dispeue. This is bedicated Serv

    igured to runver mode. Fi

    Shared Servenfiguration iessions and h

    cess), PMORCn (Archiv

    ses and SGAOracle Inst

    the memorl the connecte

    kground process

    ing as the prewe have lesatcher procescause; herer mode.

    under Sharegure 6 shows

    configurati that a singlence the idle

    (Processer Process) et in the centeance. So al architectured users.

    s; shared server

    ious one butnumber of

    and no Reqe are showin

    35

    ServerOracle

    n. Theservertime of

    onitor),. are all

    is thethese

    (shared

    ode.

    ere youblocks,est andOracle

  • 8/12/2019 Oracle 10 Mins p

    36/138

    In dedicated

    a separate sehaving high iwould be doiarrive. Thisshould onlyresources av

    Figure 7: Ora

    The Shareda restaurantserving morwaitress willbe having on

    Oracle 9i Database

    erver mode, e

    ver process.dle server timg nothing anonfiguration

    be utilizedilable.

    le Instance back

    erver mode cs shown in th people. Inbe less compwaitress per

    Administration in

    ach connected

    lthough this cas most of twaiting for

    has high perfhen you ha

    round processes

    n be best visFigure 8. Thhis case theared to the sierson.

    10 Minutes

    user is entert

    nfiguratione time Serverext SQL statrmance facte plenty of

    ; dedicated serve

    alized if youre are two w

    idle timeuation where

    36

    ined by

    ould beprocessment tor but itsystem

    mode.

    magineitressesor eachwe will

  • 8/12/2019 Oracle 10 Mins p

    37/138

    Figure

    In Shared Sreceives theServer procerequest queresponse quethe responsespecific user

    The point toqueues are nwords partDedicated SQueues norto Oracle Inserve him/he

    : Restaurant Ru

    rver mode tsers request as when itse, processesue. Dispatchefrom the reho submitte

    be noted oveot processes.of memoryrver mode

    ny Dispatcherstance, one n.

    ning Under Shar

    ere is a dispd places it in

    ree picks uit and put tprocess whponse queuethat request.

    r here is thatThey are parRAM) utilizhere is neitprocess. Wheew Server pr

    ed Waitress Mod

    tcher processthe Requestthe requeste response

    en its freeand sends i

    request and r of SGA ord by proce

    er Request/Rnever a usercess gets cr

    37

    e

    , whichueue.

    rom theack inicks upto the

    esponsen otherses. Inesponseonnectsated to

  • 8/12/2019 Oracle 10 Mins p

    38/138

    Figure 9

    Let me givefor you i.e. SServer takessystem runniOracle syste7 concurrenDedicated S

    Mode.

    Oracle 9i Database

    : Restaurant Run

    ou an idea hared Serverapproximateg Oracle havneeds to su

    users. Undrver Mode o

    Administration in

    ing Under Dedi

    w to find outr Dedicated Sy of 20MBe 1 GB of Rport 10 usersr this scen

    therwise stic

    10 Minutes

    ated Waiter Mo

    which will wrver. Each Dof memory.M available aand on the avrio always

    with Shared

    38

    e

    rk bestdicatedIf yournd yourrage ofo withServer

  • 8/12/2019 Oracle 10 Mins p

    39/138

    39

    MMiinnuuttee44::

    UnderstandingOracle Database

  • 8/12/2019 Oracle 10 Mins p

    40/138

    Oracle 9i Database Administration in 10 Minutes

    40

  • 8/12/2019 Oracle 10 Mins p

    41/138

    41

    Oracle database has a logical architecture as well as physicalarchitecture. When we talk about database objects e.g. tables

    we are actually talking about logical architecture and when aretalking about physical files like control file, data files etc., weare actually talking about physical architecture of Oracledatabase.

    Physical Architecture

    Physical architecture of Oracle Database is comprised of fivedifferent types of files.

    Physical Architecture of Oracle DatabasePurpose File Names

    Main Oracle Database Files.

    Control File

    Data Files

    Redo Log Files

    Oracle Instance reads it at startup. Parameter File (init.ora)

    Archiving of Redo Log Files Archived Redo Log Files

    Control File:

    Every database has one control file and it basically contains theinformation regarding the structure of database. OracleInstance reads control file at the time of startup to find outdatabase name, location of data files and redo log files.

    Data Files:

    Data files are the files where the actual databases data resides.Oracle database can have one or more data files. The size ofeach data file is limited to OS (operating system) maximum filesize. But the size of the Oracle Database can be whatever youlike. There is no limit on the maximum size of the database. Ifyou are running out of space you can always add more datafiles to the database.

  • 8/12/2019 Oracle 10 Mins p

    42/138

    Fi

    Redo Log Fil

    Redo Loghappening inmore redo lolog files getInstance finioverwriting tThe way we

    the Oracle Inin this mod

    Oracle 9i Database

    ure 10: Physical

    es & Archive

    iles are thedata. Everyfiles. Each s

    utilized inhes writinge first one.

    an protect ov

    stance in Arc then redo

    Administration in

    Architecture: Or

    Redo Log Fil

    files that mOracle Databt is called red circular fashe last redo

    rwriting of R

    ive Log Modog files will

    10 Minutes

    cle Database

    es:

    intains these has set o

    o log file grouion i.e. whenog file then

    do Log files

    . If Oracle isget archived

    42

    changestwo or

    p. RedoOracle

    it starts

    s to run

    runningto the

  • 8/12/2019 Oracle 10 Mins p

    43/138

    43

    destination you specify in the parameter file before gettingoverwritten.

    Parameter File (PFILE):

    Parameter file contains the name of the database, location ofcontrol file, memory structure of Oracle Instance and certainother necessary Oracle system configuration parameters.PFILE is read by Oracle Instance while starting up the databaseor even before that i.e. when the Instance creates itself.

    Logical Architecture

    Logically the data inside the database resides inside thetablespaces. Each tablespace is comprised of segments. OracleInstance allocates a segment each time you create a object(table, view etc) inside the database. Each segment iscomposed of Extents and What are Extents? Each extent is agroup of contiguous DB Blocks. Now what are DB Blocks? ADB Block is the smallest building block of the database and isusually the even multiple of OS Block e.g. DB Block can be (2* OS Block) but not (1.37 * OS Block). The size of the DBBlock can be specified using DB_BLOCK_SIZE init.oraparameter. You can assign values like 2KB (2 Kilo Byes) andif the OS permits you can have 4KB, 8KB etc.

  • 8/12/2019 Oracle 10 Mins p

    44/138

    L

    F

    Oracle 9i Database

    gical Archite

    igure 11: Oracle

    Administration in

    cture of Oraclablespace

    Segments

    Extents

    B Blocks

    database logical

    10 Minutes

    Database

    rchitecture.

    44

  • 8/12/2019 Oracle 10 Mins p

    45/138

    Figu

    Figure 12 shand physicalthe same buttalk about itsabout its tablTablespacesinside theseonly one da

    maximum siOperating Syanother datasize of tablessize.

    e 12: Physical &

    ws the sidearchitectureyou can loo

    files (data filspaces, segm

    re like smallablespaces rea file associ

    e of the tastem maximufile to the ta

    pace is not li

    logical architect

    y side relatiof Oracle dataat it throughes, control filnts (objects)

    departmentalsides in the dted with the

    lespace cannfiles size. B

    lespace. In thited to the O

    re relationship.

    ship betweease. The dattwo angles.etc.) or you

    tc.

    level databasata a file. If

    tablespace t

    t be more tt you can al

    is way the mmarked limi

    45

    logicalbase isou can

    can talk

    s. Datathere isen the

    an theays addximumon file

  • 8/12/2019 Oracle 10 Mins p

    46/138

  • 8/12/2019 Oracle 10 Mins p

    47/138

    Figure 14: One

    object (e.g. tablin o

    ) can be in two one tablespace.

    r more data files

    47

    but only

  • 8/12/2019 Oracle 10 Mins p

    48/138

    How Orac

    Every databaredo log grocalled memb

    Within oneof each otherdifferent phfactor. Haviwithin a grWhatever dawritten to th

    Oracle 9i Database

    e Instance

    se should havp should havrs.

    Figure 15:

    edo log grouand its recosical hard drig mirror copup is calleda changes areRedo Log fi

    Administration in

    ses Redo

    two or moreat least two

    edo log files in

    , all redo logmend that theves to increaies of the orMultiplexing

    happening ines. In other

    10 Minutes

    og Files?

    redo log grour more redo

    ction.

    iles are mirroy all should re the fault tginal Redoof Redo Lothe database,ords you can

    48

    s. Eachog files

    r copiesside onleranceog fileg files.all getssay its

  • 8/12/2019 Oracle 10 Mins p

    49/138

    49

    the Undo copy of the original database. As shown in Figure15, Oracle Instance (or more precisely, the Log Writer process)

    will start writing these changes in data from Redo Log group 1,once it gets filled up, Oracle instance will move to group 2 andfinally group 3. Once group 3 finishes up, Oracle instance willstart all over gain from group 1. Thats the reason we say thatRedo Log files get utilized in a circular fashion.

    To avoid overwriting of Redo Log files, you should run theOracle Instance in Archive Log Mode. Whenever Oracle isrunning in this mode, redo log files gets archived well beforethey get overwritten.

  • 8/12/2019 Oracle 10 Mins p

    50/138

    Oracle 9i Database Administration in 10 Minutes

    50

  • 8/12/2019 Oracle 10 Mins p

    51/138

    51

    MMiinnuuttee55::

    Oracle 9i Software

    Installation

  • 8/12/2019 Oracle 10 Mins p

    52/138

    Oracle 9i Database Administration in 10 Minutes

    52

  • 8/12/2019 Oracle 10 Mins p

    53/138

    You can doworacle websit

    you downloaunzip those dsetup.exe file(OUI).

    Step 1:

    Once you ruwill see theNext button

    Figure 16: Thfiles that needswrite the Orac

    nload complete (www.oracl

    the Oracle sownload fileswhich will st

    the setup.eollowing winnce done.

    first text box wto be installed.le Home name ahere you want O

    e Oracle soft.com) for lear

    ftware then ymost probablrt the Oracle

    e file OUI wdow with de

    ll ask you the lohe second is thed the third one iacle software to

    are for free frning purpose.

    u would needbefore runniniversal Inst

    ll start and tult values. C

    ation of Oracle same text box w

    the destination lbe installed.

    53

    mOnce

    tog theller

    en youlick the

    oftwarehere youocation

  • 8/12/2019 Oracle 10 Mins p

    54/138

    Step 2:

    Select the fiselected Orac

    Figure 17: Secoto create the

    which will inst

    Oracle 9i Database

    st option ofle9i Database

    nd option is for iatabase. The thi

    ll Oracle Managand

    Administration in

    racle 9i Datoption then cl

    nstalling a clientd optional is bas

    ment Server andntegration too.

    10 Minutes

    base. Once yck Next but

    and would lack tically an add-on

    other related ma

    54

    u haveon.

    e abilityeature

    agement

  • 8/12/2019 Oracle 10 Mins p

    55/138

  • 8/12/2019 Oracle 10 Mins p

    56/138

    Step 4:

    Select the oSoftware Oprocess willOracle Soft

    Figure 19: If(OUI) will no

    purpose databaOUI

    Oracle 9i Database

    tion of Sofly option anstart and upoare has been

    e select Generonly install thee too by default.and then later le

    Administration in

    ware Only.click Nextsuccessful c

    nstalled succ

    l Purpose thenoftware but willBut we want to irn how to devel

    10 Minutes

    Once you sebutton the insmpletion it

    ssfully.

    racle Universalcreate a standardnstall software op the database.

    56

    lect theallationill say,

    nstallergenerally using

  • 8/12/2019 Oracle 10 Mins p

    57/138

    57

    MMiinnuuttee66::

    Oracle 9i Database

    Design UsingDBCA

  • 8/12/2019 Oracle 10 Mins p

    58/138

    Oracle 9i Database Administration in 10 Minutes

    58

  • 8/12/2019 Oracle 10 Mins p

    59/138

    Before eveAssistant) w

    variables. Owhere Oracenvironment

    Step 1:

    Lets supposC:\> SET O

    Figure 20: B

    Whereas in

    % setenv ORORACLE_H

    ORACLE_BAccording tenvironment

    we starte have to s

    ACLE_BASe softwaree can set it u

    the DOS pro

    ACLE_BAS

    fore using DBC

    nix we write t

    CLE_BASE

    ME specifi

    SE and itsOFA (Opvariable

    DBCA (Daet some of

    describes twill be inssing the SET

    pt is C:\>.

    C:\Oracle

    we have to setvariables.

    he command

    /Oracle

    s the direct

    ere where Oimal Flexiblshould

    abase Confihe OS envi

    e top most dalled. Inommand.

    ertain OS envir

    s shown belo

    ry that lies

    acle products Architecturto set

    59

    urationonment

    irectoryindows

    nment

    .

    beneath

    reside.), thisto

  • 8/12/2019 Oracle 10 Mins p

    60/138

    Oracle 9i Database Administration in 10 Minutes

    60

    ORACLE_BASE/product/release#. Lets suppose the DOSprompt is C:\>.

    C:\> SET ORACLE_HOME C:\Oracle\database\9_2

    Whereas in Unix we write the command as shown below.

    % setenv ORACLE_HOME /Oracle/product/9_2

    ORACLE_SID is the instance name or rather default instancename on the machine having Oracle installed. Lets suppose

    the DOS prompt is C:\>.

    C:\> SET ORACLE_SID test

    Whereas in Unix we write the command as shown below.

    % setenv ORACLE_SID test

    PATH is the environment variable and its usually set toORACLE_HOME/bin folder. The bin folder contains all thetools that shipped with Oracle.

  • 8/12/2019 Oracle 10 Mins p

    61/138

    61

    Step 2:

    After setting the above mentioned parameters the next stepwould be to run DBCA. DBCA can be invoked from theWindows operating system start menu as shown below or byentering the following Unix command.

    dbca

    Figure 21: In windows operating system click: , ,, and finally .

  • 8/12/2019 Oracle 10 Mins p

    62/138

    Step 3:

    Click the button.

    t window of DBbrief description

    Administration in

    A is basically aon the purpose o

    10 Minutes

    elcome messaf this tool.

    62

    e with a

  • 8/12/2019 Oracle 10 Mins p

    63/138

    Step 4:

    Using DBCexisting datmanage tempselected and

    Figure 23: DBdatabase i.e. c

    you can creabase, deletelates. Make shen click Ne

    A can assist DBnfiguring datab

    and m

    e a new databan already ere that Creatt button.

    with 3 other tase options in a danage templates.

    ase, configurexisting databa Database

    ks besides creatitabase, delete a

    63

    alreadyse andption is

    ng a newatabase

  • 8/12/2019 Oracle 10 Mins p

    64/138

    Step 5:

    DBCA hasusing Genethat Generalbutton.

    Figure 24: Etemplate

    Oracle 9i Database

    ertain built-ial Purpose dPurpose opti

    ch template hashas settings goo

    Administration in

    templates.atabase templon is selected

    predefined settinfor Analytical P

    10 Minutes

    ver here wete option. Mand then clic

    s e.g. Data Warrocessing purpos

    64

    will beke sureNext

    housees.

  • 8/12/2019 Oracle 10 Mins p

    65/138

    Step 6:

    Decide onIdentifier (SIcase we haName and tethen click the

    Figure 25

    Global Data) will be thee entered tet will comeNext butto

    : You can assign

    ase Namename of thet.takveen asp automatical.

    any name to Glo

    & Domain.racle Instancthe Globaly as SID. On

    al Database Na

    65

    System. In ouratabasece done

    e.

  • 8/12/2019 Oracle 10 Mins p

    66/138

    Step 7:

    Decide on tOracle InstaMode.

    Figure 26: Thirun our Orac

    Oracle 9i Database

    e mode ofce either in

    s window is meale Server in ded

    Administration in

    peration of iedicated Ser

    t for make a deccated server mo

    mode.

    10 Minutes

    stance. Wever or Share

    ision whether wee or the shared

    66

    an runServer

    want toserver

  • 8/12/2019 Oracle 10 Mins p

    67/138

    Step 8:

    Decide on SHere you cmemory arcyour needs.that the stuff

    Figure 27: Cus

    A sizing. Usn either useitecture of Once done cl

    in there is acc

    tom option willt

    e either Typi the defaultacle or chanck the Archirding to your

    llow you to selecyou needs.

    al or Customvalues provie them acco

    ve tab to mrequirement.

    t the SGA size a

    67

    option.ed fording toke sure

    cording

  • 8/12/2019 Oracle 10 Mins p

    68/138

    Step 9:

    Archive Logfiles will beDB Sizingto your reqdefault value

    Figure 28: This

    Oracle 9i Database

    Mode: if youarchived befoab to make suirement. All.

    window will alloof

    Administration in

    select this optie overwrittenre that the stuthese tabs wi

    w you to set upedo log files.

    10 Minutes

    on then the R. Once donef in there is all already be

    racle Server for

    68

    do Loglick thecordinghaving

    archiving

  • 8/12/2019 Oracle 10 Mins p

    69/138

    Step 10:

    Parameter Fitab. All thescreen are acabout it.

    Figure 29: T

    e and Traceefault locatiocording to sta

    is tab will be haOrac

    iles locationsns and file ndards. So yo

    ing the informate physical files.

    can be set usmes specifiedont have t

    on about locatio

    69

    ing thisin thiso worry

    of all

  • 8/12/2019 Oracle 10 Mins p

    70/138

    Step 11:

    Make sure tvalues youLocation Varof theseORALCE_HOK button a

    Figure 30:

    Oracle 9i Database

    he OS envirset before stiables button

    four varME, DB_N

    d you will be

    These four para

    Administration in

    nment variarting DBCA.to see and toables viz.,ME and SID.ack to the pr

    eters are presen

    10 Minutes

    les reflect t Click on tmake sure th

    ORACLE Once donevious windo

    in init(SID).ora

    70

    e samee Filevalues

    BASE,lick the.

    file.

  • 8/12/2019 Oracle 10 Mins p

    71/138

    Step 12:

    To see the coAll Initializwill be havinthose you habe a compldeselect anyclick Closewindow and

    Figure 31: Tparamete

    mplete list oftion Parametg complete lise selected antely editableof the paramebutton and ithen click the

    is window provis. Oracle Instanc

    nitialization prs button. Tt of all the inithose you hwindow i.e.

    ters and edit twill take you

    Next button.

    des the completee reads the file at

    arameters clice popped upialization parvent select. Iyou can sel

    he values. Onback to the

    list of init(SID).the time of start

    71

    on theindowmeters,t wouldect andce donerevious

    ra fileup.

  • 8/12/2019 Oracle 10 Mins p

    72/138

    Oracle 9i Database

    Figure 32:

    Administration in

    close-up of figu

    10 Minutes

    re 31.

    72

  • 8/12/2019 Oracle 10 Mins p

    73/138

    Step 13:

    If you click tpane you wilwith their loc

    Figure 33: Eacwindow you c

    b

    he Control filsee all the mation. Once d

    Oracle databasn set-up your coon different dri

    item on theultiplexed conne click the

    requires one Cotrol file locationes for greater fa

    left pane, on ttrol files namptions tab.

    trol file and thr(s). Mirror copielt tolerance.

    73

    he rights along

    ugh thiss should

  • 8/12/2019 Oracle 10 Mins p

    74/138

    Step 14:

    The optionslog groups adatabase coDatafiles it

    Figure 34: S

    Figure 35: Clic

    Oracle 9i Database

    ab defines thd log membld ever possm on the righ

    t the maximum

    king Datafiles

    Administration in

    maximum lirs in each reblely has. Opane.

    umber of datafil

    ill change the ridatafiles.

    10 Minutes

    it on data filo log groupnce done th

    es, redo log grou

    ht pane view to

    74

    es, redohat thisn click

    s etc.

    show all

  • 8/12/2019 Oracle 10 Mins p

    75/138

    Step 15:

    Once you cliwill show alalong with th

    Figure 36: Clicview to show

    ck the Datal the data fileir location in

    king 1 under Rll the member olog group shoul

    iles in the ries your databthe system.

    do Log Groupsthat particular r

    have at least on

    ht pane, the lase is compr

    ill change the rido log group. Emember.

    75

    ft panesed off

    ght panech redo

  • 8/12/2019 Oracle 10 Mins p

    76/138

    Step 16:

    Click the redwill change.of each othelocation whinformationviewing theNext.

    Figure 37: Eith

    Oracle 9i Database

    o log group ithin a Red. You can are you wantbout redo loinformation

    er you can chanor go what is d

    Administration in

    and informLog Group ad more memto place the

    group 2 andegarding red

    e the default fileefault using this

    10 Minutes

    tion in the rill members arers and specm. Click 2similarly for

    log group

    size for redo logindow.

    76

    ht panee imagefy theirto see

    3. After, click

    member

  • 8/12/2019 Oracle 10 Mins p

    77/138

    Step 17:

    Configuratioclone datababased on thejust save theboth. Oncewindow.

    Figure 38: You

    values youse developm configuratioconfigurationone click F

    can also save theclone dat

    ntered in DBnt. You cansettings you

    settings as a tnish button

    settings for yourabase developme

    CA can be screate theprovided ormplate or yoand it take y

    database in a tent.

    77

    ved foratabaseou cancan do

    ou next

    plate for

  • 8/12/2019 Oracle 10 Mins p

    78/138

    Step 18:

    One shouldSYSTEM aclocked. Afteyou will bedatabase crea

    Figure 39: It

    Oracle 9i Database

    change thecounts. Make changing thack on the ption process

    better to changelicking the button.

    78

    S andis notton andand the

    oint by

  • 8/12/2019 Oracle 10 Mins p

    79/138

    Figure 40: Chcheck

    nge the passwormark in the corr

    d and make suresponding Lock

    he account is noAccount? field.

    79

    have a

  • 8/12/2019 Oracle 10 Mins p

    80/138

    Oracle 9i Database Administration in 10 Minutes

    80

    Step 19:

    Once you see the message, database has been createdsuccessfully. Open up OEM (Oracle Enterprise Manager) asshown in the figure below.

    Figure 41: Use Oracle Enterprise Manager (OEM) to test connection to yourrecently developed database. OEM is located under , , folder.

    Figure 42: A close-up of the figure 41.

  • 8/12/2019 Oracle 10 Mins p

    81/138

    Once youwindow will

    standalone oServer. Oracwe haventstandalone.

    Fi

    The next popOEM. Fromrunning all o

    one database

    lick Enterprpopup asking

    you want te Managemeinstalled itClick Ok.

    ure 43: Select th

    ped up windohere you caver the world

    i.e. TEST.

    ise Manageryou whether

    login to thet Server is ao we will

    e Launch stand

    w will be thecontrol all t

    . Right now i

    Console, fou want to r

    Oracle Man add-on proe running

    lone option.

    main controle databases

    ts showing y

    81

    llowingn OEM

    gementuct andEM as

    anel ofyou areou only

  • 8/12/2019 Oracle 10 Mins p

    82/138

    Figure 44: T

    TEST is theyou click onappear askin

    There is noSYSDBA frOK button.

    Figu

    Oracle 9i Database

    e TEST databOEM (Oracl

    atabase thatTEST item ing you for cr

    eed to specifm Connect

    e 45: Connectin

    Administration in

    se will be visiblee Enterprise Man

    e have develthe tree, the fedentials i.e.

    the login ans drop down

    as SYSDBA to

    10 Minutes

    in the tree hieraager).

    oped using Dllowing winlogin and p

    password juoption box a

    TEST database

    82

    chy of

    CA. Ifow willssword.

    t selectd click

  • 8/12/2019 Oracle 10 Mins p

    83/138

    83

    Now you would be able to expand the tree under TESTdatabase. If you click Tablespaces under Storage item, you

    would be able to see the list of all the tablespaces andcorresponding data files that DBCA has developed for you. Letme give you a closer look to this window in the followingpicture. We will learn in depth about OEM and other good stufflater in this book.

    Figure 46: Expand the Tablespaces item in the tree to see the list oftablespaces within TEST database.

  • 8/12/2019 Oracle 10 Mins p

    84/138

    Oracle 9i Database Administration in 10 Minutes

    84

  • 8/12/2019 Oracle 10 Mins p

    85/138

    85

    MMiinnuuttee77::

    Enabling OtherComputers to

    Access OracleDatabase Server

  • 8/12/2019 Oracle 10 Mins p

    86/138

    Oracle 9i Database Administration in 10 Minutes

    86

  • 8/12/2019 Oracle 10 Mins p

    87/138

    The purposenvironment

    even world cmachine. Estyou have toand client sid

    Figure 47: Or

    Oracle Netinstallation ohave to selUniversal Inlistener.ora fdevelopmentOracle Net

    process, it lithe listener

    of makingwhere users

    an access theablishing ano is to config

    e.

    cle Net needs to

    gets installef Oracle Serct the optiotaller. Thele on the serof listener.oror the server.

    tens to the usprocess is t

    Oracle netrom all over

    database as iracle networure Oracle Ne

    e configured onclient.

    on the seer software b of client iay it worksver then wefile is actuallOnce we ha

    ers connectio bequeath t

    ork is tohe city or co

    its residingk is very simt layer on bot

    server as well as

    ver at thet for each clstallation in

    s first we crtart the listethe configure started the

    requests. The connection

    87

    ave anntry or

    on theirple. Allserver

    on each

    ime ofient weOracleate theer. Theation oflistener

    job ofto the

  • 8/12/2019 Oracle 10 Mins p

    88/138

    dispatcher inserver mode

    running undeOn the clienCreating tnsOracle Netcontains theconnect to O

    Figure 48: Owherea

    Oracle 9i Database

    case the Orr to the dedic

    dedicated m

    t side, we haames.ora filn the client

    resolution ofacle server.

    racle Instance kns Oracle Net deal

    Administration in

    cle server isated server pr

    de.

    ve to createis actually

    side. tnsnamservice nam

    ows how to speas with different n

    10 Minutes

    unning undecess in case

    he tnsnames.the configurs.ora is not that we wil

    with Oracle Neetwork protocols

    88

    sharedracle is

    ra file.tion ofing butl use to

    layer.

  • 8/12/2019 Oracle 10 Mins p

    89/138

    Figure 49: Ac

    Creating

    Step 1:

    The next stethis single

    tnsnames.oranetmgr comthe same soPrograms >

    cessing Oracle Nompletely indep

    istener

    would be totool we c

    files. ONM cand under

    tware can beracle.

    et Manager (ONndent of Operati

    start the Oran create b

    n be accesseRACLE_HOfound in wi

    ): Java based png System.

    le Net Mangth listener.o

    under Unix uE/bin direct

    dow under S

    89

    ogram,

    r. Withra and

    sing thery and

    tart>All

  • 8/12/2019 Oracle 10 Mins p

    90/138

    Figure 5

    Figure

    Oracle 9i Database

    0: Expanding L

    51: Oracle Net

    Administration in

    isteners shows

    anager showing

    10 Minutes

    o listener proces

    o Service Name

    90

    s.

    .

  • 8/12/2019 Oracle 10 Mins p

    91/138

    Once you exin the tree, y

    moreover the

    Figure 52: Clic

    Fig

    and the thing. There

    es.ora file.

    nd then the + iprocess.

    e name to the lis

    nd itemsrunning

    listener

  • 8/12/2019 Oracle 10 Mins p

    92/138

    Oracle 9i Database Administration in 10 Minutes

    92

    Select the Listener item from the tree in ONM and then clickthe + sign shown in the slide to create the listener. In the

    popped up window write the Listener Name. If you use thedefault name of the listener than the Oracle Instance registersitself with the listener dynamically and its called dynamicservice registration. Thats why we are sticking with the defaultname of the listener i.e. LISTENER. Not only listener namehas to be default but we have to use default protocol i.e.TCP/IP and default port i.e. 1521 or 1520 if we want to go withdynamic service registration.

  • 8/12/2019 Oracle 10 Mins p

    93/138

    Step 2:

    After selectithe OK buttAddresses. Sbutton on thOracle addsmachine runname resolutTCP/IP) and

    Figure 54:

    g listener nan. Once thelect the listenright pane othe defaulting Oracle Son service liort (i.e. 1521

    Add Address

    e as LISTENListener getser name and cONM. Oncealues for Herver or its Ie DNS is av.

    f newly added li

    ER you havecreated thenlick Add Adyou click thist (i.e. nameP address inilable), Proto

    tener process to

    93

    to clickadd theressesbuttonof the

    case nocol (i.e.

    ree.

  • 8/12/2019 Oracle 10 Mins p

    94/138

    Fig

    Oracle 9i Database

    re 55: Listener

    Administration in

    location for liste

    10 Minutes

    ning requests.

    94

  • 8/12/2019 Oracle 10 Mins p

    95/138

    Step 3:

    After you hdrop down mthe option D

    Figure 56: Lisclient to

    ve finalizedenu from theatabase Servi

    ener process willhe database add

    ost, Protocotop as showne.

    bequeath the cod using the butt

    95

    lect thed select

    rom then.

  • 8/12/2019 Oracle 10 Mins p

    96/138

    After selecticlick the A

    (Oracle Net

    Figure 57: Ente

    Now provideour case it iOracle Homcase. The in

    should be eOnce done dwhen you sa

    Oracle 9i Database

    g Databased Database

    ork Manger).

    Global Databas

    and finally SID

    the Databasetest.takveen.

    directory anormation yo

    actly the sanot forget te, ONM creat

    Administration in

    erives frombutton on th

    Name, Databas

    (name of Oracle

    ame i.e. Glo Moreover prd the name o provide in t

    e when yousave the cones or updates t

    10 Minutes

    the drop do right pane o

    Home Director

    nstance).

    al Databaseovide the locf SID i.e. tesese three te

    created the dfiguration as ihe listener.or

    96

    n menuf ONM

    location

    ame. Intion ofin our

    t boxes

    atabase.ts onlyfile.

  • 8/12/2019 Oracle 10 Mins p

    97/138

    Figure

    Step 4:

    Next thing isstarted usingenvironment.clicking

    Start>SettingAnd then sepressing the

    8: Save network

    to start the llsnrctl utilityYou can als

    s>Control Pan

    ecting the liplay on the t

    configuration an

    stener. The liboth in Wind run in win

    el>Services

    tener serviceol bar of serv

    start the Listen

    stener processows Server aows environ

    for Oracle aices console.

    97

    r.

    can bed Unixent by

    d then

  • 8/12/2019 Oracle 10 Mins p

    98/138

    Oracle 9i Database Administration in 10 Minutes

    98

    Figure 59: In Windows Server 2003 environment, the listener process can

    be activated under the Services window.

    C:\>lsnrctl start

    This command will start the listener whereas if you replacestart with stop you can stop the listener. To check thestatus of the listener use the following command.

    C:\>lsnrctl status

  • 8/12/2019 Oracle 10 Mins p

    99/138

    Configuri

    Step 1:

    Since now wlistener procService Namshort & easythat helps clService Na

    click the +

    Figure 60: Clic

    g Oracle N

    e have createss. Next thion this machto rememberent applicatioing item in t

    sign to add th

    the Service Naa new ser

    t on client-

    the listener.og we will doine. Net Serviname for a l

    ns to connecthe tree on the

    Net Service

    me item and theice name to the t

    side

    ra file and st is to createe Name is bang set of par

    to server. Seleft pane of O

    ame.

    n click the + icree.

    99

    rted thethe Netically aameterslect theM and

    on to add

  • 8/12/2019 Oracle 10 Mins p

    100/138

    Figure 61: etOracle

    In the poppasim. Nomeans on thi

    Oracle 9i Database

    Service Name widatabase we wan

    d up windo we are goinmachine by

    Administration in

    ll be the nick nato connect to. It

    write theg to definelicking Next

    10 Minutes

    e on this machican be any name

    et Servicehat the wordbutton.

    100

    e for the.

    ame asasim

  • 8/12/2019 Oracle 10 Mins p

    101/138

    Step 2:

    Select protocdown the hosother words t

    Figure 62: Sel

    ol as TCP/IPt name of thee listeners

    ect the networkServe

    nd click Neachine runniachine name.

    rotocol used to cfrom this client.

    t button. Thg Oracle Ser

    ommunicate wit

    101

    n writeer or in

    Oracle

  • 8/12/2019 Oracle 10 Mins p

    102/138

    Figure 63: Netparameters.

    Remember t

    the listenerdispatcher inin a dedicatbequeathed ttakes place bwithout any lon which lisHost and clic

    Oracle 9i Database

    Service Name isost Name will b

    running Or

    at client appli

    and listenera shared servd server moo the Oracleetween Oraclistener procesener is listenNext.

    Administration in

    an alias given tothe name of the

    acle Database Se

    cations send a

    bequeath thr mode or dee. After theInstance the Instance an

    s involvementing for conne

    10 Minutes

    detailed list of comachine on the nver.

    connection re

    connectionicated serverconnection h the commu the connecte. Write downction requests

    102

    nnectionetwork

    quest to

    to theprocessas been

    icationd clientthe porton the

  • 8/12/2019 Oracle 10 Mins p

    103/138

    Step 3:

    Service Namglobal databto bequeath tthe Next b

    Figure 64: ServServer. Lis

    The next potest the connName asim

    over here isse name of Ohe connectiontton.

    ice name will beener process wilconnection to th

    ped up windection and seis resolving p

    he parameteracle databasein our case it

    Global Databasebe requested byis Oracle Databa

    w will givethat your c

    roperly using

    here you spyou what theis test.takvee

    Name of Oracleclient to bequeate Server.

    ou the opportnfigured Netnsname.ora.

    103

    cify thelistener. Click

    atabasethe

    nity toService

  • 8/12/2019 Oracle 10 Mins p

    104/138

    Step 4:

    Once you cManger) wiconnection. Iif you wouldtoo. Upon sNetwork Coor updated oFile and th

    Figure 65: Serv

    Oracle 9i Database

    ick the Tesl use thef you dont h like to use successful cofiguration. Tly when youn Save Net

    ce Name & Netthe Glob

    Administration in

    t button Oscott/tigerve this accouome other acnection done tnsnames.orsave the conork Configur

    ervice Name isal Database Nam

    10 Minutes

    M (Oracleccount to tt in your datount you can

    forget to sa file will getiguration bytion.

    ot same. Service.

    104

    etworkest thebase ordo that

    ave thecreated

    clicking

    Name is

  • 8/12/2019 Oracle 10 Mins p

    105/138

    Figure 66: Savtnsnames.ora fi

    The defa%ORACLE_

    2003/2000/N$ORACLE_Net Serviceeach of theOracles clieIts very impName on on

    the Net Serv

    Network Confile containing Ne

    Oracle

    lt locationHOME%\net

    OME/networame or tnsnachines frot applications

    rtant point tomachine (e.g

    ce Name on t

    uration. OracleService Name (erver connectio

    of tnsnork\admin

    platefork/admin undames.ora file

    where youlike SQL*Plu

    note over her. asim) nee

    he other mac

    et Manager willlias) resolution t.

    ames.ora fn Windows

    r Unix envirhas to be creant to launc

    s, OEM etc.

    e that the Nets not to be si

    ine (e.g. lets

    105

    generatemake a

    le isServer

    andnment.ted forany of

    Serviceilar to

    suppose

  • 8/12/2019 Oracle 10 Mins p

    106/138

    Oracle 9i Database Administration in 10 Minutes

    106

    cow) although both Net Service Names will resolves to thesame Oracle database (e.g. test.takveen).

    You can connect to or manage multiple databases using OEMremotely. All you need to do is to create the Net Service Namefor each of the databases you want to manage.

  • 8/12/2019 Oracle 10 Mins p

    107/138

    107

    MMiinnuuttee88::

    Oracle EnterpriseManager A SQL-Less DatabaseManagement

    Environment

  • 8/12/2019 Oracle 10 Mins p

    108/138

  • 8/12/2019 Oracle 10 Mins p

    109/138

    Figure 67: Or

    Oracle Enteapplication.independentthrough Uni2003/XP envStart > All Progra

    Where as infollowing co$ oemapp coAs explainewhen asked

    There is no nbe the exter

    cle Enterprise Mcompletely ope

    prise ManagAs its javaf OS. The o and Windoronment you

    ms > Oracle > Ent

    Unix enviromand at the

    sole

    before, conto provide lo

    eed to specifyally authentic

    anager (OEM) isating system ind

    r (OEM) isbased thats

    ly differencews platform.an invoke in

    rprise Manger Co

    ment it canS command

    ect to the dgin, passwor

    the login andated OSDBA

    a Java based apppendent.

    a java basewhy its cois how you iIn Windowsy clicking

    sole

    e invoked urompt.

    atabase as S and privileg

    assword as itor OSOPER

    109

    lication,

    clientpletelyvoke itServer

    ing the

    SDBAe level.

    s wouldccount.

  • 8/12/2019 Oracle 10 Mins p

    110/138

    Once you geable to expa

    Expand the you select ththe list of alland related i

    Figure 68: oclick solves th

    We can creattablespace m

    Oracle 9i Database

    connected tnd the tree o

    Storage itemTablespacesthe Tablespa

    formation.

    need to remembproblem and po

    you

    e new tablespentioned in t

    Administration in

    the Oracle dn the left pa

    ; you will seeitem, on the rces along wit

    r SQL statementpped up menu prere looking for.

    ace by right ce list and the

    10 Minutes

    tabase youe of OEM

    Tablespacesght pane youassociated d

    s. Most of the tiovides you the c

    icking any onselecting th

    110

    ould beindow.

    . Whenwill seeta files

    e right-mmand

    e of theoption

  • 8/12/2019 Oracle 10 Mins p

    111/138

    Create above. Once

    Tablespace

    Figur

    in the poppewe click the

    indow will po

    69: Create the n

    up windowCreate o

    p up as shown

    ew tablespace us

    s shown in tption then th

    in the next sli

    ng this window.

    111

    e slideCreate

    de.

  • 8/12/2019 Oracle 10 Mins p

    112/138

    Figure 70: StorDictionary mextend autom

    In this Createa name and

    can also makthe tablespac

    Oracle 9i Database

    ge tab will givesnaged extents.tically in case it

    Tablespaceou can have

    the tablespae with OFFLI

    Administration in

    you the option tou can also selecuns out of spacellocation.

    indow you cas many data

    e ONLINE/ONE option th

    10 Minutes

    select locally mt to make the tabby selecting Au

    give your tailes as you li

    FLINE. If yon the tablesp

    112

    naged orlespacetomatic

    lespacee. You

    u createce will

  • 8/12/2019 Oracle 10 Mins p

    113/138

    not be availait ONLINE.

    Locally MaExtents manand 10g.

    Figure 71: M

    Under the files associattablespaces.tablespace.

    le to users yoUnder the sto

    aged othergement. Its

    anage data files

    atafiles itemed to the dat

    e can create

    u will grant arage tab mak

    ise you woulnice feature

    sing Oracle Ente

    you will seebase along wa new data fi

    cess unless y sure its sel

    have to takeavailable in O

    rprise Manager (

    the list of allith the corresle and assign

    113

    u makected as

    care ofracle 9i

    EM).

    he dataonding

    it to the

  • 8/12/2019 Oracle 10 Mins p

    114/138

    Figure 72:

    If we expandcan see all tcan add newlocation aftemember info

    Oracle 9i Database

    anage redo logMa

    the Redo Loe redo log gembers in al

    selecting thmation on the

    Administration in

    files & groups unager (OEM).

    Groups iteoups and assthe redo loggroup numb

    right pane of

    10 Minutes

    ing Oracle Enter

    under Storaciated membroups as well

    er and thenEM window

    114

    rise

    ge youers. Weas theirdd new.

  • 8/12/2019 Oracle 10 Mins p

    115/138

    Figure 73: Co

    Using OEM,Storage but ythe Users i

    plete users man

    managementou can do coem under the

    agement using O(OEM).

    f database isplete manageSecurity.

    acle Enterprise

    ot just limiteent of users

    115

    anager

    totilizing

  • 8/12/2019 Oracle 10 Mins p

    116/138

    Figure 74: Creuser and select t

    Oracle Insta

    We can alsoselecting thechanging val

    Oracle 9i Database

    ate User user whe option Creatce management

    manage theConfiguratioes in the righ

    Administration in

    indow will pop u as shown ising Oracle Ent

    racle Instanc item on thepane.

    10 Minutes

    once you rightthe slide above.rprise Manger (

    related stuffleft pane of O

    116

    click any

    ompleteEM).

    by firstEM and

  • 8/12/2019 Oracle 10 Mins p

    117/138

    Figure 75: Me

    ory tab gives yoarchite

    full control oveture components

    r Oracle Instance.

    117

    memory

  • 8/12/2019 Oracle 10 Mins p

    118/138

    Figure 76: Da

    If you wantNOARCHIVRecovery t

    The RecovInstance

    Oracle 9i Database

    abase recovery iEnterpri

    to run the daELOG modb as shown i

    ry tab canode and the

    Administration in

    ssues can be mane Manager (OE

    tabase is AR you canthe slide.

    e accessed bn selection

    10 Minutes

    aged easily using).

    HIVELOGcontrol that

    first expanConfiguratio

    118

    Oracle

    ode orusing

    ing the item

  • 8/12/2019 Oracle 10 Mins p

    119/138

    119

    underneath it. If you check the box Archive Log Mode thenthe Archiver process will get alive and will start archiving

    your redo log files. You can also specify Archive LogDestination in the same Recovery tab at the bottom.

  • 8/12/2019 Oracle 10 Mins p

    120/138

    Oracle 9i Database Administration in 10 Minutes

    120

  • 8/12/2019 Oracle 10 Mins p

    121/138

    121

    MMiinnuuttee99::

    Oracle DatabaseBackup &

    Recovery SimpleTechnique

  • 8/12/2019 Oracle 10 Mins p

    122/138

    Oracle 9i Database Administration in 10 Minutes

    122

  • 8/12/2019 Oracle 10 Mins p

    123/138

    123

    User-Managed Offline Backup

    The other names given to this kind of backup areClosed/Cold/Consistent Database backup. No recovery isneeded in this kind of backup during the restore process.

    Step 1:

    Shut down the database

    Connect to database as SYSDBA and then use theSHUTDOWN statement with NORMAL, IMMEDIATE orTRANSACTIONAL clause.

    C:\> sqlplus /nolog

    SQL>connect / as sysdba

    SQL> SHUTDOWN NORMAL;

    Remember that if there is any single user connected with thedatabase and you have used the NORMAL clause with theSHUTDOWN statement then database will never shutdownunless the user closes the session.

    Step 2:

    Backup all the data files

    Once the database gets completely shutdown backup all thedata files associated with the database at the operating systemlevel or in other worlds using operating system commands e.g.copy in Windows and cp in case of Unix.

  • 8/12/2019 Oracle 10 Mins p

    124/138

    Oracle 9i Database Administration in 10 Minutes

    124

    Step 3:

    Backup Parameter File, Redo Log Files and Archived RedoLog Files

    Backup all these files too using operating system command.Its highly recommended and provides greater fault tolerance incase of database failures.

    Step 4:

    Startup Oracle Database with MOUNT option

    Start the oracle instance and mount the database but dontopen.

    C:\>sqlplus /nolog

    SQL>connect / as sysdba

    SQL>startup mount;

    Step 5:

    Backup the Control File

    Control file can be backed up using the following statement

    and at the desired location.

    ALTER DATABASE BACKUP CONTROLFILE TO c:\staging\ctl.bak;

    The backup created in this fashion will be the binary copy ofthe control file. We can also take the backup of control file,which will be in text format in the following manner.

    ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

  • 8/12/2019 Oracle 10 Mins p

    125/138

    125

    As a result of this statement the text version of control file willget copied to the location/folder specified in

    USER_DUMP_DEST init.ora parameter.

    Step 6:

    Open the database

    Now you have full database backup or in other words WholeDatabase Backup. Its time to make the database available tothe users you executing the following statement.

    ALTER DATABASE OPEN;

    This completes our User-Managed Offline/Cold DatabaseBackup. Lets see now how we can perform User-ManagedOnline/Hot Database Backup.

    User-Managed Complete Recovery is done in two different

    ways and it all depends on the mode in which you are runningthe Oracle server. You can run Oracle server either inARCHIVELOG mode or NOARCHIVELOG mode. The waywe do the recovery in NOARCHIVELOG mode is differentfrom the way we do recovery in ARCHIVELOG mode. Letshave a look on each procedure as follows.

  • 8/12/2019 Oracle 10 Mins p

    126/138

    Oracle 9i Database Administration in 10 Minutes

    126

    User-Managed Complete Recovery in

    NOARCHIVELOG Mode

    In NOARCHIVELOG mode the recovery is very simple. Allyou have to do is to restore the database files from your backupto the original location and start the database.

    Lets suppose one of your data file got corrupted. The time tryto start the Oracle Instance, it will give you an error. In thiscase shutdown the database. Restore all the data files; redo log

    files and control file back to their original location from yourlast whole/complete cold backup.

    Then start the Oracle database again by first running SQL andthen connecting as SYSDBA. This time you will not get anyerror.

    User-Managed Complete Recovery inARCHIVELOG Mode

    Lets suppose one of your data file got corrupted/deleted. Thetime you try to start the Oracle Instance, it will give you anerror with the name and location of the data files. If the Oracleserver is up and running and you dont want to shut it downthen follow the following steps.

    Step 1:

    Take the corrupted data file offline

    Use the following SQL statement to take the corrupted/deleteddata file offline.

    ALTER DATABASE DATAFILE c:\oracle\oradata\test\users01.dbfOFFLINE;

  • 8/12/2019 Oracle 10 Mins p

    127/138

    127

    Step 2:

    Restore the corrupted data file

    Restore the corrupted data file by copy it from the backed uplocation and pasting it to the original location at the operatingsystem level or in other words using operating systemscommands like copy in windows or cp in Unix/Linux.

    Step 3:

    Recover Data File

    Recover the restored data file using the RECOVERDATAFILE statement. Then apply all the available Redo Logfiles by pressing Enter button on the keyboard wheneverasked.

    C:\> sqlplus /nolog

    SQL>connect / as sysdba

    SQL>recover datafile c:\oracle\oradata\test\users01.dbf

    This will complete the recovery process and you will realizethat no data will get lost i.e. everything that you entered orchanged after the last whole database backup will get

    recovered by Oracle by applying all the redo log files.

  • 8/12/2019 Oracle 10 Mins p

    128/138

    Oracle 9i Database Administration in 10 Minutes

    128

    Difference between Recovery in ARCHIVELOG

    mode & NOARCHIVELOG mode

    In NOARCHIVELOG mode, the transactions that gotprocessed after the last complete backup, will get lost where asin ARCHIVELOG mode no data will get lost i.e. everythingthat you entered or changed after the last whole databasebackup will get recovered by Oracle by applying all the redolog files including the ones got archived by the Archiverprocess.

  • 8/12/2019 Oracle 10 Mins p

    129/138

    129

    MMiinnuuttee1100::

    OraclePerformance

    Tuning

  • 8/12/2019 Oracle 10 Mins p

    130/138

    Oracle 9i Database Administration in 10 Minutes

    130

  • 8/12/2019 Oracle 10 Mins p

    131/138

    131

    Oracle Performance Tuning, the topic is not that scary as itsounds. Actually its very simple if you understand the

    performance tuning concept the bigger picture or in otherwords birds eye view.

    Performance tuning is nothing but the collection of statisticsregarding the current status of the system and then changesystem values based on the statistics to enhance theperformance. In other words performance tuning is

    Collection of system statistics Changing system based on the statistics

    Now we have to look into what are different sources that canprovide us the information regarding the current health of thesystem. Although there are a lot of sources. The simplesources, which can provide us the Oracle system information,are alert log file, trace files, dynamic performance view, datadictionary views etc. Lets start learning about each of thesesources one by one.

    Alert Log File

    The location of Alert log file is described byBACKGROUND_DUMP_DEST initialization parameter. ForOracle systems that follow OFA (Oracle Flexible Architecture)or in other words standard directory architecture of Oraclefiles, the location of Alter Log file will be as follows.

    In Windows Server 2003/NT/XP,%ORACLE_BASE%\admin\SID\bdump whereas in Unix itwould be $ORACLE_BASE/admin/SID/bdump. Where SID isthe name of the Oracle Instance. You might have noticed thatin Unix environment we use forward slash (/) whereas inWindows we user backward slash (\).

  • 8/12/2019 Oracle 10 Mins p

    132/138

    Oracle 9i Database Administration in 10 Minutes

    132

    Oracle writes all the error messages and other alerts to this filewhenever that message occurs during it normal operations.

    Background Process, Event & User Trace Files

    Oracle trace files contain information pertaining to certainevent that happens in the regular operation of Oracle. Thelocation of these trace files is described byBACKGROUND_DUMP_DEST initialization parameter. For

    Oracle systems that follow OFA (Oracle Flexible Architecture)or in other words standard directory architecture of Oraclefiles, the location of these trace files will be as follows.

    In Windows Server 2003/NT/XP,%ORACLE_BASE%\admin\SID\bdump whereas in Unix itwould be $ORACLE_BASE/admin/SID/bdump. Where SID isthe name of the Oracle Instance.

    All trace files have file extension of .trc no matter whether it isBackground process, Event or User trace file. In Windowsenvironment, the background processes will generate thefollowing files.

    Process Monitor (PMON): sidPMON.trcSystem Monitor (SMON): sidSMON.trcDatabase Writer (DBW0): sidDBW0.trcArchive Process (ARC0): sidARC0.trcLog Writer (LGWR): sidLGWR.tc

    If we have two Database Writer processes (DBW0, DBW1)then you may see one more trace file sidDBW1.trc besidessidDBWR0.trc, this applies to Archiver Process too. Similarlyfor Checkpoint Process (CKPT) it is sidCKPT.trc whereas in

    Unix environment the trace files pertaining to each of theseprocesses would include the name of that process in the file

  • 8/12/2019 Oracle 10 Mins p

    133/138

    133

    names e.g. for PMON the trace file name would bePMON_nnnn.trc etc.

    Remember that user trace file will get generated when there isan error in users server process which contains the detailsregarding that error. We can limit the size of User trace file byspecifying the MAX_DUMP_FILE_SIZE init.ora parametere.g. specifying the value of this parameter as follows in init.orafile will the user trace file size to 20MB.

    MAX_DUMP_FILE_SIZE=20M

    Dynamic Performance Views (V$) & Data

    Dictionary Views

    Dynamic Performance Views or in other words all the viewsthat start with V$ and Data Dictionary View are views created

    on Oracle base tables. These tables are Oracle Internal tablesand are utilized by Oracle. They reside in the SYSTEMtablespace and if you remember SYS is the owner of thesetables as these tables get created when we logged in to Oracleas SYS and we ran two scripts which resulted in these Oraclebase tables and views.

    Dynamic Performance Views as the name says are dynamic innature i.e. data inside these tables keeps changing and itdepends on the current state of Oracle system. Some of thevery important Dynamic Performance Views along with thebrief description of the stuff they contain are provided below.

    V$SGASTAT

    Contains information about the size of SGA (System GlobalArea) and each of its major components.

    V$SESSTAT

  • 8/12/2019 Oracle 10 Mins p

    134/138

    Oracle 9i Database Administration in 10 Minutes

    134

    Contains the statistics information regarding the each

    connected session or in other words connected user.

    V$SESSION

    Contains the current connection information of each session orin other words each connected user.

    Whereas Data Dictionary Views are static in nature and thevalues inside these tables change only when you change thestructure of the database. Some of the very important DataDictionary Views along with the brief description of the stuffthey contain are provided below.

    DBA_TABLES

    Contains information about the tables within the database, theirrow and block information.

    DBA_DATA_FILES

    Contains the information about all the data files within thedatabase, their names, size etc.

  • 8/12/2019 Oracle 10 Mins p

    135/138

    135

    IINNDDEEXX

    110g 1131521 93

    AAlert log 131All Initialization Parameters 71ARC0 132Archive Log Destination 119Archive Log Mode 68Archived Redo Log Files 41, 44Archived Redo Log Files: 42ARCHIVELOG 118, 128Archiver 119Archiver Process 35ARCn 29, 35asim 100

    Bbackground processes 25Background processes 25BACKGROUND_DUMP_DEST

    131, 132

    CCKPT 30, 132

    clone database development 77Configuration 116Control File 41

    DData Dictionary Cache 28data dictionary views 131Data Dictionary Views 134Data Files 41Data Management Genie 19Database Buffer Cache 27, 28Database Configuration Assistant

    59Database Service 95Datafiles 74DB Blocks 43

    DB Sizing 68DB_BLOCK_SIZE 43DB_NAME 70DBA_DATA_FILES 134DBA_TABLES 134dbca 61DBCA 59DBW1 132DBWn 29Dedicated Server 66dedicated server mode 36

    Dedicated Server mode 35DEFAULT 28Dirty Buffers 28Dispatcher 37dispatcher process 37Dispatcher process 30, 35, 37Dnnn 30dynamic service registration 92

    EEnterprise Edition 55

  • 8