oracle rdbms architecture

28
Oracle Architecture Oracle RDBMS basics

Upload: martin-berger

Post on 14-Jun-2015

3.551 views

Category:

Technology


5 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Oracle RDBMS architecture

Oracle ArchitectureOracle RDBMS basics

Page 2: Oracle RDBMS architecture

about me

with Oracle since 2000DBA @H3G since 2003my private (most technical related) thoughts:

http://[email protected]@gmail.comno official presentations / trainings so far

"it depends"

Page 3: Oracle RDBMS architecture

roadmap

● Database○ spfile○ controlfile○ datafile○ redo-logs / archives

● Cluster

● Instance● Processes● Session● Statement● Transaction● Cluster● Listener + Cluster failover+ Data Dictionary

Page 4: Oracle RDBMS architecture

Oracle Database 11g: Interactive Quick Reference - Your Essential Guide to Oracle Database 11g Release 2

http://www.oracle.com/webapps/dialogue/ns/dlgwelcome.jsp?p_ext=Y&p_dlg_id=9575302&src=7027600&Act=54

Page 5: Oracle RDBMS architecture

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'...

Page 6: Oracle RDBMS architecture

Database

○ spfile

○ controlfile

*.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● Names and locations of associated datafiles and redo log files● The timestamp of the database creation● The current log sequence number● Checkpoint information (SCN)

Page 7: Oracle RDBMS architecture

Database

○ spfile

○ controlfile

○ datafile / tablespace

*.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● 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

consists of one or more datafiles● Tablespaces: SYSTEM, UNDO,

TEMP, data

Page 8: Oracle RDBMS architecture

Database

○ spfile

○ controlfile

○ datafile / tablespace

○ redo-logs / archives

*.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● 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

consists of one or more datafiles● Tablespaces: SYSTEM, UNDO,

TEMP, data

Page 9: Oracle RDBMS architecture

Cluster

Page 10: Oracle RDBMS architecture

Instance

A database instance is a set of memory structures that manage database files. ● SGA● PGA● processes

○ background○ server

Page 11: Oracle RDBMS architecture

Processes

● background processDBWR, LGWR, SMON, PMON, CKPK, ARCH, MMON, MMNL, RECO, etc.

● server processOracle 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

Page 12: Oracle RDBMS architecture

SessionA session is a logical entity in the database instance memory that represents the state of a current user login to a database. For example, when a user is authenticated by the database with a password, a session is established for this user. A session lasts from the time the user is authenticated by the database until the time the user disconnects or exits the database application.

Page 13: Oracle RDBMS architecture

Statement

● DDLCREATE, ALTER, DROP, TRUNCATE, GRANT, AUDIT, COMMENTimplicit commit

● DMLSELECT, INSERT, UPDATE, MERGE, DELETE, EXPLAIN PLAN, LOCK TABLE

● Transaction ControlSET TRANSACTION, SAVEPOINT, COMMIT, ROLLBACK

● ALTER (session, system) ● embedded (into procedural program)

Page 14: Oracle RDBMS architecture

Statement - lifecycle

Page 15: Oracle RDBMS architecture

TransactionLogical unit of work that contains one or more SQL statements. All statements in a transaction commit or roll back together. The use of transactions is one of the most important ways that a database management system differs from a file system.

ACID● Atomicy

all or nothing

● Consistencyfrom one valid state to another

● Isolationtransactions does not interfer

● Durabilityjust stored

Page 16: Oracle RDBMS architecture

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 other transactions. This can be set by:SET TRANSACTION ISOLATION LEVEL READ COMMITTED; (transaction level)ALTER SESSION SET ISOLATION_LEVEL READ COMMITTED; (session level)

2. Serializable transactions A query can only access data that was committed at the start of the transaction. Modification from DML operations performed from 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 only A 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)

Page 17: Oracle RDBMS architecture

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, 12000 SAVEPOINT 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;

Page 18: Oracle RDBMS architecture

Transaction - redo/undo

Page 19: Oracle RDBMS architecture

Cluster

Page 20: Oracle RDBMS architecture

Cluster - Listener

Page 21: Oracle RDBMS architecture

Cluster - Listener II

Page 22: Oracle RDBMS architecture

Cluster - Listener III

Page 23: Oracle RDBMS architecture

Failover

Transparent Application Failover

if one instance dies, the client restarts the whole listener-connection-sequence, cursors are re-opened, statement re-run

limitations:

● 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 to handle errors in the 25400-25425 range and rollback appropriately.

Page 24: Oracle RDBMS architecture

TAF - errorsORA-25400: must replay fetchCause: A failure occured since the last fetch on this statement. Failover was able to bring the statement to its original state to allow continued fetches.

Action: This is an internally used error message and should not be seen by the user.

ORA-25401: can not continue fetchesCause: A failure occured since the last fetch on this statement. Failover was unable to bring the statement to its original state to allow continued fetches.

Action: Reexecute the statement and start fetching from the beginning

ORA-25402: transaction must roll backCause: A failure occured while a transaction was active on this connection.

Action: The client must roll back.

ORA-25403: could not reconnectCause: The connection to the database has been lost, and attempts to reconnect have failed.

Action: Manually reconnect.

ORA-25404: lost instanceCause: The primary instance has died.

Action: This is an internally used error message and should not be seen by the user.

ORA-25405: transaction status unknownCause: A failure occured while a transaction was attempting to commit. Failover could not automatically determine instance status.

Action: The user must determine the transaction's status manually.

ORA-25406: could not generate a connect addressCause: Failover was unable to generate an address for a backup instance.

Action: Contact Oracle customer support.

ORA-25407: connection terminatedCause: The connection was lost while doing a fetch.

Action: This is an internally used error message and should not be seen by the user.

ORA-25408: can not safely replay callCause: The connection was lost while doing this call. It may not be safe to replay it after failover.

Action: Check to see if the results of the call have taken place, and then replay it if desired.

ORA-25409: failover happened during the network operation,cannot continueCause: The connection was lost when fetching a LOB column.

Action: Failover happened when fetching LOB data directly or indirectly. Please replay the top level statement.

ORA-25425: connection lost during rollbackCause: The connection was lost while issuing a rollback and the application failed over.

Action: The connection was lost and failover happened during rollback. If the transaction is not externally coordinated, then Oracle implicitly rolled back, so no action is required. Otherwise examine pending_trans$ to determine if "rollback force" is required.

ORA-25426: remote instance does not support shared dblinksCause: 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.

Page 25: Oracle RDBMS architecture

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

Page 26: Oracle RDBMS architecture

further informations

Oracle Documentation - Concepts Guidehttp://docs.oracle.com/cd/E11882_01/server.112/e25789/toc.htm

ask● Ops.Oracle team● forums.oracle.com● http://www.freelists.org/list/oracle-l

read

Page 27: Oracle RDBMS architecture

credits

Arup Nanda - discussions about listenerAman Sharma - review of connect-flowSurachart Opun - general reviewMartin Schretzmeier - infrastructure infosOps.Oracle team - review

Page 28: Oracle RDBMS architecture

Next Presentations

● Physical structures & (SQL) tuning ● Capacity planning basics ● anything else?