Oracle Database シノニムをリネームする

Oracle Database シノニムをリネームする

Oracle Databaseで、シノニムをリネームする手順を記述してます。「RENAME」を使用することで可能です。ここでは、実際に実行した結果を画像で掲載してます。

環境

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

手順

シノニムをリネームするには、「RENAME」を使用します。

RENAME シノニム名 TO 変更したいシノニム名;

実際に、「BAR」というシノニムを「BAR2」に変更してみます。

RENAME BAR TO BAR2;

実行結果を見ると変更されていることが確認できます。

publicなシノニムのリネーム

publicなシノニムを変更しようとするとエラーとなります。
※publicなシノニムはリネームができません。

RENAME PBAR TO PBAR2
エラー・レポート -
ORA-04043: オブジェクトPBARは存在しません。
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.)