sqlplus登录Oracle时ORA-01017: invalid username/password;
今天用scott用户登录Oracle数据库时,竟然出现了ORA-01017: invalid username/password; logon denied错误,原以为是因为我的scott用户没有解锁,后用system用户登录,然后用alter user scott account unlock语句对scott用户进行解锁,可是解锁后依然不能进入,还是报告ORA-01017: invalid username/password; logon denied错误,仔细想了一会,感觉应该是我在对scott用户解锁时没有设置密码,所以不论输入什么密码都是错误的,于是我想到了如下的解决办法,为防止以后犯此类错误,现将错误及解决方式记录于下:
SQL*Plus: Release 11.2.0.1.0 Production on 星期五 10月 12 20:03:09 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: scott
输入口令:
ERROR:
ORA-01017: invalid username/password; logon denied
请输入用户名: system
输入口令:
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> conn /as sysdba;
已连接。
SQL> alter user SCOTT account unlock identified by Orcl123456;
用户已更改。
SQL> select username,account_status from dba_users where username='SCOTT';
USERNAME
------------------------------------------------------------
ACCOUNT_STATUS
----------------------------------------------------------------
SCOTT
OPEN
SQL> conn scott/Orcl123456
已连接。
到此就可以用scott用户正常登陆了,如不放心还可以使用一下的查询语句进行验证:
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
7369 SMITH CLERK 7902 1980/12/17 800.00 20
7499 ALLEN SALESMAN 7698 1981/2/20 1600.00 300.00 30
7521 WARD SALESMAN 7698 1981/2/22 1250.00 500.00 30
7566 JONES MANAGER 7839 1981/4/2 2975.00 20
7654 MARTIN SALESMAN 7698 1981/9/28 1250.00 1400.00 30
7698 BLAKE MANAGER 7839 1981/5/1 2850.00 30
7782 CLARK MANAGER 7839 1981/6/9 2450.00 10
7788 SCOTT ANALYST 7566 1987/4/19 3000.00 20
7839 KING PRESIDENT 1981/11/17 5000.00 10
7844 TURNER SALESMAN 7698 1981/9/8 1500.00 0.00 30
7876 ADAMS CLERK 7788 1987/5/23 1100.00 20
7900 JAMES CLERK 7698 1981/12/3 950.00 30
7902 FORD ANALYST 7566 1981/12/3 3000.00 20
7934 MILLER CLERK 7782 1982/1/23 1300.00 10
14 rows selected