Oracle Basics and Architecture

9,573 views

Published on

Published in: Technology
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,573
On SlideShare
0
From Embeds
0
Number of Embeds
392
Actions
Shares
0
Downloads
655
Comments
0
Likes
9
Embeds 0
No embeds

No notes for slide
  • From Shop.oracle.comUS$47,500.00 / Processor for Enterprise EditionUS$23,000.00 / Processor for RACUS$11,500.00 / Processor for Partition
  • Oracle Basics and Architecture

    1. 1. Oracle Architecture<br />1<br />
    2. 2. Cost: Enterprise Edition<br />US$47,500.00 / Processor<br />2<br />
    3. 3. Agenda<br />What is Oracle<br />instance<br />Database<br />Listener<br />Cost Base Optimizer<br />3<br />
    4. 4. 4<br />The more you understand<br />The less you need to memorize<br />more<br />Memorize<br />less<br />Shallow<br />In-depth<br />Understanding<br />
    5. 5. 5<br />
    6. 6. Before startup<br />Connected to an idle instance.<br />sys@CS11GR2> !ps -ef | grepcs11gR2 | grep -v grep<br />sys@CS11GR2> !ipcs -m<br />------ Shared Memory Segments --------<br />key shmid owner perms bytes nattch status<br />6<br />
    7. 7. instance startup<br />sys@CS11GR2> startup nomount<br />ORACLE instance started.<br />Total System Global Area 535662592 bytes<br />Fixed Size 1337720 bytes<br />Variable Size 322963080 bytes<br />Database Buffers 205520896 bytes<br />Redo Buffers 5840896 bytes<br />7<br />
    8. 8. After instance is started<br />sys@CS11GR2> !ipcs -m<br />------ Shared Memory Segments --------<br />key shmid owner perms bytes nattch status<br />0x44c4474c 360449 oracle 660 538968064 16<br />8<br />
    9. 9. 9<br />Instance<br />System Global Area<br />Shared Pool<br />Server Processes<br />Database<br />Buffer Cache<br />Library Cache<br />Redo Log Buffer<br />Data Dictionary Cache<br />Listener<br />Oracle Background Processes<br />System Monitor<br />(SMON)<br />Database<br />Writer<br />(DBW0)<br />Process<br />Monitor<br />(PMON)<br />Check Point<br />(CKPT)<br />Log<br />Writer<br />(LGWR)<br />Archiver<br />(ARC0)<br />Client Processes<br />DataBase<br />Data<br />Files<br />Control<br />Files<br />Redo Log Files<br />
    10. 10. After instance is started<br />sys@CS11GR2> !ps -ef | grepcs11gR2| grep -v grep<br />oracle 13134 1 0 13:54 ? 00:00:00 ora_dbw0_cs11gR2<br />oracle 13136 1 0 13:54 ? 00:00:00 ora_lgwr_cs11gR2 .<br /> .<br /> .<br />oracle 13116 1 0 13:54 ? 00:00:00 ora_pmon_cs11gR2 <br />oracle 13140 1 0 13:54 ? 00:00:00 ora_smon_cs11gR2<br />SQL> !ps -ef | grep cs11gR2 | grep -v grep | wc -l<br />16<br />10<br />
    11. 11. 11<br />Instance<br />System Global Area<br />Shared Pool<br />Server Processes<br />Database<br />Buffer Cache<br />Library Cache<br />Redo Log Buffer<br />Data Dictionary Cache<br />Listener<br />Oracle Background Processes<br />System Monitor<br />(SMON)<br />Database<br />Writer<br />(DBW0)<br />Process<br />Monitor<br />(PMON)<br />Check Point<br />(CKPT)<br />Log<br />Writer<br />(LGWR)<br />Archiver<br />(ARC0)<br />Client Processes<br />DataBase<br />Data<br />Files<br />Control<br />Files<br />Redo Log Files<br />
    12. 12. Open the Database<br />sys@CS11GR2> alter database mount;<br />Database altered.<br />sys@CS11GR2> alter database open;<br />Database altered.<br />sys@CS11GR2> select * from sid.emp where ename='SMITH';<br />EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO<br />------ ---------- --------- ------ --------- ----- ------ --------<br /> 7369 SMITH CLERK 7902 17-DEC-80 800 20<br />1 row selected.<br />12<br />
    13. 13. 13<br />Instance<br />System Global Area<br />Shared Pool<br />Server Processes<br />Database<br />Buffer Cache<br />Library Cache<br />Redo Log Buffer<br />Data Dictionary Cache<br />Listener<br />Oracle Background Processes<br />System Monitor<br />(SMON)<br />Database<br />Writer<br />(DBW0)<br />Process<br />Monitor<br />(PMON)<br />Check Point<br />(CKPT)<br />Log<br />Writer<br />(LGWR)<br />Archiver<br />(ARC0)<br />Client Processes<br />DataBase<br />Data<br />Files<br />Control<br />Files<br />Redo Log Files<br />
    14. 14. Connect from RemoteFailed!<br />C:Documents and Settingschensi4>sqlplussid/sid@cs11g<br />SQL*Plus: Release 10.2.0.1.0 - Production on Sun Jul 24 20:29:17 2011<br />Copyright (c) 1982, 2005, Oracle. All rights reserved.<br />ERROR:<br />ORA-12541: TNS:no listener<br />14<br />
    15. 15. Startup the Listener<br />oracle@cargosmart:~/scripts$ lsnrctl start<br />Service "cs11gR2" has 1 instance(s).<br /> Instance "cs11gR2", status READY, has 1 handler(s) for this service...<br />The command completed successfully<br />15<br />
    16. 16. Now query from Remote<br />C:Documents and Settingschensi4>sqlplussid/sid@cs11gR2<br />Connected to:<br />Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production<br />With the Partitioning, OLAP, Data Mining and Real Application Testing options<br />SQL> select * from emp where ename='SMITH';<br /> EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO<br />------- ------- ------- ----- --------- ----- ------ --------<br /> 7369 SMITH CLERK 7902 17-DEC-80 800 20<br />1 row selected.<br />16<br />
    17. 17. 17<br />Instance<br />System Global Area<br />Shared Pool<br />Server Processes<br />Database<br />Buffer Cache<br />Library Cache<br />Redo Log Buffer<br />Data Dictionary Cache<br />Listener<br />Oracle Background Processes<br />System Monitor<br />(SMON)<br />Database<br />Writer<br />(DBW0)<br />Process<br />Monitor<br />(PMON)<br />Check Point<br />(CKPT)<br />Log<br />Writer<br />(LGWR)<br />Archiver<br />(ARC0)<br />Client Processes<br />DataBase<br />Data<br />Files<br />Control<br />Files<br />Redo Log Files<br />
    18. 18. What Oracle Do<br />When you submit a SQL<br />From pl/sql develop<br />From the JDBC API in your java application<br />From sqlplus<br />18<br />
    19. 19. 19<br />SELECT AVG(SAL) <br />FROM EMP <br />WHERE DEPTNO IN <br /> (SELECT DEPTNO <br /> FROM DEPT <br /> WHERE DNAME='SALES')<br />Parser<br />
    20. 20. 20<br />SELECT AVG(SAL) <br />FROM EMP <br />WHERE DEPTNO IN <br /> (SELECT DEPTNO <br /> FROM DEPT <br /> WHERE DNAME='SALES')<br />Parser<br />
    21. 21. 21<br />SELECT AVG(SAL) <br />FROM DEPT, EMP <br />WHERE EMP.DEPTNO=DEPT.DEPTNO AND DEPT.DNAME='SALES';<br />Query Transformer<br />Transformed Query<br />Statistics<br />Estimator<br />Data Dictionary<br />Query + Cost<br />Plan Generator<br />
    22. 22. 22<br />Query Transformer<br />Transformed Query<br />Statistics<br />Estimator<br />Data Dictionary<br />Query + Cost<br />Plan Generator<br />
    23. 23. 23<br />Query Plan<br />Row Source<br />Generator<br />SQL Execution<br />Result<br />
    24. 24. A Real Plan<br />----------------------------------------------------------------------<br />| Id | Operation | Name | Rows | Cost (%CPU)|<br />----------------------------------------------------------------------<br />| 0 | SELECT STATEMENT | | 1 | 6 (17)|<br />| 1 | SORT AGGREGATE | | 1 | |<br />| 2 | MERGE JOIN | | 5 | 6 (17)|<br />|* 3 | TABLE ACCESS BY INDEX ROWID| DEPT | 1 | 2 (0)|<br />| 4 | INDEX FULL SCAN | DEPT_PK | 4 | 1 (0)|<br />|* 5 | SORT JOIN | | 14 | 4 (25)|<br />| 6 | TABLE ACCESS FULL | EMP | 14 | 3 (0)|<br />----------------------------------------------------------------------<br />Predicate Information (identified by operation id):<br />---------------------------------------------------<br /> 3 - filter("DNAME"='SALES')<br /> 5 - access("DEPTNO"="DEPTNO")<br /> filter("DEPTNO"="DEPTNO")<br />24<br />
    25. 25. Q & A<br />25<br />

    ×