[20210419]測試18c SQL Translation Framework.txt
[20210419]測試18c SQL Translation Framework.txt
--//據說18c做了一點點增強,不用設定 alter session set events = '10601 trace name context forever, level 32';
--//可以參考我以前的連結:
--//http://blog.itpub.net/267265/viewspace-2216487/ => 12C SQL Translation Framework.txt
1.環境:
xxxx> @ ver1
xxxx> @ prxx
==============================
PORT_STRING : x86_64/Linux 2.4.xx
VERSION : 18.0.0.0.0
BANNER : Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
BANNER_FULL : Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
BANNER_LEGACY : Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
CON_ID : 0
PL/SQL procedure successfully completed.
2.建立SQL Translation Framework:
begin
dbms_sql_translator.create_profile('test_profile');
/* This attribute indicates if the profile is for traslation
of foreign SQL syntax only. if True only foreign sql
will be translated, if false, all sql from client
application will be translated */
dbms_sql_translator.set_attribute(
profile_name=>'test_profile',
attribute_name=> dbms_sql_translator.ATTR_FOREIGN_SQL_SYNTAX,
attribute_value=> dbms_sql_translator.ATTR_VALUE_FALSE );
dbms_sql_translator.register_sql_translation(
profile_name=>'test_profile',
sql_text=>'select sysdate',
translated_text=>'select sysdate from dual' );
end;
/
--//主要增加設定屬性的內容。
3、測試:
xxxx> select sysdate;
select sysdate
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
--//還沒有開啟.
xxxx> alter session set sql_translation_profile=test_profile;
Session altered.
xxxx> select sysdate;
SYSDATE
-------------------
2021-04-19 10:34:34
--//ok,測試透過。
xxxx> Select sysdate;
Select sysdate
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
--//內容必須要與sql_text定義一致。
4.涉及檢視:
DBA_ERROR_TRANSLATIONS
DBA_SQL_TRANSLATION_PROFILES
DBA_SQL_TRANSLATIONS
xxxx> select * from DBA_ERROR_TRANSLATIONS;
no rows selected
xxxx> select * from DBA_SQL_TRANSLATION_PROFILES
2 @ prxx
==============================
OWNER : TTT
PROFILE_NAME : TEST_PROFILE
TRANSLATOR :
FOREIGN_SQL_SYNTAX : FALSE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TRANSLATE_NEW_SQL : TRUE
RAISE_TRANSLATION_ERROR : FALSE
LOG_TRANSLATION_ERROR : FALSE
TRACE_TRANSLATION : FALSE
LOG_ERRORS : FALSE
PL/SQL procedure successfully completed.
--//視乎設定TRANSLATOR可以實現上面的功能。
xxxx> select * from DBA_SQL_TRANSLATIONS
2 @ prxx
==============================
OWNER : TTT
PROFILE_NAME : TEST_PROFILE
SQL_TEXT : select sysdate
TRANSLATED_TEXT : select sysdate from dual
SQL_ID : bw2c1d6sqyjpy
HASH_VALUE : 2976859838
ENABLED : TRUE
REGISTRATION_TIME : 2021-04-19 10:33:51.173270
CLIENT_INFO :
MODULE :
ACTION :
PARSING_USER_ID :
PARSING_SCHEMA_ID :
COMMENTS :
ERROR_CODE :
ERROR_SOURCE :
TRANSLATION_METHOD :
DICTIONARY_SQL_ID :
PL/SQL procedure successfully completed.
--//上網看了官方手冊,好複雜放棄。
4.收尾:
xxxx> exec dbms_sql_translator.drop_profile(profile_name => 'test_profile');
PL/SQL procedure successfully completed.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2768660/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 12C SQL Translation Framework.txtSQLFramework
- SQL MAP 注入測試SQL
- Prepared SQL 效能測試SQL
- SQL Access Advisor、SQL Tuning Advisor 測試SQL
- Python的SQL效能測試PythonSQL
- SQL PLAN Management的測試SQL
- Python 的 SQL 效能測試PythonSQL
- 測試學習SQL篇SQL
- Translation - 起底 SourceKit
- Translation – 起底 SourceKit
- IDEA外掛-TranslationIdea
- SQL Server Availability Group Failover 測試SQLServerAI
- [20181107]18c set feedback顯示sql_id.txtSQL
- 測試人員必會SQL命令SQL
- 使用profiler測試Oracle PL/SQL效能OracleSQL
- PHPSTORM外掛之TranslationPHPORM
- [20181107]18c新特性取消執行的sql.txtSQL
- [20210419]避免冗餘的輸出.txt
- run_stats---sql效率測試工具(轉)SQL
- [20210419]CBC latch再討論4.txt
- openGauss關於PL/SQL匿名塊呼叫測試SQL
- 測試測試測試測試測試測試
- 測試雜談——一條SQL引發的思考SQL
- [20210812]測試sql語句子游標的效能.txtSQL
- 軟體安全測試之SQL隱碼攻擊SQL
- Oracle 18cOracle
- SAP Spartacus Translation(翻譯) 相關話題
- 第 54 期 TiDB SQL 相容性測試工具簡介TiDBSQL
- [20210816]測試sql語句子游標的效能3.txtSQL
- [20210818]測試sql語句子游標的效能4.txtSQL
- 滲透測試網站sql注入攻擊與防護網站SQL
- 墨者學院-SQL手工注入漏洞測試(MySQL資料庫)MySql資料庫
- 測試—測試方法
- 測試測試用
- 【論文筆記】Neural machine translation by jointly learning to align and translate筆記Mac
- Flutter 學習之路 - 測試(單元測試,Widget 測試,整合測試)Flutter
- App測試、Web測試和介面測試一般測試流程APPWeb
- 測試面試-測試用例面試