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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle從10g升級到11g詳細步驟Oracle
- SQL Server 2016升級遷移過程中效能問題解決案例SQLServer
- weblogic版本升級遷移需要注意事項Web
- SQL Server升級和遷移的三個技巧GZSQLServer
- gitlab的遷移和升級Gitlab
- 靜默升級oracle 11g (從11.2.0.1升級到11.2.0.4)Oracle
- ORACLE9I升級到10G(zt)Oracle
- gitlab安裝/遷移/升級流程Gitlab
- Oracle 11g升級到12COracle
- 遷移學習系列---基於例項方法的遷移學習遷移學習
- Oracle 11g RAC到單例項OGG同步Oracle單例
- datagrip2019.1.4-升級資料遷移
- Oracle 9i 11g歷史庫升級遷移資料至19c CDBOracle
- Windows升級到oracle 11g的異機物理升級文件(冷備)WindowsOracle
- Grafana的版本升級和資料遷移Grafana
- Solaris 10下遷移10G RAC (六)
- Solaris 10下遷移10G RAC (八)
- Solaris 10下遷移10G RAC (四)
- Solaris 10下遷移10G RAC (二)
- Solaris 10下遷移10G RAC (七)
- Solaris 10下遷移10G RAC (三)
- Solaris 10下遷移10G RAC (一)
- Solaris 10下遷移10G RAC (五)
- 使用GoldenGate 遷移Oracle到PostgreSQL/LightDBGoOracleSQL
- PR效能測試工具升級到全鏈路效能測試與分析平臺
- 網易雲 MySQL例項遷移的技術實現MySql
- iOS CoreData (二) 版本升級和資料庫遷移iOS資料庫
- 最全weblogic升級與遷移改造常見問題Web
- SAP系統升級,如何做資料遷移?
- 【XTTS】Oracle XTTS V4--Oracle11.2.0.4+ 遷移升級TTSOracle
- 應用升級SpringCloud版本時的注意事項(Dalston升級到Edgware)SpringGCCloud
- Taro原理分析、遷移指南及開發注意事項
- 從 SQL Server 到 MySQL (一):異構資料庫遷移ServerMySql資料庫
- ORACLE10G升級11GOracle
- 13 使用SQL Apply 升級資料庫SQLAPP資料庫
- 案例分析:700G SQL Server資料庫遷移HGSQLServer資料庫
- SQL------SQL效能分析SQL
- CentOS 停止維護,一文看懂升級遷移路徑CentOS
- SQL Server資料庫遷移SQLServer資料庫