summary oracle

Upload: roel-donker

Post on 10-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Summary Oracle

    1/39

    Database controlGraphical tool(java) to manage one database, on the server. If here are multipledatabases created on the same oracle_home, it is possible to reach them usingdifferent ports. All communication is done over HTTPS. To start the databasecontrol use emctl utility. Environment variables which needs to be set are: Path,Oracle_home and oracle_sid(sid = name of instance). Three checks on certificate:1. the certificate is issued by a certificate authority that your browser trusts.2. valid dates used in certificate3. URL is the same as host

    Monitors:1. how long recovery if instance fails

    Application server controlGraphical tool to manage (group of) instances, on the server, middle tier

    Grid ControlHolistic view of environment, manage targets(HTTP or HTTPS)Oracle enterprise manager (OEM)

    Everything what can be done with OEM can also be done with SQL

    Grid computingGrid computing performs a virtualization of distributed computing resourcesand allows for the automated allocating of resources as system demand changes.Each server is independent, yet ready to participate in a variety of processingrequests from many types of applications.

  • 8/8/2019 Summary Oracle

    2/39

    Supported languagesJava(3GL), PL/SQL(3GL) and SQL(set-oriented language)

    ConnectivityThick (oci), oracle aware driver, have oracle specific functionsThin, not aware of a database, so it can be deployed in a non oracle environment

    Oracle applicationsOracle forms developer builds applications that run on an Oracle ApplicationServer middle tier and display in a Java applet

    Oracle reports generating and formatting reports, restricted PDF or HTML

    XML publisher generating and formatting reports, restricted XML

    Oracle Discover generating reports without help of programmer whenconfigured correctly

    Oracle E-business suite (ERP)

    financialOracle collaboration suite servers for email, voicemail fax, file serving etc,

    Relation paradigmData is stored in two dimensional tables (entity, relation). Effective for OnlineTransaction processing(OLTP) and decision support systems(DSS)

    Normalization data1st remove repeating groups2nd remove columns from the table that are not dependent on the primary key3rd remove all columns that are interdependentDocumentation:

    1. Entity-relationship diagram, connection between tables

    Hierarchical structureData stored in one unit.

  • 8/8/2019 Summary Oracle

    3/39

    Data manipulation (DML) commandsSelect, insert, update, delete, merge

    Data definition (DDL) commandsCreate, alter, drop, rename, truncate, comment

    Data Control (DCL) commandsGrant, Revoke

    Transaction control (TCL) commandsCommit, rollback, savepoint

    DBA RoleSizing applications and hardware, oracle installation and maintenance, databasephysical design, monitoring and tuning performance, assisting developers withapplication design and sql tuning, backup, restore, recovery, user and securitymanagement.

    Oracle serverInstance memory structure and processes (background), created first, definedby parameter file. In windows an instance will be a service.

    Database Files on disk, opened second

  • 8/8/2019 Summary Oracle

    4/39

    DatafilesThere is no practical limit in oracle only physical

    Architecture

  • 8/8/2019 Summary Oracle

    5/39

    Single instance architecture

    Real Application Clusters (RAC)Multiple instances open one database, RAC gives amazing capabilities forperformance, fault tolerance and scalability. There is performance benefit by

    long-runing queries and large batch updates and NOT when a large number ofsmall transactions is executed(OLTP)

    StreamsStreams is a facility for capturing changes made to tables and applying them toremote copies of the tables. Streams can be bidirectional and can be used for faulttolerance.

    Data Guard

  • 8/8/2019 Summary Oracle

    6/39

    Oracle Data Guard ensures high availability, data protection, and disasterrecovery for enterprise data. Data Guard provides a comprehensive set of servicesthat create, maintain, manage, and monitor one or more standby databases toenable production Oracle databases to survive disasters and data corruptions. DataGuard maintains these standby databases as transactionally consistent copies of

    the production database. Data Guard can switch any standby database to theproduction role, minimizing the downtime associated with the outage. 2 standbyforms:

    1. physical exact copy of primary database, used for Fault tolerance

    2. logical possible with different data structures, used for query (databasedataware house)

    Memory structure

    1. Shared memory segments system global area (SGA), shared across allbackground and server processes). A system global area (SGA) is a group ofshared memory structures that contain data and control information for one Oracledatabase instance(SGA + oracle process(background))

    2. user session / process running locally on the user machine(user session/ userprocess), could be odbc driver, user process connects to server process.

    3. Server process and sessions connected to the program global area(PGA)

    and SGA and user. It takes care that sql code is executed. When dedicated serverthe each user process has his own server process. The PGA is used to processSQL statements and to hold logon and other session informationS, etc. See below for short summary

    Sort area Used for any sorts required by SQL processing

    Session information Includes user privileges

    Cursor state Indicates stage of SQL processing

  • 8/8/2019 Summary Oracle

    7/39

    Stack space Contains session variables

    All can be managed automatically.SGA contains the following data structures: Database buffer cache, log buffer,

    shared pool, large pool(optional), java pool(optional), stream pool(optional)

    Database buffer cache(SGA)

    The database buffer cache is the portion of the SGA that holds copies of datablocks read from datafiles. All user processes concurrently connected to theinstance share access to the database buffer cache. The database buffer cache andthe shared SQL cache are logically segmented into multiple sets. The first time anOracle user process requires a particular piece of data, it searches for the data inthe database buffer cache. If the process finds the data already in the cache (acache hit), it can read the data directly from memory. If the server or backgroundprocess cannot find the data in the cache (a cache miss), it must copy the datablock from a datafile on disk into a buffer in the cache before accessing the data.Accessing data through a cache hit is faster than data access through a cache miss.A buffer not the same as on the disk is called dirty (clean is the opposite). There isno correlation between the frequency of updates to a buffer and when it getswritten back to the datafiles. The size of the buffer is important, to small means alot of block access, to large means a slow initialization, the size can be adjusteddynamically.

    Extra info: The buffers in the cache are organized in two lists: the write list and

    the least recently used (LRU) list. The write list holds dirty buffers, whichcontain data that has been modified but has not yet been written to disk. The LRUlist holds free buffers, pinned buffers, and dirty buffers that have not yet beenmoved to the write list. Free buffers do not contain any useful data and areavailable for use. Pinned buffers are currently being accessed.

    Blocks

    Blocks have a static length unlike rows which have a variable length, so a rowmay use several blocks

    Log Buffer(SGA) / RedoChange vector. Here are the modifications (insert, update, delete, create, alterdrop) stored which are applied to the database. TheRedo log buffer is kept in memory till the log writer(LGWR) flushes (commit)the memory and writes it to disk. The log buffer is only a few megabytes andcannot be resized after initialization. In RAC each instance has its own log bufferand writer.

  • 8/8/2019 Summary Oracle

    8/39

    Shared pool(SGA)Consist of 4 pool components: library cache, data dictionary cache, PL/SQL areaand SQL query and PL/SQL function result. The pool size is dynamic, a to largepool size can have impact on the performance. Initial size several hundred Mb

    Library cache storing recently executed code in its parsed form(sql and pl/sql),slightest difference (lower instead of upper) means that the statement must beparsed again. The library cache includes the shared SQL areas, private SQL areas(user specific variables), PL/SQL procedures and packages, and control structuressuch as locks and library cache handles. Anonymous PL/SQL (not compiled code)is much slower than stored procedures (compiled code).

    Data Dictionary cache centralized repository of information about data such asmeaning, relationships to other data, entity, origin, usage, and format. Oracledatabases store information here about the logical and physical structure of thedatabase. The data dictionary contains information such as: user information, suchas user privileges, available tables, database files, other database objectsintegrity constraints defined for tables in the database,names and datatypes of all columns in database tables,information on space allocated and used for schema objects

    SQL Query result cache oracle stores result of such queries in memory, it issmart enough to know if a table is updated. Default disabled

    Large PoolDynamic size. The database administrator can configure an optional memory areacalled the large pool to provide large memory allocations for:1.Session memory for the shared server and the Oracle XA interface (used wheretransactions interact with more than one database)

    2. I/O server processes3. Oracle backup and restore operations4. response queue and request queueWhen the large pool is absence then everything will be loaded into memory.

    Java PoolDynamic size. Only needed when java-stored procedures are running in thedatabase, the heap space to instantiate the java objects will be stored in this pool.The java code itself is stored in the shared pool.

    Streams PoolDynamic size. Extract change vectors from the redo log and reconstructstatements.

    Processes

  • 8/8/2019 Summary Oracle

    9/39

    This section describes the two types of processes that run the Oracle databaseserver code (server processes and background processes).

    Oracle creates server processes to handle the requests of user processesconnected to the instance

    Instance background processes are started when an instance is started, there are 8important background processes.1. System monitor(SMON), mounting and opening a database. the system monitorprocess (SMON) performs recovery, if necessary, at instancestartup. SMON is also responsible for cleaning up temporary segments that are nolonger in use and for coalescing contiguous free extents within dictionarymanaged tablespaces. If any terminated transactions were skipped during instancerecovery because of file-read or offline errors, SMON recovers them when thetablespace or file is brought back online. SMON checks regularly to see whether it

    is needed. Other processes can call SMON if they detect a need for it.DATABASE BEHEER

    2. Process monitor(PMON) INSTANCE BEHEER(SGA, etc)Responsible for cleaning up the database buffer cache in freeing resources that theuser process was using. PMON checks if the status of the server processes andrestart them if necessary (stopped). If a sessions is terminated abnormally it willbe rolled back by the PMON3. Database writern(meerdere, DBWn)Writes dirty buffers to the datafiles, it only writes the buffers which needed to bewritten and only those. Only buffers which are cold(least recently used, so notused recently) and dirty will be written to disk if there are no free buffersanymore. Cause of written buffer to disk.

  • 8/8/2019 Summary Oracle

    10/39

    1. No free buffers, .2. to many dirty buffers,3. three second time-out4. a checkpoint.

    4. Log writer(LGWR)

    Writes the log buffer to disk (online redo log files). When:1. 1/3 full2. if DBWn is about to write dirty buffers3. if a session does a commit

    Contains changes for committed and uncommitted transactions.5. Checkpoint Process(CKPT)No longer has to signal full checkpoints (all dirty buffers will be written to disk),

    but it does have to keep track of where in the redo stream the incremental positionis and if necessary instruct the DBWn to write out some dirty buffers to push thecurrent position forward(RBA). Partial checkpoints occur automatically

    1. Every dirty block in thebuffer cache is written to the data files.That is, it synchronizes the datablocks in thebuffer cache with thedatafiles on disk.It's the DBWRthat writes all modified databaseblocks back to thedatafiles.

    2. The latest SCN is written (updated) into the datafile header.

    3. The latest SCN (System Change Number, this is a sequentialcounter, identifying precisely a moment in the database.) is also written tothe controlfiles.

    In two circumstances a full checkpoint:

    An orderly shutdown

    DBAs request

    6. Manageability monitor(MMON)MMON gathers a snapshot and launches the ADDM every hour. ADDM makesobservations and recommendations regarding performance using two snapshots.Capturing statistics value for SQL objects which have been changed7. Manageability monitor light(MMNL)Performs frequent and light-weight manageability-related tasks, such as session

    history capture8. Memory Manager(MMAN)Observe the demand of PGA an SGA memory and allocates it.9. Archivern(meerdere, ARCn)The LGWR writes the online redo log files and the archiver reads them, no otherprocess touches them. ARC moves redo information from redo log file to archivelog destination10. Recoverer process(RECO)

    http://www.adp-gmbh.ch/ora/concepts/cache.htmlhttp://www.adp-gmbh.ch/ora/concepts/datafiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/datafiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/cache.htmlhttp://www.adp-gmbh.ch/ora/concepts/datafiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/processes/dbwr.htmlhttp://www.adp-gmbh.ch/ora/concepts/scn.htmlhttp://www.adp-gmbh.ch/ora/concepts/datafiles.html#datafile_headerhttp://www.adp-gmbh.ch/ora/concepts/controlfiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/controlfiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/datafiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/cache.htmlhttp://www.adp-gmbh.ch/ora/concepts/datafiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/processes/dbwr.htmlhttp://www.adp-gmbh.ch/ora/concepts/scn.htmlhttp://www.adp-gmbh.ch/ora/concepts/datafiles.html#datafile_headerhttp://www.adp-gmbh.ch/ora/concepts/controlfiles.htmlhttp://www.adp-gmbh.ch/ora/concepts/cache.html
  • 8/8/2019 Summary Oracle

    11/39

    A distributed transaction is a transaction that involves updates to two or moredatabases. Is responsible for rollback.

    Database filesControl file

    Needed to make connection between instance and database.The database control file is a small binary file necessary for the database tostart and operate successfully. A control file is updated continuously byOracle during database use, so it must be available for writing wheneverthe database is open. If for some reason the control file is not accessible,then the database cannot function properly Online redo log files datafiles.If control file is damaged then database crashes, the control file can bereconfigured when the database is in a nomount mode.

    location of datafiles

    location of redo logRedo log files

    Two types: online redo log files and archive log files. Every database must

    have at least two online redo log file groups to function and each groupshould have at least two members for safety. An online redo log group is agroup of (possibly one) online redo log files. Each of these files in the groups iscalled an online redo log member of the group. Only one group at a time isactive.The purpose of having multiple members in a group is to ensure that if a redolog file becomes unusable another file of the unusable file's redo log group canbe used instead. The database will not crash if a member of redo group is

    damaged or being reconfigured. A log switch occurs when one online redo

    http://www.adp-gmbh.ch/ora/concepts/online_redo_logs.htmlhttp://www.adp-gmbh.ch/ora/concepts/online_redo_logs.html
  • 8/8/2019 Summary Oracle

    12/39

    log has been filled and the next online redo log is going to be filled. A logswitch always triggers a checkpoint. Two modes when switch

    archivelog mode ensures no online redo log file is notoverwritten till it has been archived. Archiver process launchautomatically after log switch.

    noarchivelog mode (default) online files are overwrittenbefore copy is made. The database isnt corrupt after crash butyou lose data. If you want to switch to archivelog you need todo a clean shutdown and change it in the mount mode.

    DatafilesServer processes reads from the datafiles and dbwn writes to

    datafiles. Two datafiles required: system and sysaux. A datafile consistsof multiple system blocks, they are static.

    Database structure

    1. A tablespace contains multiple segments(table), a tablespace can be stored inmultiple physical datafiles

    2. A single data segment in an Oracle database holds all of the data for one of thefollowing:

    A table that is not partitioned or clusteredA partition of a partitioned tableA cluster of tables

    http://www.adp-gmbh.ch/ora/concepts/online_redo_logs.htmlhttp://www.adp-gmbh.ch/ora/concepts/checkpoint.htmlhttp://www.adp-gmbh.ch/ora/concepts/checkpoint.htmlhttp://www.adp-gmbh.ch/ora/concepts/online_redo_logs.htmlhttp://www.adp-gmbh.ch/ora/concepts/checkpoint.html
  • 8/8/2019 Summary Oracle

    13/39

  • 8/8/2019 Summary Oracle

    14/39

    Dictionary tables to know

    DATA_FILES physical database files(dba )

    TABLESPACES

    describes all tablespaces in database (dba, User)USERS all users of database(dba)

    TEMP_FILES describes all temporary files in the database(dba )

    V$TEMPFILE displays tempfile information.

    V$databasedisplays information about the database from thecontrol file.

    V$datafileThis view contains datafile information from thecontrol file

    V$ transaction segment which has been assigned to transaction

    Oracle Universal InstallerWritten in Java and is used to install oracle parts, run it with setup.exeAn oracle home is the location of the oracle product installer.Central to the OUI in the inventory(file or windows registry), the inventory stores details(location, version,patches) about all oracle products installed. The OUI uses thisinventory. When the OUI is started the first time then it will be createdPrerequisite test:

  • 8/8/2019 Summary Oracle

    15/39

    Graphics device > 256 colorsProduct.xml file available

    Hack the prerequisite test:Edit oraparam.iniRun OUI with flag that it skips the tests

    Run OUI and during run tell to ignore errors. -ignoresysprereqsDisplay env. variable needs to be set. Can install on regular file systems and clustered filesystem.

    DBCAis a utility used for creating, configuring and removing Oracle Databases. One can setuptemplates to automate and standardise the creation of new databases or generate thescripts required to create a database later. can be launched by OUI, updates via DBUA

    The display, oracle_base, Oracle_home(oracle_base + prodcut/11.1.0/db_1),path(oracle_home + bin directory) and ld_library_path(oracle_home + lib) environmentvariable needs to be set.

    SQL plusCommand Tool: connect with database and execute sql codeIs not shipped with with 11g. env. Variables to be set:Oracle_home

    Path bin directory

    LD_Library_path lib

    SQL developerGraphical java tool (Requires JRE) for connect an oracle database. Is a stand aloneapplication so it doesnt need to be installed with the OUI, it is a zip file what needs to be

    unpacked.Oracle enterprise manager (database control)Tool to configure database. Monitoring capability and real-time information(alerts,activity, resource usage)

    Other admin toolsOracle net manager configure oracle network environment, most of the work can alsobe done by database control.Data Loading, transfer data between databases

    export and import(old) these tools generates files with ddl and dml commands.

    Datapump can read only files generated with datapump

    Sql reader can read also files from third parties

    Backup utilities you can use operating system backups but the preferred way is to useRMAN(recovery manager) . If you want to backup the entire environment then use oraclesecure backup

    Required hardware1 GB ram1.5 gb swap

    http://www.orafaq.com/wiki/Oracle_Databasehttp://www.orafaq.com/wiki/Oracle_Database
  • 8/8/2019 Summary Oracle

    16/39

    400 mb temp1.5 tot 3.5 gb for oracle home1 ghz CPU

    Optimal flexible architecture (OFA)OFA is designed as a file system directory structure that should make maintainingmultiple versions of multiple oracle products straightforwrd.Two env. Variables:ORACLE_BASE, one directory on server where all oracle products are installedORACLE_HOME, each version has his own oracle_home beneath oracle base

    DISPLAY env. needs to be set before the installer can run

    Parameter FileDefine how an instance will be build,

    1. Size of blocks2. Size of PGA en SGA.3. start background processen4. Location of control files.5. db_name parameter(only letters and digits, 8 char) has no default, so required

    Oracle offers two types of parameter files INIT.ORA(Pfile) and SPFILE.One of both can be used to start instance. SID refers to the name of the instance that willbe started.

    PFile client-side, text file and editable with text editor, only read at start-up

    Spfile server-side, binary file, editable by issuing alter system set, can becontinually be updated.

    If the instance is missing a parameter in the parameter file then it will use the default.

    Mount modesNo mount instance isnt connected to database and db_name parameter is not set.Requires parameter file

    Mounted The control file is successfully opened and the files(data) in the control filecan be found, requires control file

    Open connection between instance and database is ready to be used, so all redo filesand datafiles can be reached

    Shutdown all files are closed and instance does not exist

    Create a database1. create parameter file2. use the parameter file to build instance3. issue create database command to create database4. SQL scripts to create data dictionary5. SQL scripts to generate Enterprise Manager Database Control

    Echo and spools commands to write to log file everything.

  • 8/8/2019 Summary Oracle

    17/39

    There are defaults for everything except db_name (required), so if it not exists it will becreated using the defaults.Files created: controlfile, online redo log files, sysaux and system tablespace

    Post creation scriptsCreate db files it creates users tablespace

    Create DB catalog constructs views on the data dictionary which makes it possible tomanage oracle database and many pl/sql scripts

    Emrepository create objects needed by enterprise manager database control

    postDBcreation generates server parameter file

    Database listenerProcess that monitors the port of a database. Three ways to start:

    1. lsnrctl2. database control3. windows service

    launches new server processes and checks if instance is available. When the listener is

    down no new server processes can be generated. A listener needs to be on the samemachine as the instance except when RAC is used.

    Instances needs to be registered by listener, two ways listener.ora or when a instancestartups it will registers itself. The parameter local_listener tells the instance how toconnect with the listener, PMON process is responsible. If you want to register instanceto listener us following command: alter system registerConfiguration can be found in listener.ora, this is thus server side. Once registered thelistener can be brought down

    ConnectionConnect user/pass[@connect_alias] as sysdba or sysoper@connect_alias could be ip-adres, hostname, LDAP, connect string(tnsnames.ora,client side)Sysdba and sysoper are not users they are privileges that can be assigned to users. Bydefault the sys user has these privileges.Sysoper has access to the following commands: STARTUP, SHUTDOWN, alter

    database, alter backup and recoverSysdba same as sysoper only has one more ability: create database

    ShutdownNormal No new user will be permitted but all current connections are allowed to

    continueTransactional No new user will be permitted; existing session that are not in atransaction will be terminated

    Immediate No new sessions are permitted and all connected sessions are terminated

    Abort this is the equivalent of a power cut.PMON will rollback any incomplete transactions

  • 8/8/2019 Summary Oracle

    18/39

    Instance parametersCurrent parameters in instance can be found in table V$parametersParameters in spfile can be found in v$spparameterThe parameters can be requested by using sql*plus or by using the database controlIt is possible to change the parameters, you need to provide the scope what you want tochange(memory or spfile)V$Spparameter = spfileV$parameter = MemoryWanneer je zowel in memory als in file wilt aanpannen gebruik dan scope both

    Alert logAll critical operations applied to database or instance will logged to alert log. So changeswhich dont affect database will not be logged, e.g. creating user, alter session.Location of Trace files will be controlled by BACKGROUND_DUMP_DEST

    Oracle Net configuration

    Two types of configurationDedicated server each user process own server process

    Shared server number of user processes make use of server process poolNetwork support:TCP, TCP with secure sockets, NMP(named pipes), SDP, IPC(When a process is on thesame machine as the server,no tcp headers).The database listener isnt required when using IPC.Oracle Net(network architecture) is responsible for connection between user process andserver process

    Tools to manage oracle net database control, net manager, net configuration assistant

    Three important files configuration of Oracle Net.Listener.ora server-side, defines database listener

    Tnsname.ora client-side, used by user process to locate database listener and is usedfor name resolution

    Sqlnet.ora server-side and client-side, contains settings that apply to all connectionsand listener

    SQL executing stages1. parse what does the statement means and how to execute it, interaction with

    the shared pool

    2. bind variables are expanded to literal values

    3. execute data in database buffer will be read and changes written to the redo logbuffer and if the needed block are not available then it will be read from thedatabase file.

    4. fetch return the result set back to the user process

    Database control utilityUse the lsnrctl command

    Start starts listener

  • 8/8/2019 Summary Oracle

    19/39

    STOP stops listener

    STATUS status of listener

    Services services listener offers

    Version version

    Reload reread listener.ora

    Save_config write changes to listener.oraQuit quit without saving

    Exit quit with saving

    Set set various options

    Show show options set

    Shared server architectureDedicated server disadvantages performance may degrade if your OS has problemmanaging large of concurrent processes because it needs to swap each time betweenserver processes (context switching).Server machine has insufficient memory, because context switching cost a lot of memory

    and besides this each session has it own server process with his own PGA

  • 8/8/2019 Summary Oracle

    20/39

    Shared server is implemented on the server side by making use of two backgroundprocesses:

    Dispatcher(multiple) like any other tcp process

    Shared servers similar to dedicated process, but they are not tied to one session

    When an instance starts, the network listener process opens and establishes a

    communication pathway through which users connect to Oracle. Then, each dispatcherprocess gives the listener process an address at which the dispatcher listens forconnection requests. At least one dispatcher process must be configured and started foreach network protocol that the database clients will use. The listener returns the addressof the dispatcher process that has the lightest load, and the user process connects to thedispatcher directly

  • 8/8/2019 Summary Oracle

    21/39

    When a user makes a call, the dispatcher places the request on the request queue, whereit is picked up by the next available shared server process.The request queue is in the SGA and is common to all dispatcher processes of aninstance. The shared server processes check the common request queue for new requests,picking up new requests on a first-in-first-out basis. One shared server process picks up

    one request in the queue and makes all necessary calls to the database to complete thatrequest.When the server completes the request, it places the response on the calling dispatcher'sresponsequeue. Each dispatcher has its own response queue in the SGA. The dispatcherthen returns the completed request to the appropriate user process.

    !! a connection between user process and dispatcher is for the duration of the session. Theconnection between listener and session is temporary (transient)

    Shared server session stored session information on the SGA(large pool), rather than inthe user global Area. This memory is called UGAs Only the stackspace is stored in the

    PGA

    Oracle will launch additional servers till the max_shared_servers is reached

    SegmentsTable, index, type2undo, rollback, table partition, index partition, lobsegment, lobindex,lob partition, cluster nested table

    Datafile storage4 types of devices to store datafile:

    1. file on file local system files are stored in normal OS directory

    2. files on clustered file system system with external disks, mounted on more than onecomputer, e.g. OCFS(oracle clustered file system)

    3. files on raw devices it is possible(not recommend) to create datafiles on disks withno file system

    4. files on ASM devices A ASM is a volume manager and afile system for Oracledatabase files. ASM usesdisk groups to store datafiles; an ASM disk group is a collectionof disks that ASM manages as a unit. Within a disk group, ASM exposes a file systeminterface for Oracle database files. The content of files that are stored in a disk group areevenly distributed, or striped(to balance load and to reduce I/O latency), to eliminate hotspots and to provide uniform performance across the disks. The performance iscomparable to the performance of raw devices. ASM can store database files(only not

    alertlogs, binary files and trace files) and Oracle_home needs to be defined. Oracle ASMseparates files into stripes and spreads data evenly across all of the disks in a disk group.,not volumes. Mirroring is optional striping not.

    http://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#BABFGGAEhttp://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#CIHIAIFBhttp://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#CIHIAIFBhttp://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#BABCCICIhttp://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#BABCCICIhttp://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#BABFGGAEhttp://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#CIHIAIFBhttp://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/server.111/b31107/ostmg_gloss.htm#BABCCICI
  • 8/8/2019 Summary Oracle

    22/39

    TablespacesAll databases must have a system, a sysaux, temporary and an undo tablespaceCreation options

    - small is multiple files and bigfile is one big file

    a tablespace cannot be dropped if there are segments defined, there is a warningmechanism when a database a critical point, threshold is 85 and 97 percent.

    Extent managementExtent management set per tablespace so all segments apply to this extent managementprofile. Two techniques:

    1. dictionary management uses two tables in data dictionary: (bad performance)

    a. sys.UET$ describing used extents

    b. sys.FET$ describing free extents2. local management, dont use the data dictionary to keep track of free space and

    extent allocation. Instead, maintain a bitmap of free and used blocks, or set ofblocks. Using this bitmap eliminates the need for recursive SQL operationsagainst the data dictionary.

    Segment managementTwo techniques:Manual(not recommed) and automatic(the way to do it). Automatic has 5 bitmaps whichholds blocks used information

  • 8/8/2019 Summary Oracle

    23/39

    TEMP FILESUnlike normal data files, TEMPFILEs are not fully initialised (sparse). When you create a TEMPFILE,Oracle only writes to the header and last block of the file. This is why it is much quicker to create aTEMPFILE than to create a normal database file.

    TEMPFILEs are not recorded in the database's control file. This implies that one can just recreatethem whenever you restore the database, or after deleting them by accident. This opens interestingpossibilities like having different TEMPFILE configurations between permanent and standbydatabases, or configure TEMPFILEs to be local instead of shared in a RAC environment.

    USER ACCOUNTSUser account is used to connect to instance, attribute are:

    Username unique name in database,

  • 8/8/2019 Summary Oracle

    24/39

    system Priviliges

    Create session lets user connectRestricted session if database is started up with restrict, the user must have thisprivilege

    Alter database gives access to many commands to modify physical structure

    Alter system gives control over instance parameters

    Create Tablespace let a user manage tablespaces

    Create table control over tables in own schema

    Grant any object privilege lets grantee grant object to users

    Create any table create tables that belong to other users

    Drop any table drop table from anyone

    Insert any table grant DML commands against other users

    Select any table select from any table

    Example:

    Grant create table to scott with admin option admin option means that you are able topass the privilege to someone else

    If privilege is revoked from a user, any actions performed will remain intact, also thepriviliges given to someone else.

    ANY privilges is a system privilege and not an object

    Object PrivilegesThe any privilges are only system priviliges.Object privileges are :Select, insert, update, delete, alter, execute.

    The all privilege is all object privileges.

    ExampleGrant select on hr.employees to scott [with grand option],

    With grand option a user is allowed to pass the object privilege to someone else

    Revoking a object privilege will be cascade, so if I granted john and my privilege isrevoked john also doesnt have access anymore

    ROLES

  • 8/8/2019 Summary Oracle

    25/39

    A role can be enabled or disabled, can have system and/or object privilges, can bepassword protected

    Example:Create Role hr_junior Grant create session to hr_juniorGrant hr_junior to user

    Manage profilesA profile handles two things:1. Enforce password policy, limits are: failed login attempts, password_locktime,password_life_time, password_grace_time, password_reuse_time, password_reuse_max.2. restrict the resources a session can take. The instance parameter resource_limit needsto be set to true: limits are: sessions_per_user, cpu_per_session, CPU_Per_call

    All user wil have by default the default profile

    PERMANENT TablesHeap tables (default), index-organized tables, partitioned tables and clustered tables

    SCHEMASchema is owned by a user. Non-schema objects are objects which has nothing to do withusers, like tablespaces.Tables cannot use reserved words as their names; must begin with a letter; and caninclude only letters, digits and underscore, dollar and hash symbols. This can be brokenby using double quotes.

    NamespaceFollowing objects share same namespace, so must have a unique name:Tables, views,sequences, synonyms, procedures, functions, packages, user defined types.Objects which have an own namespace:Indexes, contraints, clusters, database triggers, database links and dimensions

    DatatypesLong and Long raw is the old way to do it now use clob(unlimited size)

    ConstraintsA constraint violation will force an automatic rollback of the entire statement that hit the

    problem, not just the single action with the statement. If multistatement transaction thenstatements have already succeeded will remain intact but uncommitted.Constraint possible:

    Unique it is possible to insert many rows with nulls in a column with a uniqueconstraint , this is not possible when a primary constraint is on the column. Uniqueconstraints are enforced by an index

    Not null forces values to be entered in column

  • 8/8/2019 Summary Oracle

    26/39

    Primary key needs to have an index when not exists it will be generated, not possibleto enter nulls

    Foreign key is defined on child table but a unique or primary key constraint mustexists on parent. Inserting rows with a null value on the foreign key column is possibleeven when it does not exist in the parent table, two delete the parent of the childs:

    on delete cascaseon delete set null

    Check enforce simple rules. It is not possible to do a subquery or use functions.

    Examples:Constraint dept_deptno_pk primary key,Constraint name check(deptno between 10 and 90)Constraint dept_dnsame not nullConstraint emp_mgr_fk referenced emp(empno)

    Constraint can be in 4 states:

    Enable validate not possible to enter rows which violate constraintDisable novalidate any data can be entered

    Enable novalidate already entered data may not satisfy constraint, now entering datamust satisfy data

    Disable validate all data in table conforms constraint new data dont satisfy constraint

    A constraint can be checked as statement is executed(immediate,) or when transaction iscommited(deferred, this is default)

    IndexesTo enforce primary key and unique constraint

    Improve performance.Types of indexes:Use bitmap instead of b*tree:

    Cardinality in the column is low, a lot of the same valuesNumber of rows is highColumn is used in Boolean algebra operations

    Index type options

    Unique no duplicate values

    Reverse key example john will be indexed as nhoj

    Compressed a compressed index will only store the key once followed by a stringmatching all rowids

    Composite(also bitmap) concatenation of two or more columnsFunction based (also bitmap) built on result of function e.g. to_char(startdate, ccyy-m-dd)

    Ascending or descending (also bitmap) this is the default(ascending) keys are stored inorder of the lowest to the highest values

    Temporary tables

  • 8/8/2019 Summary Oracle

    27/39

    Rows in a temporary table are visible only to the session who entered it. DML does notgenerate redo. Exists in PGA or temporary segments. Temporary table can keep rows forduration of a session or transaction depend on how it is configured.

    Database transactionA(tomicaity) all parts of transaction must complete or none of them complete

    C(onsistency) query must be consistent with the state of the database at the time thequery started

    I(solation) transaction must be invisible to the rest of the world

    D(urable) once the transaction completes, it must be impossible for the database tolose it.

    UNDO / REDOUndo(rollback)Undo is used to refer to undo segments(rollback data in release gi and before), So that you can undo your

    changes ( rollback ). If you accidentally, or purposely deleted a bunch of data, you can rollback your

    changes and restore the table to the way it looked before you made the change. This is great if you are

    doing some development and want to change a bunch of data or test out some program that deletes or

    creates data. But that's not all it's good for, the undo is also used to allow other people that are connected to

    your database to see the previous version of the table you are in the process of modifying. Only old value

    will be written to undo segment. Rollback data cannot be used in combination with undo segment.

    An transaction can only be protected by one undo segment(no fixed size because of extents). An undo

    segment can support multiple transactions if needed.

    Three levels of necessity:

    1. Active undo cannot be overwritten

    2. Expired undo can be overwritten

    3. Unexpired undo can be overwritten only if there is a shortage of undo space.

    Requirements:

    1. sufficient space

    2. additional space to store unexpired undo data that might be neededIf out of undo space, the portion that already had succeeded will be rolled back. The rest of the transaction

    remains intact and uncommitted

    Parameters:

    UNDO_management: AUTO or MANUAL

    UNDO_TABLESPACE: the localtion of the undo tablespace

    UNDO_RETENTION: number of seconds when undo data becomes expired instead of unexpired

    The undo segment isnt by default autoextend, this can be set at anytime

    Redo(crashes)Unlike undo segments that are stored in a tablespace and are similar to tables and indexes, redo logs are

    stored at the file system level and are used to store changes to the database as they happen.

    The primary purpose of the redo logs are to record all changes to the database as fast as possible. Oraclesimply writes all changes to a redo log file. All changes, no mater what table, no matter what tablespace, no

    mater where on the filesystem the final change will need to be made..

    It's called a redo log, because first oracle writes the data quickly to disk, then it later has to redo that change

    in the database proper. If the database crashes or has some other type of failure, oracle will first read the

    redo logs and apply all committed changes to their proper tablespaces / datafiles before opening the

    database up for regular use. Old value and new value written to redo.

    Update

  • 8/8/2019 Summary Oracle

    28/39

    1. read from buffer cache, if data is not available then from datafiles2. writes to log buffer(old+new)3. writes to undo segment(old)4. change is carried out on the buffer cache5. until commit all other sessions reads from undo segement

    Insert / delete1. Read from buffer cache, if data is not available then from datafiles2. insert only the row id is stored in redo log buffer, when delete whole row is

    stored.

    RollbackRollback is carried out by background processes.

    1. PMON if there is a problem with the session

    2. SMON if there is a problem with database(e.g. rebooted)

    3. Manual it is possible to do a manual rollback

    CommitNothing will happen with the dBWn only the log buffer will be written to disk. Yoursession will hang till the write is completed. LGWR contains data of committed anduncommitted data.Any DDL command, GRANT and revoke will commit a transaction. Autocommit onmeans after each DML statement a commit is done implicit.

    PL/SQLPL/sql always executes in database, java can be run either within database or on client.

    Stored pl/sql loaded into database and saved in data dictionary as named as PL/SQLobject. Is faster because it is already compiled.

    Anonymous

    code stored remotely

    Procedure carries out some action. The arguments can be IN, OUT or IN-OUT

    Function similar as procedure but does not have OUT parameters and cant be invokedby execute. A function returns one single value.

    Package exists of two objects: specification(pks) and body(pkb)

    Triggers A trigger runs automatically when an action is carried out or a certainsituation arises. A trigger only runs by its own trigger event.

    LockingExclusive lock is a lock on one row or table and nobody else can change the row then

    the session who has the lock. It is possible for everyone to read the row.Shared lock on a object(table) but multiple users can take the lock. A shared lock isused to prevent a exclusive lock on table or row.DML statements require two locks: exclusive lock on row and shared lock on table.DDL statements require exclusive lock.

    Normally a request will wait when the object is already locked, this can be avoided byusing the WAIT or NoWAIT clauses in the select.

  • 8/8/2019 Summary Oracle

    29/39

  • 8/8/2019 Summary Oracle

    30/39

    DB_EXTENDED same as db only now with sqlstatements and bind variables

    XML As OS only in XMLXML_EXTENDED same as xml only with sql statements

    and bind variables

    audit command, e.g. audit create any trigger, now it willgenerate a trail for every trigger which is created. It is possible to add an extra filtersuccessful or not successful. Based on commands executed against database. Defaultview DBA_AUDIT_TRAIL

    VALUEBASEDWhen a row is affected, e.g. audit insert on HR.EMPLOYEES

    FINEGRAINED capture access to a table, but cannot distinguish between rows. It canrun PL/SQL code when condition is breached. Create policy : ADD policy procedure.Results: DBA_FGA_AUDIT_TRAIL

    Manage OptimizerExecution plans are developed dynamically by the optimizer, the optimizer relies onstatistics: The statics are:

    DBA_TABLES number of rows, number of blocks, amount of free space

    DBA_TAB_COLUMNS number of distinct values, highest and lowest values, averagecolumn length

    DBA_INDEXES The depth of the index tree, the number of distinct key values

    INDEX_STATS number of index entries referring to extant rows

    StatisticsObject statistics are not real-time; they are static until refreshed by new analyses (manual(analyze dbms_STATS command, database control) or automatic). You need to refreshthese analyses frequently else the optimizer can make wrong execute plans. The visibilityof statistics can be controlled by parameter STATISTICS_LEVEL

    BASIC disables computation of awr(automatic workload repository) statistics anddisables daily analysis

    TYPICALdefault setting, will gather the statistics needed for self-management andperforms the daily analysis task.

    ALL gathers all information, has impact on performance.

    Automatic workload repository(AWR)AWR is a set of tables and other objects in the sysaux tablespace. Instance statisticswritten to disk is called AWR snapshot. The flushing(writing) to disk is done by MMONprocess. MMON reads from memory(SGA) and writes to disk so AWR reads these files.The MMON makes ones an hour an AWR snapshot and will be stored by default 8 days.

    AWR is located in the SYSAUX and cannot be relocated.Metrics Statistics must be converted in metrics, a metric is two or more statisticscorrelated together.

    Baseline stored set of metrics or/and statistics which can be used across time.Baselines will be kept indefinitely.

    Advisory FrameworkOracle comes with a set of advisors:

  • 8/8/2019 Summary Oracle

    31/39

    ADDM in MMON and takes information from the AWR. It automatically generates areport with a cover period between the current snapshot and the previous one. ADDMreports are stored for 30 days.Recommadations:

    Hardware changes

    Database configuration Schema changes

    Application changes

    Memory advisors predict the effect of varying the size of memory structures(SGA ENPGA). The is no advisor for large pool. There is a memory advisor for the wholeSGA(parameter MEMORY_TARGET)

    SQL access, tuning and Repair Three sql advisors: access, tuning and repair.

    Access: observe workload of sql statements. Recommendations could be: createor drop index, make views.

    Tuning: analyze individual statements, as well as recommending schema changes.Recommendations could be: analyze individual statements as well asrecommending schema changes

    Repair: investigate if a different execution plan is followed no error will bethrown.

    Automatic Undo Advisor observe the rate of undo data generation and length ofqueries

    Mean Time to Recover estimates how long the period of downtime for crash recoverywill be, given the current workload.

    Data Recovery Advisor advise the dba about nature and extent of the problem after adatabase failure

    Segment Advisor recommends appropriate reorganization of segments because

    segments dont schrink automatically.Automatic MaintanceThere are three automated maintance tasks(scheduler): gathering optimizer statitics, thesegment advisor, the sql tuning advisor. The advisors run automatically, butrecommendations must be accepted manual. The tasks run in the maintenance window.Which by default opens for four hours every weeknight at 2200 and twenty for hours inthe weekend.

    AlertsAlerts are raised by MMON, Enterprise reads alerts, as other third parties can.Two kinds of alerts:

    Stateful based on conditions that persist and can be fixed. Stateless are based on events, e.g. snapshot to old or two transactions

    deadlocking each other.There are two hundred metrics(V$metrics available) were a thresholds can be set.

    Notification

  • 8/8/2019 Summary Oracle

    32/39

    Default notification mechanism for stateful alerts is displaying them in enterprisemanager. When an alert is cleared it will be moved from DBA-OUSTANDIGN_ALERTS to DBA_ALERT_HISTORY.

    PGA Memory ManagementExecuting sql store specific data: temporary tables, sorting rows, merging bitmaps,variables and call stack. Every sql statement uses SGA memory and a PGA memory.Three stages of memory allocation

    OptimalAllocation of all input data

    One-passInsufficient for optimal execution therefore extra pass over the data

    multipassmultipass allocation is even smaller, so several passes are necessary

    Optimal is the ideal situation but this isnt realistic because data warehouse operationscan take gigabytes of memory allocations, example

    Optimal One-pass multipass10 gb of data > 10 GB memory +/- 40 MB < 20 MB

    PGA memory management should be set to automatic. Two parameters:

    WORKAREA_SIZE_POLICY, default auto automatic assignedPGA_AGGREGATE_TARGET, default >10mb or 20 percent of size SGA

    SGA Memory ManagementMemory structures can be sized independently

    shared pool shared_pool_size

    database buffer cache db_chache_size

    large pool

    Large_pool_size streams pool streams_pool_size

    java pool Java_pool_size

    log bufferautomatic memory (parameter SGA_Target) allocation except log buffer, it will be takenfrom component that can spare it.

    Automatic Memory ManagementMemory_TARGET memory as whole, transfer memory between PGA en SGA ondemand

    more memory to PGA when query processing

    more memory to buffer cache when transactionsPGA_AGGREGATE_TARGET PGA

    SGA_TARGET SGA

    Memory AdvisorsThe MMON process flushes the statistics to the AWR. These statistics will be used by thememory advisors. The automatic memory facility uses the advisors to make decisions

  • 8/8/2019 Summary Oracle

    33/39

    about memory allocation. The advisors will not be enables unlessSTATISTOCS_LEVEL is set to Typicall or All.

    Invalid and unusable objectsInvalid objects Invalid objects concerns PL/SQL code stored in data dictionary.Objects are:

    procedures

    functions

    traiggers

    packages

    object typesDBA_Object table helds the status of a object. Oracle will always attempt to recompileinvalid PL/SQL objects and views automatically.

    Unusable Indexes an unusable index needs to be repaired explicity. An index becomesunuable when rowed changes. An unusable index will not generate an error but it willrevert to an execution plan. You can change this by setting the parameterSKIP_UNUSABLE_INDEXES to false.

    Nologging disables redo generation only for index rebuild. All DML operation againstthe index generate redo information

    Failures1 . Statement failure server process rollbacks statement. If statement is part ofmultistatement transaction the succeeded statements will remain intact.

    constraint violation or a format.

    Logic errors in application deadlocks

    Space management problems

    Insufficient priviliges

    3. user process failure an active transaction will be rolled back automaticallya. terminal rebootingb. address violation

    4. Network failure it is possible that there is no single point of failurea. Database listener crashesb. OS and hardware levels failsc. Routing problems or localized network failures

    5. User Errors e.g drop table and commit it but this was not the intention

    a. Flashback query query against a version of the database as at sometime in the past

    b. Flashback drop reverses effect of drop table

    c. Log Miner extracts information from online and archived redo logs.Redo includes all changes made to data blocks

    6. Media Failure damage to disk and therefore the files stored on them, afterrecovery a instance recovery is done.

    a. Data guard

  • 8/8/2019 Summary Oracle

    34/39

    b. RAIDc. Archived redo logsd. Multiple copies of controlfile, online redo log file, archive redo log file

    7. Instance failure disorderly shutdown of the instance(crash), so missingcommitted transaction and storing uncommitted transactions. Recovery is

    completely automatic.a. LGWR cares that there is enough information in the redo log stream and

    online redo log files

    Database corruptionEnough data in redo log to reconstruct all work. Uncommitted work must never be saved.The instance recovery mechanism of redo and rollback makes it impossible to corrupt anOracle database, so long there is no physical damage. Oracle guarantees that yourdatabase is never corrupted using online redo log files.

    Instance recoveryCritical for SLA is MTTR(mean time to recover). Depends on:

    How much redo How many read/write operations needed on datafiles

    Checkpoint can guarantee that the mean time to recover is short but this could crippleperformance because of excessive disk I/O. The FAST_START_MTTR_TARGET(default zero, so long recovery) parameter will care that the database is recovered withinthat number of seconds. Setting parameter to non zero value enables checkpoint auto-tuning.Checkpoint auto-tuning uses free CPU for writing dirty buffers to buffer cache.The parameter can be set in database control

    Flash recovery AreaThe FAR is a disk destination used as default location for recovery related files. Two

    parameters:Db_recovery_file_dest location

    Db_recover_file_dest_size limits amount of space, if size is reached obsolute backupswill be deletedFiles written to FAR:

    Recovery manager backups

    Archive redo log files

    Database flashback logs

    Current control file

    BackupOffline backup, backup taken while database is closed

    ClosedColdConsistent

    Online backup, backup taken while database is in use:OpenHotInconsistent

  • 8/8/2019 Summary Oracle

    35/39

    User managed backup

    If database is in noarchivelog mode, you cannot do open backups. Backups may only bemade with operating commands when the database is shut down or with RMAN when itis mounted.

    Consistent backup

    Copy controlfile

    Copy datafile

    Copy online redo log files

    Tempfiles (optional)

    Parameter file

    Server managed backupOnly can be performed when it is in mount mode, because control file needs to be read.This is done with RMAN three options to run RMAN:

    Interactive interface ad hoc tasks

    A script interface running jobs through OS scheduler

    Enterprise manager generating scripts and defining jobsNo backup of:

    Online redo log files

    Tempfiles

    Three types:

    Backup set contain several files and will not include never-used blocks Compressed backup set same as backup set only compressed

    Image copy indentical to the input file include never-used blocks

    Backup without shutting downUser managed backup

    Three steps:1. Archive the online redo log files2. ALTER DATABASE BACKUP CONTROLFILE TO3. copy datafiles while tablespace in backup mode

    Server managed backup

    1. archibe online redo files2. backup control file3. backup the datafiles, without need of backup mode

  • 8/8/2019 Summary Oracle

    36/39

    Backup incremental1. User managed backups cannot be incremental2. Starting point must be an incremental level 0 backup3. Incremental levels are 0,1, cumulative,4. Incremental backups always go back to level 05. incremental backups can be made in archivelog or noarchivelog

    Automate backups1. User and server managed backup jobs can be scheduled with OS scheduler2. Server managed backups can also be scheduled by enterprise manager job.

    Manage backups1. Repository can be checked with reality with crosscheck command.

    2. user-managed backups can be under RMAN control by usingCATALOG command

    3. if backing up flash recovery area, its usage must be monitored

    Data recovery Advisor (DRA)1. Diagnosing and repairing problems with database.2. RMAN executable and runnable through enterprise manager

    DRA is only capable to repair datafile and the controlfile

    1. controlfile needs to be multiplexed (copy file and change controlfilesparameter in parameter file), damage to any controlfile copy will abort the

    instance immediately. It will not possible to mount database.2. online redo log

    status invalid use the clear command. If a redo log group has one oline redo filewhich isnt damaged the database will function.

    3. Datafile

    Noarchivelog the only restore possible is of the whole database

    ArchiveLog system and undo tablespaces are critical, if damaged then databaseabort. Other control files are non-critical and can be recovered when database isopen.

    1. Database Must be in nomount, or higher

    2. Only for single database no RAC or data Guard standby database.

    DRA makes use of information gathered by health monitor and automatic diagnosticrepository (ADR, parameter DIAGNOSTIC_DEST) and then generates RMAN recoveryscript.Flow of dra:

    1. Assess data failures from the health monitor to ADR2. List failures, list all failures from ADR

  • 8/8/2019 Summary Oracle

    37/39

    3. generate RMAN script4. run Script

    The DRA will not generate any advice if you have not first asked it to list failures.

    Health monitorHealth monitor is a set of checks that run automatically when certain error occurs.Results are stored in files. Checks performed in different stages:

    1. no mount integrity of control file

    2. mount integrity control file, only redo log, data file headers. Accessibility will bechecked for the inline and archived log files.

    3. Open data block scan, integrity of data dictionary and the undo data segments.

    Move data

    SQL LOADER

    Tool for inserting data into an oracle database, wide variety of formats is supported.Control File interpret the contents of the input data files

    Input data source that will be uploaded into database

    Log files log successful runs.

    Bad file data doesnt conform control file or violate integrity constraint.

    Reject file mismatch selection criterion

    Two techniques conventional: use ordinary insert statements.Direct path. Bypass buffer cache, so writes directly to datafileThe write is above the high water mark(marker to segment whereno data has ever been written) of the table and is known as a datasave. very fast, but1. only unique, primary key and not null constraints, reference

    constraints must be dropped2. insert triggers do not fire3. table is locked for dml

    Directory objects

    DIRECTORY object is a logical structure that represents a physical directory on theserver's file system. The package UTF_FILE has procedures to write to operating systemfiles. Only directories in the UTF_FILE_DIR can be accessed. This parameter is systemlevel parameter so it is not configurable for a single user. * each directory on server.

    Directory objects are owned by SYS, you have to have the right permissions to create.

    External tables

    Exists as an object defined in the data dictionary not as segment. It enables you to accessdata in external sources as if it were in a table in the database.

    1. Cannot perform DML operations2. can perform a write using data pump

  • 8/8/2019 Summary Oracle

    38/39

    create statement contains organization external, type could be oracle_loader for usingfiles like in sql loader or oracle_datapump using a select statement.

    Data pump

    Extract from one database and insert it into another one.

    Import, export old tools using server process via the user process. Cannot read datapump generated files. Works with all versions

    Datapump can only work with 10g and 11g besides this datapump cannot write to filesystem. Datapump is a server-side utility therefore it is faster than import/export becausethey need to connect to server process using user process, datapump can directly accessdatafiles. Everything on the server(files etc). A job is independent of the session.

    User processes: expdp and impdp establishes a session against database

    Datapump Master process(dmnn) The master process controlsthe entire job, including communicating with the clients, creating

    and controlling a pool of worker processes, and performinglogging operations

    Worker processes The worker processes are the ones thatactually unload and load metadata and table data in parallel.

    QUEUE: control queue(jobs for the worker process) andstatus(monitoring, state of job) queue

    Files sqlfiles(ddl statements describing object), log files(historyeach run) and dump files(xml).

    Table: created by dmnn

    Datapump always uses oracle directories. 4 manners to specify directory:

    1. Defaults are specified by DATA_PUMP_DIR(environment and directory object)2. parameter applied to job, command line3. per file setting

    The external table path insert uses regular commit, like any other DML statement. Directpath doesnt use a commit but use high water mark. Data files are the same. Data pumpfiles can only be read by data pump.

    Parallel processing two levels, number of worker processes and parallel executionservers each worker process uses.

    Network mode The fastest way. transfer data from one database to another databasewithout staging(Disk staging is using disksas an additional, temporary stage ofbackupprocess before finally storing backup to tape. Backups stay on disk typically for a day ora week, before being copied to tape in a background process and deleted afterwards.).

    Database control data pump 1. export to export files 2. import from export files 3.import from database. 4. monitor export and import jobs.

    http://en.wikipedia.org/wiki/Hard_diskhttp://en.wikipedia.org/wiki/Hard_diskhttp://en.wikipedia.org/wiki/Backuphttp://en.wikipedia.org/wiki/Backuphttp://en.wikipedia.org/wiki/Magnetic_tape_data_storagehttp://en.wikipedia.org/wiki/Magnetic_tape_data_storagehttp://en.wikipedia.org/wiki/Hard_diskhttp://en.wikipedia.org/wiki/Backuphttp://en.wikipedia.org/wiki/Magnetic_tape_data_storage
  • 8/8/2019 Summary Oracle

    39/39