Благодарение на намека ви за rowid , намерих решение. Ако имате rowid, трябва да е възможно да определите обекта, към който принадлежи редът.
Минимален пример с 4 хеш дяла:
CREATE TABLE pt (i NUMBER)
PARTITION BY HASH (i) (PARTITION pt1, PARTITION pt2, PARTITION pt3, PARTITION pt4);
INSERT INTO pt SELECT ROWNUM FROM all_objects WHERE ROWNUM < 20;
Сега всеки ред има ROWID
. Можете да разберете номера на обекта чрез DBMS_ROWID.ROWID_OBJECT
. Таблицата на речника USER_OBJECTS
след това има object_name (=името на таблицата) и subobject_name (=името на дяла):
SELECT i,
ROWID AS row_id,
dbms_rowid.rowid_object(ROWID) AS object_no,
(SELECT subobject_name
FROM user_objects
WHERE object_id = dbms_rowid.rowid_object(pt.ROWID)) AS partition_name
FROM pt
ORDER BY 3;
I ROW_ID OBJECT_NO PARTITION_NAME
6 AAALrYAAEAAAATRAAA 47832 PT1
11 AAALrYAAEAAAATRAAB 47832 PT1
13 AAALrYAAEAAAATRAAC 47832 PT1
9 AAALrZAAEAAAATZAAA 47833 PT2
10 AAALrZAAEAAAATZAAB 47833 PT2
12 AAALrZAAEAAAATZAAC 47833 PT2
17 AAALrZAAEAAAATZAAD 47833 PT2
19 AAALrZAAEAAAATZAAE 47833 PT2
2 AAALraAAEAAAAThAAA 47834 PT3
5 AAALraAAEAAAAThAAB 47834 PT3
18 AAALraAAEAAAAThAAD 47834 PT3
8 AAALraAAEAAAAThAAC 47834 PT3
1 AAALrbAAEAAAATpAAA 47835 PT4
3 AAALrbAAEAAAATpAAB 47835 PT4
4 AAALrbAAEAAAATpAAC 47835 PT4
7 AAALrbAAEAAAATpAAD 47835 PT4