select username,user_id from dba_users where username=‘SYS‘;
USERNAME USER_ID
------------------------------ ----------
SYS 0
或者:
select user#,name from user$ where name=‘SYS‘;
USER# NAME
---------- ------------------------------
0 SYS
SQL> update user$ set name=‘SYSA‘ where user#=0;
1 row updated.
SQL> commit;
Commit complete.
SQL> alter system checkpoint;
System altered.
SQL> alter system flush shared_pool;
System altered.
SQL> conn sysa/sys as sysdba
Connected.
SQL> select t1.ksppinm,t2.ksppstvl,t1.ksppdesc from x$ksppi t1,x$ksppcv t2 where t1.indx=t2.indx and t1.ksppinm like ‘_enable_rename_use
r‘;
KSPPINM
--------------------------------------------------------------------------------
KSPPSTVL
--------------------------------------------------------------------------------
KSPPDESC
--------------------------------------------------------------------------------
_enable_rename_user
FALSE
enable RENAME-clause using ALTER USER statement
SQL> alter system set "_enable_rename_user"=true scope=spfile;
System altered.
SQL> startup restrict force
ORACLE instance started.
Total System Global Area 3290345472 bytes
Fixed Size 2232840 bytes
Variable Size 1795165688 bytes
Database Buffers 1476395008 bytes
Redo Buffers 16551936 bytes
Database mounted.
Database opened.
SQL> alter user sysa rename to sys identified by syspwd;
User altered.
第二种方法需要重启数据库,没有方法一快捷
原文:https://blog.51cto.com/8355320/2529771