oracle19c之后不支持修改用户名

本文探讨了在Oracle 18c和早期版本中ALTER USER RENAME功能的使用情况,发现12c及以后的19c版本中该功能受限。作者通过实例展示了如何在18c中成功执行用户重命名,并指出19c中未实现特性导致的错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

SQL> select banner from v$version;

BANNER
------------------------------------------------------------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

SQL> alter session set "_enable_rename_user"=true;

Session altered.

SQL> alter system enable restricted session;

System altered.

SQL> alter user jyc rename to zxm identified by jyc;
alter user jyc rename to zxm identified by jyc
               *
ERROR at line 1:
ORA-03001: unimplemented feature


SQL> alter system disable restricted session;

System altered.

测试在18c和11g还可以修改,12c,19c不可以修改,奇怪了。

以下是18c的测试:

As I was getting access to an Oracle 18c Database, I was trying directly, if the ALTER USER RENAME still works => IT'S STILL WORKING :-)


Let's create a test user with one table and one view.

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

sqlplus sys/<password>@pdb01 as sysdba

 

SQL> select banner from v$version;

 

BANNER

--------------------------------------------------------------------------------

Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

 

SQL> create user test identified by "Oracle18c" default tablespace users quota unlimited on users;

 

User created.

 

SQL> grant connect, resource, create table, create view to test;

 

Grant succeeded.

 

SQL> connect test/Oracle18c@pdb01

 

SQL> create table t1 (id number, col1 varchar2(20));

 

Table created.

 

SQL> insert into t1 values (1,'Test 1');

 

1 row created.

     

SQL> insert into t1 values (2, 'Test 2');

 

1 row created.

 

SQL> commit;

 

Commit complete.

 

SQL&gt create view v1 as select * from t1;

 

Now let's rename the above created user TEST to TEST_NEW

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

sqlplus sys/<password>@pdb01 as sysdba

 

SQL> alter session set "_enable_rename_user"=true;

 

Session altered.

 

SQL> alter system enable restricted session;

 

System altered.

 

SQL> alter user test rename to test_new identified by "Oracle18c";

 

User altered.

 

SQL> alter system disable restricted session;

 

System altered.

 

Now let's try to connect with the renamed user TEST_NEW

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

sqlplus test_new/Oracle18c@pdb01 as sysdba

 

SQL> select * from t1;

 

 ID COL1

---------- --------------------

  1 Test 1

  2 Test 2

 

SQL> select * from v1;

 

 ID COL1

---------- --------------------

  1 Test 1

  2 Test 2

So even with Oracle18c the undocumented feature ALTER USER RENAME is still working :-)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值