=====Ein Tabelle in Oracle umbenennen - Unterschied RENAME und ALTER TABLE - ORA-01765 und ORA-14047=====
**Problem: "ORA-01765: specifying owner's name of the table is not allowed" - "ORA-14047: ALTER TABLE|INDEX RENAME may not be combined with other operations"
**
Welche Möglichkeiten bestehen um eine Tabelle umzubennen?
* RENAME xxxxx to yyyy;
* ALTER TABLE schema.xxxx RENAME TO yyyyyy;
Aber was ist der Unterschied zwischen den beiden Möglichkeiten?
=== RENAME xxxxx to yyyy ===
Aus der Dokumentation:
.. Prerequisites
The object must be in your own schema.
..
D.h. ein Aufruf von:
connect system
rename scott.emp to scott.emp_orig;
ORA-01765: specifying owner s name of the table is not allowed
-- Richiger Aufruf:
connect scott
rename semp to emp_orig;
Eine Verwendung als NICHT Schema Owner führt zu einer Exception "ORA-01765: specifying owner's name of the table is not allowed"!
===ALTER TABLE schema.xxxx RENAME TO yyyyyy ===
Hier kann nun das Schema angeben werden, es ist aber darauf zu achten, dass nur das umzubenennende Objekte inklusive Schema Namen angegeben wird!
D.h. ein Aufruf von:
-- Falsch
alter table scott.emp rename to scott.emp_orig;
ORA-14047: ALTER TABLE|INDEX RENAME may not be combined with other operations
-- Richiger Aufruf:
alter table scott.emp rename to emp_orig;
----
====Quellen====
* Oralce 19c Doku
* ALTER TABLE => https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-TABLE.html#GUID-552E7373-BF93-477D-9DA3-B2C9386F2877
* RENAME => https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/RENAME.html#GUID-573347CE-3EB8-42E5-B4D5-EF71CA06FAFC