本篇內(nèi)容主要講解“數(shù)據(jù)庫(kù)中怎么解決修改表名時(shí)遇到ORA-14047錯(cuò)誤”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“數(shù)據(jù)庫(kù)中怎么解決修改表名時(shí)遇到ORA-14047錯(cuò)誤”吧!
超過(guò)十余年行業(yè)經(jīng)驗(yàn),技術(shù)領(lǐng)先,服務(wù)至上的經(jīng)營(yíng)模式,全靠網(wǎng)絡(luò)和口碑獲得客戶,為自己降低成本,也就是為客戶降低成本。到目前業(yè)務(wù)范圍包括了:網(wǎng)站設(shè)計(jì)、成都網(wǎng)站設(shè)計(jì),成都網(wǎng)站推廣,成都網(wǎng)站優(yōu)化,整體網(wǎng)絡(luò)托管,小程序定制開(kāi)發(fā),微信開(kāi)發(fā),成都app開(kāi)發(fā),同時(shí)也可以讓客戶的網(wǎng)站和網(wǎng)絡(luò)營(yíng)銷和我們一樣獲得訂單和生意!SQL> show user; USER is "TEST" SQL> create table rename_table ( id int); Table created. SQL> select table_name from user_tables; TABLE_NAME -------------------------------------------------------------------------------- RENAME_TABLE
SQL> show user; USER is "SYS" SQL> alter table test.RENAME_TABLE rename to test.RENAME_TABLE2; alter table test.RENAME_TABLE rename to test.RENAME_TABLE2 * ERROR at line 1: ORA-14047: ALTER TABLE|INDEX RENAME may not be combined with other operations
問(wèn)題原因
Oracle是允許A用戶修改B用戶表名的,但是在新表名前是不能指定用戶名的,使用如下方法修改表名成功。
SQL> alter table test.RENAME_TABLE rename to RENAME_TABLE2; Table altere SQL> select OWNER,TABLE_NAME from dba_tables where owner='TEST'; OWNER TABLE_NAME -------------------- -------------------- TEST RENAME_TABLE2
++++++++++++++++++++++++++++++++分割線+++++++++++++++++++++++++++++++
還有一個(gè)修改表名的命令rename to ,但是這個(gè)命令只能修改自己用戶下表的表名
使用Sys用戶修改test用戶表的表名
SQL> show user; USER is "SYS" SQL> select OWNER,TABLE_NAME from dba_tables where owner='TEST'; OWNER TABLE_NAME -------------------- -------------------- TEST RENAME_TABLE2 SQL> rename test.RENAME_TABLE2 to RENAME_TABLE; rename test.RENAME_TABLE2 to RENAME_TABLE * ERROR at line 1: ORA-01765: specifying owner's name of the table is not allowed
切換為test用戶,修改表名成功
SQL> show user; USER is "TEST" SQL> select OWNER,TABLE_NAME from dba_tables where owner='TEST'; OWNER TABLE_NAME -------------------- -------------------- TEST RENAME_TABLE2 SQL> rename RENAME_TABLE2 to RENAME_TABLE; Table renamed. SQL> select OWNER,TABLE_NAME from dba_tables where owner='TEST'; OWNER TABLE_NAME -------------------- -------------------- TEST RENAME_TABLE
到此,相信大家對(duì)“數(shù)據(jù)庫(kù)中怎么解決修改表名時(shí)遇到ORA-14047錯(cuò)誤”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!