oracle11g修改使用者名稱

好記憶不如爛筆頭abc發表於2020-12-25

20:42:14 SQL> select user#,name from user$;

     USER# NAME
---------- ------------------------------
         0 SYS
......
        96 JYC
        97 TEST

88 rows selected.

20:44:36 SQL> update user$ set name='JYC' where user#=97;
update user$ set name='JYC' where user#=97
*
ERROR at line 1:
ORA-00001: unique constraint (SYS.I_USER1) violated


20:45:11 SQL> update user$ set name='JYC1' where user#=97;

1 row updated.

20:45:28 SQL> update user$ set name='TEST' where user#=96;

1 row updated.

20:45:38 SQL> update user$ set name='JYC' where user#=97;

1 row updated.

20:45:47 SQL> commit;

Commit complete.

20:45:50 SQL> select user#,name from user$;

     USER# NAME
---------- ------------------------------
         0 SYS

......

        83 SCOTT
        96 TEST
        97 JYC

88 rows selected.

20:45:57 SQL> alter system checkpoint;

System altered.

20:46:05 SQL> alter system flush shared_pool;

System altered.

20:46:15 SQL> conn jyc/jyc
ERROR:
ORA-01017: invalid username/password; logon denied


Warning: You are no longer connected to ORACLE.
20:46:33 SQL> conn jyc/test
Connected.
20:46:38 SQL> conn test/jyc
Connected.
20:46:43 SQL> conn /as sysdba
Connected.

20:46:56 SQL> alter user jyc identified by jyc;

User altered.

20:47:01 SQL> alter user test identified by test;

User altered.

20:47:07 SQL> select count(*) from jyc.a;

  COUNT(*)
----------
       496

20:47:22 SQL> select count(*) from jyc.b;

  COUNT(*)
----------
        64

20:47:25 SQL> select count(*) from test.b;

  COUNT(*)
----------
         1

20:47:28 SQL> select count(*) from test.a;

  COUNT(*)
----------
        31

20:47:30 SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
20:47:55 SQL> startup
ORACLE instance started.

Total System Global Area 2455228416 bytes
Fixed Size                  2255712 bytes
Variable Size             654312608 bytes
Database Buffers         1778384896 bytes
Redo Buffers               20275200 bytes
Database mounted.
Database opened.
20:48:02 SQL> select count(*) from jyc.a;

  COUNT(*)
----------
       496

20:48:10 SQL> select count(*) from jyc.b;

  COUNT(*)
----------
        64

20:48:13 SQL> conn jyc/jyc
Connected.
20:48:17 SQL> create table c as select * from a;

Table created.

20:48:26 SQL> select count(*) from c;

  COUNT(*)
----------
       496

20:48:32 SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@saperp ~]$ 

相關參考:

https://www.cnblogs.com/wenchunlin/p/8573173.html

https://blog.51cto.com/ylw6006/799261

相關文章