11gOCM考試大綱
session 4 5 6 佔的比例最大
11gServer Configuration
將資料檔案建立到NFS上。
用opath打補丁
Direct NFS資料庫拓撲結構
Oracle直接客戶端掃描順序
local:本地的網段
path:nfs伺服器的ip
最多支援將資料檔案放到四個nfs伺服器中。
最後編譯一下
Enterprise Manager Grid Control
Management Database Available
Data Management
並行
配置 和管理並行查詢:
10g沒有這個引數parallel_degree_policy
點選(此處)摺疊或開啟
-
sys@TESTDB12>alter session set parallel_degree_policy=auto;
-
-
Session altered. --自動實現並行,那麼就設定成auto的。
-
-
sys@TESTDB12>alter session set parallel_min_time_threshold=20;
-
- Session altered. --oracle估計,如果超過20s那麼就開啟並行。
啟動並行DML
點選(此處)摺疊或開啟
-
sh@TESTDB12>create table little_sales
-
2 partition by hash (time_id)
-
3 (partition ls1,partition ls2)
-
4 parallel
-
5 as
-
6 select * from sales where 1=2;
-
- Table created.
點選(此處)摺疊或開啟
-
sh@TESTDB12>insert into little_sales
-
2 select *
-
3 from sales
-
4 where rownum < 5000;
-
- 4999 rows created.
這個檢視可以看到上一個的操作是否用到並行。
點選(此處)摺疊或開啟
-
sh@TESTDB12>select * from v$pq_sesstat;
-
-
STATISTIC LAST_QUERY SESSION_TOTAL
-
------------------------------ ---------- -------------
-
Queries Parallelized 0 1
-
DML Parallelized 0 0
-
DDL Parallelized 0 0
-
DFO Trees 0 1
-
Server Threads 0 0
-
Allocation Height 0 0
-
Allocation Width 0 0
-
Local Msgs Sent 0 66
-
Distr Msgs Sent 0 0
-
Local Msgs Recv\'d 0 66
-
Distr Msgs Recv\'d 0 0
-
- 11 rows selected.
啟動dml並行
點選(此處)摺疊或開啟
-
sh@TESTDB12>alter session enable parallel dml;
-
點選(此處)摺疊或開啟
-
sh@TESTDB12>insert into little_sales
-
2 select * from sales;
-
-
918843 rows created.
-
-
sh@TESTDB12>select * from v$pq_sesstat;
-
-
STATISTIC LAST_QUERY SESSION_TOTAL
-
------------------------------ ---------- -------------
-
Queries Parallelized 0 1
-
DML Parallelized 1 1
-
DDL Parallelized 0 0
-
DFO Trees 1 2
-
Server Threads 2 0 --這裡說的是總共的並行程式數
-
Allocation Height 2 0 --這裡說明每個表上有2個程式在做並行
-
Allocation Width 1 0
-
Local Msgs Sent 2105 66
-
Distr Msgs Sent 0 0
-
Local Msgs Recv\'d 8 66
-
Distr Msgs Recv\'d 0 0
-
- 11 rows selected.
這裡並行最大的 parallel_max_servers是20
點選(此處)摺疊或開啟
-
create table temp_channels
-
parallel 5 as
-
select * from sh.channels
- where channel_id in ('2','3','4');
點選(此處)摺疊或開啟
-
sys@TESTDB12>alter system set parallel_max_servers=5; --最大並行度設定成5
-
-
System altered.
-
-
sys@TESTDB12>alter system set parallel_adaptive_multi_user = false;
-
- System altered.
點選(此處)摺疊或開啟
-
create table temp_sales nologging parallel 5 as
-
select * from sh.sales
- where channel_id in ('2','3');
點選(此處)摺疊或開啟
-
select count(*) from temp_sales s ,temp_channels c
-
where (s.channel_id) = (c.channel_id);
-
-
COUNT(*)
-
----------
- 798353
點選(此處)摺疊或開啟
-
sh@TESTDB12>select * from v$pq_sesstat;
-
-
STATISTIC LAST_QUERY SESSION_TOTAL
-
------------------------------ ---------- -------------
-
Queries Parallelized 1 3
-
DML Parallelized 0 0
-
DDL Parallelized 0 3
-
DFO Trees 1 6
-
Server Threads 4 0 --4個並行
-
Allocation Height 2 0 --兩張表
-
Allocation Width 1 0
-
Local Msgs Sent 88 611
-
Distr Msgs Sent 0 0
-
Local Msgs Recv\'d 88 611
- Distr Msgs Recv\'d 0 0
點選(此處)摺疊或開啟
-
alter system set parallel_max_servers = 20;
-
點選(此處)摺疊或開啟
-
sh@TESTDB12>select * from v$pq_sesstat;
-
-
STATISTIC LAST_QUERY SESSION_TOTAL
-
------------------------------ ---------- -------------
-
Queries Parallelized 1 4
-
DML Parallelized 0 0
-
DDL Parallelized 0 3
-
DFO Trees 1 7
-
Server Threads 10 0 --2張表總共啟動並行數
-
Allocation Height 5 0 --1張表的並行數
-
Allocation Width 1 0
-
Local Msgs Sent 223 834
-
Distr Msgs Sent 0 0
-
Local Msgs Recv\'d 223 834
- Distr Msgs Recv\'d 0 0
效能調優
使用結果池
結果集(result cache):只是把計算後的結果,放在shared pool中。
點選(此處)摺疊或開啟
-
idle>create user grc identified by grc
-
2 default tablespace users
-
3 temporary tablespace temp;
-
-
User created.
-
-
idle>grant connect , resource ,dba to grc;
-
-
Grant succeeded.
-
-
idle>conn grc/grc
-
Connected.
-
grc@TESTDB12>exec dbms_result_cache.flush;
-
- PL/SQL procedure successfully completed.
-
-
grc@TESTDB12>create table cachejfv (c varchar2(500)) tablespace users;
-
- Table created.
-
- grc@TESTDB12>insert into cachejfv values(\'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\');
-
- grc@TESTDB12>insert into cachejfv select * from cachejfv;
-
-
2097152 rows created. --插入4194304條資料。
-
- grc@TESTDB12>insert into cachejfv values ('b');
- grc@TESSDB12>commit;
-
-
grc@TESTDB12>alter system flush buffer_cache;
點選(此處)摺疊或開啟
-
grc@TESTDB12>show parameter result
-
-
NAME TYPE VALUE
-
------------------------------------ ----------- ------------------------------
-
client_result_cache_lag big integer 3000
-
client_result_cache_size big integer 0
-
result_cache_max_result integer 5
-
result_cache_max_size big integer 2080K
-
result_cache_mode string MANUAL
- result_cache_remote_expiration integer 0
點選(此處)摺疊或開啟
-
grc@TESTDB12>select /*+ result_cache q_name(Q1) */ count(*) --不使用hint就不會用到結果集
-
2 from cachejfv c1 ,cachejfv c2 ,cachejfv c3 ,cachejfv c4,cachejfv c5
-
3 where c1.c ='b' and c2.c='b' and c3.c='b' and c4.c='b' and c5.c='b';
-
-
COUNT(*)
-
----------
-
1
-
-
-
Execution Plan
-
----------------------------------------------------------
-
Plan hash value: 2522916280
-
-
--------------------------------------------------------------------------------------------------------
-
| Id | Operation | Name | Rows | Bytes | Cost (%CPU) | Time |
-
--------------------------------------------------------------------------------------------------------
-
| 0 | SELECT STATEMENT | | 1 | 1260 | 286T (1) |999:59:59 |
-
| 1 | RESULT CACHE | 2czdyj48767d90j12kd0bvvbrd | | | | |
-
| 2 | SORT AGGREGATE | | 1 | 1260 | | |
-
| 3 | MERGE JOIN CARTESIAN | | 11T | 12P | 286T (1) |999:59:59 |
-
| 4 | MERGE JOIN CARTESIAN | | 28G | 25T | 700G (1) |999:59:59 |
-
| 5 | MERGE JOIN CARTESIAN | | 68M | 48G | 1708M (1) |999:59:59 |
-
| 6 | MERGE JOIN CARTESIAN| | 167K | 80M | 4169K (1) | 13:53:51 |
-
|* 7 | TABLE ACCESS FULL | CACHEJFV | 410 | 100K | 10146 (1) | 00:02:02 |
-
| 8 | BUFFER SORT | | 410 | 100K | 4159K (1) | 13:51:49 |
-
|* 9 | TABLE ACCESS FULL | CACHEJFV | 410 | 100K | 10144 (1) | 00:02:02 |
-
| 10 | BUFFER SORT | | 410 | 100K | 1708M (1) |999:59:59 |
-
|* 11 | TABLE ACCESS FULL | CACHEJFV | 410 | 100K | 10144 (1) | 00:02:02 |
-
| 12 | BUFFER SORT | | 410 | 100K | 700G (1) |999:59:59 |
-
|* 13 | TABLE ACCESS FULL | CACHEJFV | 410 | 100K | 10144 (1) | 00:02:02 |
-
| 14 | BUFFER SORT | | 410 | 100K | 286T (1) |999:59:59 |
-
|* 15 | TABLE ACCESS FULL | CACHEJFV | 410 | 100K | 10144 (1) | 00:02:02 |
-
--------------------------------------------------------------------------------------------------------
-
-
Predicate Information (identified by operation id):
-
---------------------------------------------------
-
-
7 - filter(\"C1\".\"C\"=\'b\')
-
9 - filter(\"C2\".\"C\"=\'b\')
-
11 - filter(\"C3\".\"C\"=\'b\')
-
13 - filter(\"C4\".\"C\"=\'b\')
-
15 - filter(\"C5\".\"C\"=\'b\')
-
-
Result Cache Information (identified by operation id):
-
------------------------------------------------------
-
-
1 - column-count=1; dependencies=(GRC.CACHEJFV); attributes=(single-row); parameters=(nls); name=\"select /*+ result_cache q_name(Q1) */ count(*)
-
from cachejfv c1 ,cachejfv c2 ,cachejfv c3 ,cachejfv c4,cachejfv c5
-
where c1.c =\'\"
-
-
-
Note
-
-----
-
- dynamic sampling used for this statement (level=2)
-
-
-
Statistics
-
----------------------------------------------------------
-
21 recursive calls
-
10 db block gets
-
358165 consistent gets
-
182445 physical reads
-
0 redo size
-
526 bytes sent via SQL*Net to client
-
523 bytes received via SQL*Net from client
-
2 SQL*Net roundtrips to/from client
-
4 sorts (memory)
- 0 sorts (disk)
點選(此處)摺疊或開啟
-
1 select type,status,name,object_no,row_count,row_size_avg
-
2* from v$result_cache_objects order by 1
-
-
TYPE STATUS NAME OBJECT_NO ROW_COUNT ROW_SIZE_AVG
-
---------- --------- ------------------------------ ---------- ------------ -------------
-
Dependency Published GRC.CACHEJFV 76977 0 0
-
Result Published select /*+ result_cache q_name 0 1 5
-
(Q1) */ count(*)
-
from cachejfv c1 ,cachejfv c2,cachejfv c3
- ,cachejfv c4,cachejfv c5 where c1.C =
點選(此處)摺疊或開啟
-
grc@TESTDB12>exec dbms_result_cache.memory_report(detailed=>true);
-
R e s u l t C a c h e M e m o r y R e p o r t
-
[Parameters]
-
Block Size = 1K bytes
-
Maximum Cache Size = 2080K bytes (2080 blocks)
-
Maximum Result Size = 104K bytes (104 blocks)
-
[Memory]
-
Total Memory = 168920 bytes [0.064% of the Shared Pool]
-
... Fixed Memory = 5352 bytes [0.002% of the Shared Pool]
-
....... Memory Mgr = 200 bytes
-
....... Cache Mgr = 208 bytes
-
....... Bloom Fltr = 2K bytes
-
....... State Objs = 2896 bytes
-
... Dynamic Memory = 163568 bytes [0.062% of the Shared Pool]
-
....... Overhead = 130800 bytes
-
........... Hash Table = 64K bytes (4K buckets)
-
........... Chunk Ptrs = 24K bytes (3K slots)
-
........... Chunk Maps = 12K bytes
-
........... Miscellaneous = 28400 bytes
-
....... Cache Memory = 32K bytes (32 blocks)
-
........... Unused Memory = 30 blocks
-
........... Used Memory = 2 blocks
-
............... Dependencies = 1 blocks (1 count)
-
............... Results = 1 blocks
-
................... SQL = 1 blocks (1 count)
-
- PL/SQL procedure successfully completed.
DG
備份可以在備庫上備份就可以啦
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-1346325/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- C語言考試大綱(參考)C語言
- 10G-OCM考試簡介--考試環境-考試大綱-考試安排
- Oracle 11g OCM 升級考試 考試大綱Oracle
- Oracle 11g OCM 考試大綱Oracle
- 資料結構考試大綱要求資料結構
- 【OCM】Oracle 12c OCM 考試大綱Oracle
- 【OCM】Oracle 11g OCM 考試大綱Oracle
- 【OCM】Oracle 10g OCM 考試大綱Oracle 10g
- 初級程式設計師考試大綱 (轉)程式設計師
- 高階程式設計師考試大綱 (轉)程式設計師
- 全國計算機等級考試2008最新考試大綱計算機
- 資料庫系統工程師考試大綱資料庫工程師
- Oracle 11g OCM官網升級考試大綱Oracle
- 系統整合專案管理工程師考試大綱專案管理工程師
- 軟體測試大綱
- 【OCM】Oracle 12C OCMU 12c OCM升級考試大綱Oracle
- IBM AIX 5L 系統管理員認證考試大綱IBMAI
- 【期末考試季】JAVA進階複習提綱Java
- 程式設計師級資格與水平考試大綱(2003年) (轉)程式設計師
- 備考進行時!2020年中級通訊工程師傳輸與接入(無線)考試大綱工程師
- java 學習:101軟體開發工程師(JAVA)初級考試大綱《2》Java工程師
- spark大綱Spark
- 軟體測試要學什麼(5)效能測試大綱
- Python 自動化測試開發大綱Python
- Java面試大綱Java面試
- 教學大綱
- OCP考試解析大師網址
- 《中國近代史綱要》考試過關?Python幫你劃重點Python
- go 基礎大綱Go
- 設計模式-大綱設計模式
- Android面試大綱Android面試
- 前端 CSS 面試大綱前端CSS面試
- 設計模式大綱設計模式
- 杭州電子科技大學2018年自命題科目考試大綱(資料結構與組成原理)資料結構
- Java高階軟體工程師面試考綱Java軟體工程工程師面試
- 質量度量分析與測試技術 培訓大綱
- 【效能測試】效能測試各知識第1篇:效能測試大綱【附程式碼文件】
- React原始碼精度大綱React原始碼