Oracle Database エラー「ORA-04043: オブジェクトxxxは存在しません。」が発生した場合の対処法

Oracle Database エラー「ORA-04043: オブジェクトxxxは存在しません。」が発生した場合の対処法

Oracle Databaseで、エラー「ORA-04043: オブジェクトxxxは存在しません。」が発生した場合の対処法を記述してます。

環境

  • OS windows11 home
  • Oracle Database 21c Express Edition
  • SQL Developer 21.2.1.204

エラー全文

シノニムをリネームする際に発生。

次のコマンドの開始中にエラーが発生しました : 行 1 -
RENAME PUBLIC_TEST TO PUBLIC_TEST2
エラー・レポート -
ORA-04043: オブジェクトPUBLIC_TESTは存在しません。
04043. 00000 -  "object %s does not exist"
*Cause:    An object name was specified that was not recognized by the system.
           There are several possible causes:
           - An invalid name for a table, view, sequence, procedure, function,
           package, or package body was entered. Since the system could not
           recognize the invalid name, it responded with the message that the
           named object does not exist.
           - An attempt was made to rename an index or a cluster, or some
           other object that cannot be renamed.
*Action:   Check the spelling of the named object and rerun the code. (Valid
           names of tables, views, functions, etc. can be listed by querying
           the data dictionary.)

原因

publicなシノニムをリネームしようとしたため

対処法

publicなシノニムはリネームできないため削除して新規作成するしかない

DROP PUBLIC SYNONYM PUBLIC_TEST;

CREATE PUBLIC SYNONYM UBLIC_TEST2 FOR FOO;