Successfully reported this slideshow.

Oracle RDBMS architecture

5,148 views

Published on

a striped down Version of a presentation about oracle architecture. Goal was a basic understanding and foundation about some components of Oracle, so subsequent discussions should be easier

Published in: Technology, News & Politics
  • very informatic. thanks
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Oracle RDBMS architecture

  1. 1. OracleArchitectureOracle RDBMS basics
  2. 2. about mewith Oracle since 2000DBA @H3G since 2003my private (most technical related) thoughts: http://berxblog.blogspot.com@martinberxmartin.a.berger@gmail.comno official presentations / trainings so far "it depends"
  3. 3. roadmap● Database ● Instance ○ spfile ● Processes ○ controlfile ● Session ○ datafile ● Statement ○ redo-logs / archives ● Transaction ● Cluster● Cluster ● Listener + Cluster failover + Data Dictionary
  4. 4. Oracle Database 11g: Interactive Quick Reference - Your Essential Guide to Oracle Database 11g Release 2http://www.oracle.com/webapps/dialogue/ns/dlgwelcome.jsp?p_ext=Y&p_dlg_id=9575302&src=7027600&Act=54
  5. 5. Database ○ spfile *.compatible=11.1.0.0.0 *.control_files=/appl/oracle/oradata/BERX2/control01. ctl,/appl/oracle/oradata/BERX2/control02. ctl,/appl/oracle/oradata/BERX2/control03.ctl *.db_block_size=8192 *.db_name=BERX2 ...
  6. 6. Database ○ spfile *.compatible=11.1.0.0.0 *.control_files=/appl/oracle/oradata/BERX2/control01. ctl,/appl/oracle/oradata/BERX2/control02. ctl,/appl/oracle/oradata/BERX2/control03.ctl *.db_block_size=8192 *.db_name=BERX2 ● The database name ○ controlfile ● ● Names and locations of associated datafiles and redo log files The timestamp of the database creation ● The current log sequence number ● Checkpoint information (SCN)
  7. 7. Database ○ spfile *.compatible=11.1.0.0.0 *.control_files=/appl/oracle/oradata/BERX2/control01. ctl,/appl/oracle/oradata/BERX2/control02. ctl,/appl/oracle/oradata/BERX2/control03.ctl *.db_block_size=8192 *.db_name=BERX2 ● The database name ○ controlfile ● ● Names and locations of associated datafiles and redo log files The timestamp of the database creation ● The current log sequence number ● Checkpoint information (SCN) ● datafiles keeps persistent data ● Each tablespace in an Oracle database ○ datafile / tablespace ● consists of one or more datafiles Tablespaces: SYSTEM, UNDO, TEMP, data
  8. 8. Database ○ spfile *.compatible=11.1.0.0.0 *.control_files=/appl/oracle/oradata/BERX2/control01. ctl,/appl/oracle/oradata/BERX2/control02. ctl,/appl/oracle/oradata/BERX2/control03.ctl *.db_block_size=8192 *.db_name=BERX2 ● The database name ○ controlfile ● ● Names and locations of associated datafiles and redo log files The timestamp of the database creation ● The current log sequence number ● Checkpoint information (SCN) ● datafiles keeps persistent data ● Each tablespace in an Oracle database ○ datafile / tablespace ● consists of one or more datafiles Tablespaces: SYSTEM, UNDO, TEMP, data ○ redo-logs / archives
  9. 9. Cluster
  10. 10. InstanceA database instance is a set of memory structures thatmanage database files.● SGA● PGA● processes ○ background ○ server
  11. 11. Processes● background process DBWR, LGWR, SMON, PMON, CKPK, ARCH, MMON, MMNL, RECO, etc.● server process Oracle Database creates server processes to handle the requests of client processes connected to the instance. A client process always communicates with a database through a separate server process. Server processes created on behalf of a database application can perform one or more of the following tasks: ● Parse and run SQL statements issued through the application, including creating and executing the query plan (see "Stages of SQL Processing") ● Execute PL/SQL code ● Read data blocks from data files into the database buffer cache (the DBWn background process has the task of writing modified blocks back to disk) ● Return results in such a way that the application can process the information
  12. 12. SessionA session is a logical entity in the databaseinstance memory that represents the state of acurrent user login to a database.For example, when a user is authenticated bythe database with a password, a session isestablished for this user.A session lasts from the time the user isauthenticated by the database until the timethe user disconnects or exits the databaseapplication.
  13. 13. Statement● DDL CREATE, ALTER, DROP, TRUNCATE, GRANT, AUDIT, COMMENT implicit commit● DML SELECT, INSERT, UPDATE, MERGE, DELETE, EXPLAIN PLAN, LOCK TABLE● Transaction Control SET TRANSACTION, SAVEPOINT, COMMIT, ROLLBACK● ALTER (session, system)● embedded (into procedural program)
  14. 14. Statement - lifecycle
  15. 15. TransactionLogical unit of work that contains one or more SQL statements. All statements in a transaction commit or roll backtogether. The use of transactions is one of the most important ways that a database management system differs froma file system.ACID● Atomicy all or nothing● Consistency from one valid state to another● Isolation transactions does not interfer● Durability just stored
  16. 16. Transaction - Isolation Levels1. Read committed (default)A query will only be able access committed data. However, the transaction may be affected by changes made by othertransactions.This can be set by:SET TRANSACTION ISOLATION LEVEL READ COMMITTED; (transaction level)ALTER SESSION SET ISOLATION_LEVEL READ COMMITTED; (session level)2. Serializable transactionsA query can only access data that was committed at the start of the transaction. Modification from DML operations performedfrom the same transaction will be visible.The Serializable transaction isolation level is not supported with distributed transactions.This can be set by:SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; (transaction level)ALTER SESSION SET ISOLATION_LEVEL SERIALIZABLE; (session level)3. Read onlyA query can only access data that was committed at the start of the transaction. Modification to the data is not allowed.This can be set by:SET TRANSACTION ISOLATION LEVEL READONLY; (transaction level)ALTER SESSION SET ISOLATION_LEVEL READONLY; (session level)
  17. 17. Transaction - flowselect sal from emp where ename in (SMITH, ALLEN); -- 800, 1600set transaction name my trans 1;UPDATE emp SET sal = 7000 WHERE ename = SMITH;SAVEPOINT after_banda_sal;UPDATE emp SET sal = sal+10400 WHERE ename = ALLEN;select sal from emp where ename in (SMITH, ALLEN); --7000, 12000SAVEPOINT after_greene_sal;ROLLBACK TO SAVEPOINT after_banda_sal;UPDATE emp SET sal = sal+10300 WHERE ename = ALLEN;select sal from emp where ename in (SMITH, ALLEN); -- 7000, 11900rollback;
  18. 18. Transaction - redo/undo
  19. 19. Cluster
  20. 20. Cluster - Listener
  21. 21. Cluster - Listener II
  22. 22. Cluster - Listener III
  23. 23. FailoverTransparent Application Failoverif one instance dies, the client restarts the whole listener-connection-sequence,cursors are re-opened, statement re-runlimitations: ● The effect of any ALTER SESSION statements will be lost. ● Global temporary tables will be lost. ● Any PL/SQL package states will be lost. ● Transactions involving INSERT, UPDATE, or DELETE statements cannot be handled automatically by TAF.If there is a failure you will most likely see an ORA-25402 error. Applications should be prepared tohandle errors in the 25400-25425 range and rollback appropriately.
  24. 24. TAF - errorsORA-25400: must replay fetch ORA-25406: could not generate a connect addressCause: A failure occured since the last fetch on this statement. Failover was able to Cause: Failover was unable to generate an address for a backup instance.bring the statement to its original state to allow continued fetches. Action: Contact Oracle customer support.Action: This is an internally used error message and should not be seen by the ORA-25407: connection terminateduser. Cause: The connection was lost while doing a fetch.ORA-25401: can not continue fetches Action: This is an internally used error message and should not be seen by theCause: A failure occured since the last fetch on this statement. Failover was unable user.to bring the statement to its original state to allow continued fetches. ORA-25408: can not safely replay callAction: Reexecute the statement and start fetching from the beginning Cause: The connection was lost while doing this call. It may not be safe to replay itORA-25402: transaction must roll back after failover.Cause: A failure occured while a transaction was active on this connection. Action: Check to see if the results of the call have taken place, and then replay it ifAction: The client must roll back. desired.ORA-25403: could not reconnect ORA-25409: failover happened during the network operation,cannot continueCause: The connection to the database has been lost, and attempts to reconnect Cause: The connection was lost when fetching a LOB column.have failed. Action: Failover happened when fetching LOB data directly or indirectly. PleaseAction: Manually reconnect. replay the top level statement.ORA-25404: lost instance ORA-25425: connection lost during rollbackCause: The primary instance has died. Cause: The connection was lost while issuing a rollback and the application failed over.Action: This is an internally used error message and should not be seen by theuser. Action: The connection was lost and failover happened during rollback. If the transaction is not externally coordinated, then Oracle implicitly rolled back, so noORA-25405: transaction status unknown action is required. Otherwise examine pending_trans$ to determine if "rollbackCause: A failure occured while a transaction was attempting to commit. Failover force" is required.could not automatically determine instance status. ORA-25426: remote instance does not support shared dblinksAction: The user must determine the transactions status manually. Cause: A shared dblink is being used to connect to a remote instance that does not support this feature because it is an older version. Action: Use a normal dblink if you need to connect to this instance.
  25. 25. Data Dictionary● Informations about the database ○ Meta-info about all objects, schemata, user, privileges, audit ○ DBA_*● Informations about the instances ○ many informations about structures in memory ○ v$* / gv$*● Nearly everything Oracle knows you can select
  26. 26. further informationsOracle Documentation - Concepts Guide http://docs.oracle.com/cd/E11882_01/server.112/e25789/toc.htmask● Ops.Oracle team● forums.oracle.com● http://www.freelists.org/list/oracle-lread
  27. 27. creditsArup Nanda - discussions about listenerAman Sharma - review of connect-flowSurachart Opun - general reviewMartin Schretzmeier - infrastructure infosOps.Oracle team - review
  28. 28. Next Presentations● Physical structures & (SQL) tuning● Capacity planning basics● anything else?

×