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