当前位置:主页 > 数据库 > Oracle >

Oracle 11g用户修改密码及加锁解锁功能实例代码

时间:2021-03-15 09:53:37 | 栏目:Oracle | 点击:

1.运行 cmd.exe;

2.输入 sqlplus / as sysdba,以系统管理员(sysdba)身份连接数据库,进行数据库管理操作。

3.连接成功后执行

alter user identityName identified by password; ―?C修改密码 
alter user identityName account unlock; ―?C解锁 
alter user identityName account lock; ―?C加锁 
identityName:需要修改的用户; 
password:新设密码;

完成

PS: oracle 11g用户的解锁与加锁(hr模式)

SQL> conn sys/sys as sysdba
Connected.
SQL> show user
USER is "SYS"
SQL> alter user hr account unlock;(解锁)
User altered.
SQL> alter user hr identified by *password*;(更改密码,这一步是必需的,否则hr模式还是不能使用的)
User altered.
到这里hr模式就可以使用了,试试:
SQL> conn hr/*password*
Connected.
SQL> show user
USER is "HR"
----------------------------------
相反的
SQL> alter user hr account lock;(上锁)
User altered.
SQL> alter user hr password expire;(密码失效)
User altered.
SQL> conn hr/*password*
ERROR:
ORA-28000: the account is locked
Warning: You are no longer connected to ORACLE.

总结

您可能感兴趣的文章:

相关文章