10G遷移升級到11G使用SPA 分析SQL效能例項
10G database 執行
14:35:34 SQL> EXEC DBMS_SQLTUNE.create_sqlset(sqlset_name =>
'RAC38N1',description => 'SPA TEST');
PL/SQL procedure successfully completed
Executed in 0.109 seconds
將快照ID 20660,20661 的SQL 放到SQLSET
14:46:04 SQL> declare cur sys_refcursor;
2 begin
3 open cur for
4 SELECT VALUE(P) FROM
5 TABLE(DBMS_SQLTUNE.select_workload_repository(20660,20661))
p;
6 dbms_sqltune.load_sqlset(sqlset_name =>
'RAC38N1',populate_cursor => cur);
7 close cur;
8 end;
9 /
PL/SQL procedure successfully completed
Executed in 0.546 seconds
--也可以用V$SQL中的符合條件的SQL_TEXT建立SQLSET
-- dbms_sqltune.select_cursor_cache('sql_text like ''select * from
mytab%''',
null,null,null,null,null,null,'ALL'))
P;
--也可以用V$SQL中的符合條件的SQL_ID建立SQLSET
-- dbms_sqltune.select_cursor_cache('sql_text = ''YOUR SQL_ID''',
null,null,null,null,null,null,'ALL'))
P;
檢視SQLSET中的內容
select * from table(dbms_sqltune.select_sqlset('RAC38N1'));
......result
將10G環境的SQLSET傳輸到 11G 環境
--transporting
首先在10G中建立儲存SQLSET 的表
14:46:06 SQL> exec dbms_sqltune.create_stgtab_sqlset(table_name =>
'SPA_38N1',schema_name => 'PAYADM');
PL/SQL procedure successfully completed
Executed in 0.438 seconds
將SQLSET的內容PACK到表中
14:51:24 SQL> EXEC DBMS_SQLTUNE.pack_stgtab_sqlset(sqlset_name =>
'RAC38N1',
staging_table_name =>
'SPA_38N1',
staging_schema_owner
=> 'PAYADM');
PL/SQL procedure successfully completed
Executed in 1.047 seconds
11G database 執行
使用EXPDP或者DBLINK的方式將儲存SQLSET內容的表結構內容傳到11G資料庫55.52
執行下面語句將SQLSET 載入到11G SQLSET
15:04:43 SQL> EXEC DBMS_SQLTUNE.unpack_stgtab_sqlset(sqlset_name =>
'RAC38N1',
replace =>
TRUE,
staging_table_name
=> 'SPA_38N1',
staging_schema_owner
=> 'PAYADM');
PL/SQL procedure successfully completed
Executed in 0.422 seconds
建立analysis_task RAC38N1
DECLARE V_SPA_NAME VARCHAR2(100);
BEGIN
V_SPA_NAME:=spa_dbms_xhl.create_analysis_task(sqlset_name =>
'RAC38N1',task_name => 'spa_38_task');
dbms_output.put_line('spa_name='||v_spa_name);
end;
/
如果沒有安裝real application testing 元件將報下面錯誤
ORA-00438: 未安裝 Real Application Testing 選件
ORA-06512: 在 "SYS.PRVT_SMGUTIL", line 80
ORA-06512: 在 "SYS.DBMS_SQLPA", line 220
ORA-06512: 在 line 4
shutdown 資料庫 執行$ORACLE_HOME/oui/runInstaller 新增此元件
9:38:20 SQL> DECLARE V_SPA_NAME VARCHAR2(100);
2 BEGIN
3 V_SPA_NAME:=dbms_sqlpa.create_analysis_task(sqlset_name =>
'RAC38N1',task_name => 'spa_38_task');
4 dbms_output.put_line('spa_name='||v_spa_name);
5 end;
6 /
PL/SQL procedure successfully completed
Executed in 0.578 seconds
生成10G 的trail
9:42:35 SQL> exec dbms_sqlpa.execute_analysis_task(task_name =>
'spa_38_task',
execution_type =>
'CONVERT SQLSET',
execution_name =>
'SPA_3810G');
PL/SQL procedure successfully completed
生成11G 的trail
9:43:57 SQL> exec dbms_sqlpa.execute_analysis_task(task_name =>
'spa_38_task',
execution_type =>
'TEST EXECUTE',
execution_name =>
'SPA_5211G');
PL/SQL procedure successfully completed
Executed in 57.484 seconds
開始比較
9:54:54 SQL>
elapsed_time 比較
exec dbms_sqlpa.execute_analysis_task(task_name =>
'spa_38_task',execution_type => 'COMPARE PERFORMANCE',
execution_name =>
'compare_elp_time',
execution_params =>
dbms_advisor.argList('comparison_metric','elapsed_time'));
buffer_gets 比較
exec dbms_sqlpa.execute_analysis_task(task_name =>
'spa_38_task',execution_type => 'COMPARE PERFORMANCE', execution_name =>
'compare_buff_gets', execution_params =>
dbms_advisor.argList('comparison_metric','buffer_gets'));
PL/SQL procedure successfully completed
Executed in 0.532 seconds
生成比較報告
select dbms_sqlpa.report_analysis_task('spa_38_task','HTML','ALL','ALL')
FROM DUAL
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28869493/viewspace-1159659/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 11g SPA SQL Performance Analyzer升級測試SQLORM
- 同例項下不同使用者之前的表級遷移
- 10g升級到11g密碼問題密碼
- weblogic版本升級遷移需要注意事項Web
- SQL Server升級和遷移的三個技巧GZSQLServer
- 模擬11G單例項到12C的資料遷移過程單例
- 如何將.Net SOE遷移升級到10.1上
- SQL 效能分析器(SPA)工具概覽SQL
- SQL Server 2016升級遷移過程中效能問題解決案例SQLServer
- ORACLE 從10G 單機 並升級到11G RAC時報錯分析處理Oracle
- Oracle從10g升級到11g詳細步驟Oracle
- 遷移式升級的測試
- Oracle從10g升級到11g詳細操作步驟Oracle
- 今天通過oracle 10g 升級到 11g ocp 考試Oracle 10g
- 遷移 SQL Server 到 Azure SQL 實戰SQLServer
- win32 10g 到 win64 11g的遷移歷險Win32
- 升級Oracle 10g 到10.2.0.4Oracle 10g
- gitlab安裝/遷移/升級流程Gitlab
- 遷移式升級的測試(二)
- 遷移式升級的測試(三)
- 遷移式升級的一點思考
- 資料庫的升級及遷移資料庫
- oracle SPA 效能分析案例Oracle
- 使用SQL Developer 遷移異構資料庫到OracleSQLDeveloper資料庫Oracle
- 遷移學習系列---基於例項方法的遷移學習遷移學習
- RAC 例項 遷移到 單例項 -- 使用RMAN Duplicate單例
- 9i 升級到 10g SQL執行計劃校驗SQL
- Oracle舊版本透過資料遷移方式升級到新版本Oracle
- ORACLE9I升級到10GOracle
- Grafana的版本升級和資料遷移Grafana
- .NET框架下Oracle到SQL Server遷移框架OracleSQLServer
- ORACLE 10G ASM非歸檔模式下使用RMAN遷移一例Oracle 10gASM模式
- Oracle RAC ASM 例項 從10.2.0.1 升級到 10.2.0.4 說明OracleASM
- ORACLE11G從WINDOWS到LINUX跨平臺遷移並升級OracleWindowsLinux
- 32位升級到64位之後遷移oracle db遇到的問題Oracle
- Oracle 10g/11g 升級psu步驟Oracle 10g
- Oracle 11g升級到12COracle
- Oracle 12c 使用(Full Transportable Export/Import)進行升級/遷移OracleExportImport