Oracle11g新特性之Replay a captured workload 捕獲工作負載新環境重放負載測試壓力
《Oracle 資料庫11g新特性之效能優化篇》
【Replay a captured workload 捕獲工作負載新環境重放負載測試壓力】
引言:DB Replay工具是Oracle11g的一個新元件,它的加入有效的提高了Oracle在資料遷移、新環境部署、系統升級等場景下的效能監控與自動化優化能力。
真實案例:
一枚客戶希望識別環境改變帶來的全面影響,一般無法模擬真實環境的工作負載,而DB Repaly可以捕捉到舊環境下的工作負載生成負載檔案(包含工作壓力和併發性),並把負載檔案傳送到新環境,在用DB Repaly還原舊環境下的工作負載對新環境的影響,測試其效能情況和穩定性。
應用場合:1.資料庫升級
2.作業系統升級
3.儲存系統升級
4.資料遷移
5.新環境的部署
分析比較報告:1.錯誤
2.資料差異
3.效能差異
實現流程:
1.捕獲一個資料庫工作負載
2.預處理一個資料庫工作負載(把負載檔案處理為重放檔案)
3.重放一個資料庫工作負載
還原重放檔案用於重放
孤立環境引用
重放客戶機wrc模擬客戶端
4.新環境下的工作負載效能分析
一、使用Grid Control來完成設定與操作
1.負載檔案存放在capture目錄下
[oracle@leonarding1 scripts]$ cd capture/
[oracle@leonarding1 capture]$ ll
total 72
drwxr-xr-x 12 oracle dba 4096 Jul 24 22:29 inst1
-rw-r--r-- 1 oracle dba 37490 Jun 22 09:05 wcr_cr.html
-rw-r--r-- 1 oracle dba 18090 Jun 22 09:05 wcr_cr.text
-rw-r--r-- 1 oracle dba 314 Jun 22 09:05 wcr_fcapture.wmd 負載檔案
-rw-r--r-- 1 oracle dba 236 Jun 22 09:05 wcr_scapture.wmd
2.建立directory目錄物件
[oracle@leonarding1 ~]$ sqlplus / as sysdba
SYS@LEO1> create directory REPLAY_DIR2 as '/home/oracle/scripts/capture';
3.使用GC進行預處理preprocess和重放replay
預處理一個資料庫工作負載GC->LEO1->Software and Support->Real Application Testing->Database Replay

Prepare for Replay-> Preprocess Workload 點選右側的按鈕->處理“負載檔案”

Preprocess Captured Workload: Locate Workload 定位負載檔案位置,點選“Next“
The captured workload directory must be accessible from this database
這個捕獲目錄必須是資料庫可訪問的,有兩種方式來定位:我們選擇本地目錄來捕獲
(1)Copy the workload directory to this host from another host.
這個目錄可以從另一臺機器複製到本機
(2)Use an existing workload directory on this host.
直接使用本機上現有的負載檔案

Preprocess Captured Workload: Select Directory 選擇目錄物件 如果我們已經建立了目錄物件,點選“小手電”選擇我們剛剛建立的“REPLAY_DIR2”目錄物件,點選“Select”,這時將會自動載入現有的負載檔案資訊到GC,下面會顯示“Capture Summary”概述資訊,要想看詳細資訊請點選“Capture Details”

如果你還沒有建立目錄物件,那麼可以點選“Create directory Object”按鈕來建立
Name:REPLAY_DIR2
Path:/home/oracle/scripts/capture
載入舊環境工作負載檔案:capture -> /home/oracle/scripts目錄下,如下所示
drwxr-xr-x 12 oracle dba 4096 Jun 22 09:07 inst1
-rw-r--r-- 1 oracle dba 37490 Jun 22 09:05 wcr_cr.html
-rw-r--r-- 1 oracle dba 18090 Jun 22 09:05 wcr_cr.text
-rw-r--r-- 1 oracle dba 314 Jun 22 09:05 wcr_fcapture.wmd 這就是負載檔案
-rw-r--r-- 1 oracle dba 236 Jun 22 09:05 wcr_scapture.wmd
注:載入目錄必須有這些檔案,否則會報錯:顯示缺少.wmd型別檔案,如下所示
ORA-20222: Workload capture in "REPLAY_DIR2" is missing required .wmd files. ORA-06512: at "SYS.DBMS_WORKLOAD_CAPTURE", line 1121 ORA-06512: at line 1

Capture Summary頁面,顯示舊環境capture workload概述資訊,例如,點選“Next”
Captured Data Size (MB):0.81 捕獲資料量
Duration (hh:mm:ss)00:02:11 捕獲持續時間
Start Time:Dec 14, 2013 2:55:09 AM EST 捕獲開始時間
End Time:Dec 14, 2013 2:57:20 AM EST 捕獲結束時間
Start SCN:1827566 捕獲起始SCN
End SCN:1833512 捕獲結束SCN
AWR Data Exported:Not Possible AWR資料輸出
Preprocessed Database Version N/A 預處理資料版本
Preprocess Captured Workload: Schedule 建立預處理作業計劃,點選“Next”
Job Name:PREPROCESS-LEO1 -20140622095131
Dscription:leonarding
Start:Immediately
Host Credentials主機認證
UserName:oracle
Password:oracle
Confirm Password:oracle

Preprocess Captured Workload: Review 稽核提交資訊,點選“Submit”
Job Name:PREPROCESS-LEO1-20140622095131 預處理作業名字
Database:LEO1 資料庫名稱
Preprocessed Database Version:11.1.0.7.0 預處理資料庫版本
Directory Object:REPLAY_DIR2 目錄物件名稱
Directory Path:/home/oracle/scripts/capture 目錄物件路徑
Capture Name:CAPTURE-LEO1-20131214024942 捕獲負載名稱
Captured Data Size (MB):0.81 捕獲資料量
Start Time:Immediately 預處理作業立即執行
Job 'PREPROCESS-20140725021212' to prepare the workload has been created successfully. ' to prepare the workload has been created successfully.
預處理作業已經執行完畢

點選“View Job”檢視執行詳細資訊
一定看到Status:Succeeded成功才行,下面有個Error,預處理時會報錯但不影響replay

紅色的6個檔案是預處理後多出來的檔案
[oracle@leonarding1 capture]$ ll
total 212
drwxr-xr-x 12 oracle dba 4096 Jul 24 22:29 inst1
-rw-r----- 1 oracle dba 3586 Jul 25 02:17 wcr_calibrate.xml
-rw-r----- 1 oracle dba 12288 Jul 25 02:17 wcr_conn_data.extb
-rw-r--r-- 1 oracle dba 37490 Jun 22 09:05 wcr_cr.html
-rw-r--r-- 1 oracle dba 18090 Jun 22 09:05 wcr_cr.text
-rw-r--r-- 1 oracle dba 314 Jun 22 09:05 wcr_fcapture.wmd
-rw-r----- 1 oracle dba 692 Jul 25 02:17 wcr_login.pp
-rw-r----- 1 oracle dba 35 Jul 25 02:17 wcr_process.wmd
-rw-r--r-- 1 oracle dba 236 Jun 22 09:05 wcr_scapture.wmd
-rw-r----- 1 oracle dba 102400 Jul 25 02:17 wcr_scn_order.extb
-rw-r----- 1 oracle dba 12288 Jul 25 02:17 wcr_seq_data.extb
重放一個資料庫工作負載
GC->LEO1->Software and Support->Database Replay->Replay Workload on Test Database->Replay Workload 點選右側的按鈕

Replay Workload: Locate Workload 定位重放檔案位置,點選“Next”
The last replayed or preprocessed workload directory must be accessible from this database.
重放和預處理工作負載目錄必須是這個資料庫可訪問的,有兩種方式來定位:我們選擇本地目錄來捕獲
(1)Copy the workload directory to this host from another host.
這個目錄可以從另一臺機器複製到本機
(2)Use an existing workload directory on this host.
直接使用本機上現有的重放檔案

Replay Workload: Select Directory 選擇目錄物件,如果我們已經建立了目錄物件,點選“小手電”選擇我們剛剛建立的“REPLAY_DIR2”目錄物件,點選“Select”。這時將會自動載入現有的重放檔案資訊到GC,下面會顯示“Capture Summary”概述資訊,要想看詳細資訊請點選“Capture Details”

如果你還沒有建立目錄物件,那麼可以點選“Create directory Object”按鈕來建立
Name:REPLAY_DIR2
Path:/home/oracle/scripts/capture

預處理之後就會多出6個檔案
drwxr-xr-x 12 oracle dba 4096 Jun 22 09:07 inst1
-rw-r----- 1 oracle dba 3586 Jun 22 10:05 wcr_calibrate.xml
-rw-r----- 1 oracle dba 12288 Jun 22 10:05 wcr_conn_data.extb
-rw-r--r-- 1 oracle dba 37490 Jun 22 09:05 wcr_cr.html
-rw-r--r-- 1 oracle dba 18090 Jun 22 09:05 wcr_cr.text
-rw-r--r-- 1 oracle dba 314 Jun 22 09:05 wcr_fcapture.wmd
-rw-r----- 1 oracle dba 692 Jun 22 10:05 wcr_login.pp
-rw-r----- 1 oracle dba 35 Jun 22 10:05 wcr_process.wmd
-rw-r--r-- 1 oracle dba 236 Jun 22 09:05 wcr_scapture.wmd
-rw-r----- 1 oracle dba 102400 Jun 22 10:05 wcr_scn_order.extb
-rw-r----- 1 oracle dba 12288 Jun 22 10:05 wcr_seq_data.extb
選擇目錄物件之後就會自動載入目錄下的capture檔案,Capture Summary頁面,顯示舊環境capture workload概述資訊,點選“Next”
Replay Workload: Initialize Options 初始化選項:Use the default replay options,什麼也不用動,點選“Next”
Repaly Name:LEO1-20140622102711 自動生成重放作業名

Replay Workload: Customize Options 定製選項,什麼都不用動,點選“Next”
Connections Mapping 選項卡上點選“Test Connection”測試,顯示Information:The connection test was successful.表示連線成功
Use a single connect descriptor for all client connections. 所有客戶端選擇“連線串”連線服務端
Replay Parameters 選項卡可以設定重放引數,例如如下引數
Synchronization 同步引數:保證capture時SQL提交的順序與replay時提交的順序一致
connect time scale 連線時間尺度:重放開始時刻到第一個會話連線上時的間隔時間
think time scale 思考時間尺度:兩個SQL執行之間的間隔時間,預設同capture時一致
think time auto correct 思考時間自動校準:調整think time引數可以自動校準兩條SQL執行之間的間隔時間

Replay Workload: Prepare Replay Clients 準備重放客戶機,點選Next
Number of Replay Clients and CPUs,點選“Estimate”,可以評估出重放客戶端數量和CPU數量

Replay Client Hosts,點選“Add Replay Client Hosts”選擇重放客戶機主機,預設本機

Replay Workload: Wait for Client Connections 等待客戶機連線
資料庫已經準備接收來自replay client重放客戶機的連線

資料庫正在等待replay client重放客戶機連線,你現在可以啟動replay client重放客戶機

啟動Replay Clients重放客戶機連線伺服器
[oracle@leonarding1 capture]$ wrc system/oracle@LEO1 replaydir=/home/oracle/scripts/capture mode=replay
system/oracle@LEO1:system是客戶機預設許可權使用者
replaydir=/home/oracle/scripts/capture:是重放檔案的路徑
mode=replay:預設模式,模擬客戶端併發連線
如果你沒有啟動資料庫重放服務,就啟動了Replay Clients重放客戶機連線伺服器,就會報錯
[oracle@leonarding1 capture]$ wrc system/oracle replaydir=/home/oracle/scripts/capture mode=replay
Workload Replay Client: Release 11.1.0.7.0 - Production on Sun Jun 22 11:13:02 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Errors in file :
ORA-15554: cannot start workload replay client because the database server is not in PREPARE mode
不能啟動replay client重放客戶機,因為資料庫服務是不準備模式(即Replaying不是重放模式)
如果發現 Actual Number of Client Connections(實際客戶端連線數)為1,點選“Next”
Expected Number of Client Connections(預期客戶端連線數)為0
實際我們就啟動了一個客戶端-符合,這個應該馬上就會顯示出來。

Replay Workload: Review 稽核提交資訊
Database LEO1
Capture Name :CAPTURE-LEO1-20131214024942
Replay Name:REPLAY-LEO1-20140725025417
Directory Object:REPLAY_DIR2
Connected Replay Clients:1
Client Connections
預期客戶端連線數Expected Number of Client Connections:0
實際客戶端連線數Actual Number of Client Connections:1
正在執行工作負載Repaly重放

正在收集工作負載效能資訊用於分析,需要等待1分鐘,Status:Completed

Elapsed Time Comparison消耗時間對比,Detailed Comparison詳細資訊對比
Capture:2:11
Replay:1:05

點選“View Workload Replay Report”建立工作負載重放報告

Save to File:儲存對比報告,下載路徑是桌面
OK:返回資料庫重放主頁面

劉盛&Leonarding
2015.05.08
天津&spring
分享技術~成就夢想
Blog:www.leonarding.com
如果喜歡我的文章就請掃下面二維碼吧!關注微訊號:leonarding_public
在這裡你能得到技術、實事、熱點訊息等新興事物的思考和觀點,別的地方可能沒有的東西。我將為大家提供最新技術與資訊動態,傳遞正能量。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26686207/viewspace-1649425/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- (一)效能測試(壓力測試、負載測試)負載
- jmeter壓力測試實現負載均衡JMeter負載
- 開源的負載測試/壓力測試工具 NBomber負載
- 效能測試、負載測試、壓力測試有什麼區別?負載
- 介面測試,負載測試,併發測試,壓力測試區別負載
- jmeter 負載壓測JMeter負載
- JMeter分散式壓測/JMeter負載新增/jmeter負載均衡/jmeter Windows系統壓測負載新增JMeter分散式負載Windows
- Kubernetes之Pod工作負載負載
- 軟體測評中心▏效能測試、壓力測試、負載測試有什麼區別?負載
- 面試之負載均衡面試負載
- 負載均衡環境搭建實戰之apache和tomcat負載ApacheTomcat
- 經緯創投:新冠經濟負面壓力評測創投
- Linux環境下Nginx及負載均衡LinuxNginx負載
- 負載,效能測試工具-Gatling負載
- 在 kubernetes 環境中實現 gRPC 負載均衡RPC負載
- 動手實現一致性雜湊演算法,並搭建環境測試其負載均衡特性.演算法負載
- Locust 進行分散式負載測試分散式負載
- 負載均衡之keepalived負載
- Ambassador 0.52 新特性:會話親和性、負載均衡控制、gRPC-Web會話負載RPCWeb
- Linux環境搭建Nginx+Tomcat負載均衡叢集LinuxNginxTomcat負載
- ubuntu環境下掛載新硬碟(轉載)Ubuntu硬碟
- k8s工作負載資源之deploymentK8S負載
- 多通道負載測試和效能評估?負載
- 【SpringCloud】之Ribbon負載均衡SpringGCCloud負載
- kubernetes實踐之四十六:分散式負載測試Locust分散式負載
- 動力為正,壓力為負
- gRPC負載均衡(自定義負載均衡策略)RPC負載
- gRPC負載均衡(客戶端負載均衡)RPC負載客戶端
- 使用JMeter進行負載測試快速入門JMeter負載
- 負載均衡是什麼?怎麼理解負載均衡的部署方式和工作原理負載
- 負載均衡負載
- 高壓1000kW船舶測試交流乾式負載箱發展趨勢負載
- 負載均衡之--Nginx、LVS、HAProxy負載Nginx
- nginx學習之負載均衡Nginx負載
- Spring Cloud Gateway之負載均衡SpringCloudGateway負載
- MySQL Route負載均衡與讀寫分離Docker環境使用MySql負載Docker
- Oracle ORION模擬Database負載測試儲存效能OracleDatabase負載
- LNMP+HAProxy+Keepalived負載均衡(一)- LNMP基礎環境準備LNMP負載
- Nginx負載均衡之健康檢查Nginx負載