[20251027]建立完善s2h.sql脚本.txt
--//增加kgl_bucket的计算。
$ cat s2h.sql
-- Copyright 2023 lfree. All rights reserved.
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms and conditions.
----------------------------------------------------------------------------------------------
--
-- Name: s2h.sql
-- Purpose: display Sql_id of Hash_value
--
-- Author: lfree
-- Usage:
-- @ s2h <sql_id>
--
-----------------------------------------------------------------------------------------------
column sql_id format a13
column hash_value format 9999999999
SELECT '&1' sql_id
,DBMS_UTILITY.SQLID_TO_SQLHASH ('&1') hash_value
,MOD (DBMS_UTILITY.SQLID_TO_SQLHASH ('&1'), 131072) kgl_bucket
FROM DUAL;
SCOTT@book01p> @ sql_id 318q0cyx1n9s3
-- SQL_ID = 318q0cyx1n9s3 come from shared pool
Select /*+ a */ count(*) from t1 where id = :"SYS_B_0";
SCOTT@book01p> @ s2h 318q0cyx1n9s3
SQL_ID HASH_VALUE KGL_BUCKET
------------- ----------- ----------
318q0cyx1n9s3 3122276099 9987
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-3099453/ ,如需转载,请注明出处,否则将追究法律责任。