[20190427]表改名与ora-14047错误.txt
--//改表名失败,做一个记录:
1.环境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
create table t as select rownum id from dual ;
create unique index pk_t on t(id);
SCOTT@book> alter table scott.t rename to scott.ttx;
alter table scott.t rename to scott.ttx
*
ERROR at line 1:
ORA-14047: ALTER TABLE|INDEX RENAME may not be combined with other operations
--//这个报错很奇怪,什么是其它操作...注意*号出现位置.
--//想一下,表改名oracle目前不会支持修改schema模式的.修改如下ok:
SCOTT@book> alter table scott.t rename to ttx;
Table altered.
--或者
SCOTT@book> alter table ttx rename to tty;
Table altered.
--//实际上遇到这类问题,使用toad + sql_track操作跟踪看看就知道了,不过好像toad执行如下:
SCOTT@book> rename tty to ttz;
Table renamed.
SCOTT@book> rename ttz to scott.tta;
rename ttz to scott.tta
*
ERROR at line 1:
ORA-01765: specifying owner's name of the table is not allowed
$ oerr ora 01765
01765, 00000, "specifying owner's name of the table is not allowed"
// *Cause: An attempt was made to rename the object with dotted object name.
// *Action: Do not specify username.tablename in query for table name.
--//这个提示就很清晰!!实际上手边有一份oracle sql参考手册函数很有必要的.