错误 ORA-00942 运行 DBMS_COMPARISON.CONVERGE 子程序
Error ORA-00942 running DBMS_COMPARISON.CONVERGE subprogram
我收到 ORA-00942 - table 或视图不存在 - 当我 运行 使用 DBMS_COMPARISON 包同步两个 table 的存储过程时出错] 有两种不同的模式。
我的大概是这样的:
remote table local comparison local table
DB1.PRODUCTS DB2.PRODUCTS_CMP DB2.PRODUCTS
这是本地 DB2 程序:
create or replace PROCEDURE SYNC_SINGLE AS
L_SCAN_INFO SYS.DBMS_COMPARISON.COMPARISON_TYPE;
L_RESULT BOOLEAN;
L_COMPNAME VARCHAR2(30);
BEGIN
L_COMPNAME:='PRODUCT_CMP';
SYS.DBMS_COMPARISON.PURGE_COMPARISON(
COMPARISON_NAME => L_COMPNAME
);
L_RESULT :=
SYS.DBMS_COMPARISON.COMPARE (
COMPARISON_NAME => L_COMPNAME,
SCAN_INFO => L_SCAN_INFO,
PERFORM_ROW_DIF => TRUE
);
FOR ROW_ID IN (
SELECT SCAN_ID
FROM USER_COMPARISON_SCAN_SUMMARY
WHERE COMPARISON_NAME = L_COMPNAME
AND STATUS = 'BUCKET DIF'
)
LOOP
SYS.DBMS_COMPARISON.CONVERGE (
COMPARISON_NAME => L_COMPNAME,
SCAN_ID => ROW_ID.SCAN_ID,
SCAN_INFO => L_SCAN_INFO,
CONVERGE_OPTIONS => SYS.DBMS_COMPARISON.CMP_CONVERGE_REMOTE_WINS,
PERFORM_COMMIT => FALSE
);
END LOOP ROW_ID;
SYS.DBMS_COMPARISON.PURGE_COMPARISON(
COMPARISON_NAME => L_COMPNAME
);
END SYNC_SINGLE;
程序以这些错误结束:
ORA-00942: table or view does not exist
ORA-06512: a "SYS.DBMS_COMPARISON", line 734
ORA-06512: a "SYS.DBMS_COMPARISON", line 5964
ORA-06512: a "SYS.DBMS_COMPARISON", line 682
ORA-06512: a "DB2.SYNC_SINGLE", line 26
ORA-06512: a "DB2.SYNC_SINGLE", line 26
ORA-06512: a line 2
我想这里存在权限问题,但我不知道是什么问题。用户 SYS 已获得本地 table DB2.PRODUCTS 授予的所有权限。
此外,我还有其他 tables 在我以相同方式同步的相同模式上,对于那些 tables 一切都很好。查看 tables SYS.COMPARISON$ 和 SYS.COMPARISON_COL$ 一切似乎都配置正确。
任何人都可以帮助建议我应该检查什么吗?
我找到了原因:程序声明中缺少 AUTHID CURRENT_USER。
create or replace PROCEDURE SYNC_SINGLE AUTHID CURRENT_USER AS
我收到 ORA-00942 - table 或视图不存在 - 当我 运行 使用 DBMS_COMPARISON 包同步两个 table 的存储过程时出错] 有两种不同的模式。
我的大概是这样的:
remote table local comparison local table
DB1.PRODUCTS DB2.PRODUCTS_CMP DB2.PRODUCTS
这是本地 DB2 程序:
create or replace PROCEDURE SYNC_SINGLE AS
L_SCAN_INFO SYS.DBMS_COMPARISON.COMPARISON_TYPE;
L_RESULT BOOLEAN;
L_COMPNAME VARCHAR2(30);
BEGIN
L_COMPNAME:='PRODUCT_CMP';
SYS.DBMS_COMPARISON.PURGE_COMPARISON(
COMPARISON_NAME => L_COMPNAME
);
L_RESULT :=
SYS.DBMS_COMPARISON.COMPARE (
COMPARISON_NAME => L_COMPNAME,
SCAN_INFO => L_SCAN_INFO,
PERFORM_ROW_DIF => TRUE
);
FOR ROW_ID IN (
SELECT SCAN_ID
FROM USER_COMPARISON_SCAN_SUMMARY
WHERE COMPARISON_NAME = L_COMPNAME
AND STATUS = 'BUCKET DIF'
)
LOOP
SYS.DBMS_COMPARISON.CONVERGE (
COMPARISON_NAME => L_COMPNAME,
SCAN_ID => ROW_ID.SCAN_ID,
SCAN_INFO => L_SCAN_INFO,
CONVERGE_OPTIONS => SYS.DBMS_COMPARISON.CMP_CONVERGE_REMOTE_WINS,
PERFORM_COMMIT => FALSE
);
END LOOP ROW_ID;
SYS.DBMS_COMPARISON.PURGE_COMPARISON(
COMPARISON_NAME => L_COMPNAME
);
END SYNC_SINGLE;
程序以这些错误结束:
ORA-00942: table or view does not exist
ORA-06512: a "SYS.DBMS_COMPARISON", line 734
ORA-06512: a "SYS.DBMS_COMPARISON", line 5964
ORA-06512: a "SYS.DBMS_COMPARISON", line 682
ORA-06512: a "DB2.SYNC_SINGLE", line 26
ORA-06512: a "DB2.SYNC_SINGLE", line 26
ORA-06512: a line 2
我想这里存在权限问题,但我不知道是什么问题。用户 SYS 已获得本地 table DB2.PRODUCTS 授予的所有权限。 此外,我还有其他 tables 在我以相同方式同步的相同模式上,对于那些 tables 一切都很好。查看 tables SYS.COMPARISON$ 和 SYS.COMPARISON_COL$ 一切似乎都配置正确。
任何人都可以帮助建议我应该检查什么吗?
我找到了原因:程序声明中缺少 AUTHID CURRENT_USER。
create or replace PROCEDURE SYNC_SINGLE AUTHID CURRENT_USER AS