1.运行 cmd.exe;

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

3.连接成功后执行

alter user identityName identified by password; —?修改密码
alter user identityName account unlock; —?解锁
alter user identityName account lock; —?加锁
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.

总结

以上所述是小编给大家介绍的Oracle 11g用户修改密码及加锁解锁功能实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

02-03 21:42