1、如果记得 sys 或者 system 其中一个账户的密码的话,那么就用已知的账户以 sysdba 身份登录:
sqlplus sys/密码 as sysdba;
或者
sqlplus system/密码 as sysdba;
然后解锁账户并更改密码:
alter user system account unlock; //解锁用户
alter user system identified by 新的密码;
2、如果全部忘记,那么用 cmd 执行:
(这个办法没有试过,转载:https://www.cnblogs.com/liuhua4451/p/5615962.html)
#输入
orapwd
#输出
Usage: orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>
where
file - name of password file (required),
password - password for SYS will be prompted if not specified at command line,
entries - maximum number of distinct DBA (optional),
force - whether to overwrite existing file (optional),
ignorecase - passwords are case-insensitive (optional),
nosysdba - whether to shut out the SYSDBA logon (optional Database Vault only).
There must be no spaces around the equal-to (=) character.
按照这个格式写命令:
orapwd file=D:\Oracle\product\11.2.0\dbhome_1\database\PWD****.ora password=****** entries=5 force=y
(注意,执行重建密码文件命令之前,最好将原来的文件备份一下)
执行命令后,新的密码文件会覆盖原有的密码文件。
重启ORACLE数据库服务后,就可以用新的密码登录SYS了。