如果第一次使用sqlplus
建议:
C:\>cd \
C:\>set oracle_sid=orcl(是L不是数字1)
C:\>sqlplus
***1.管理员身份***
C:\>sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on 星期三 2月 19 20:02:22 2020
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: sys/admin as sysdba
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
***2.先解锁***
SQL> alter user scott account unlock;
用户已更改。
SQL> conn scott/tiger
ERROR:
ORA-28001: the password has expired
更改 scott 的口令
新口令:写tiger(输入时不会显示的,和之前同样的密码tiger)
重新键入新口令:写tiger
口令已更改
已连接。
SQL> select * from emp;
如果不是第一次使用
1.先退出
C:\>sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on 星期三 2月 19 20:02:22 2020
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: sys/admin as sysdba
连接到:
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 scott/tiger
ERROR:
ORA-28000: the account is locked
警告: 您不再连接到 ORACLE。
SQL> alter user scott account unlock;
SP2-0640: 未连接
SQL> exit
C:\>sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on 星期三 2月 19 20:34:38 2020
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: sys/admin as sysdba
连接到:
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> alter user scott account unlock;
用户已更改。
SQL> conn scott/tiger
ERROR:
ORA-28001: the password has expired
更改 scott 的口令
新口令:
重新键入新口令:
口令已更改
已连接。
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------------- ---------- ----------
DEPTNO
----------
7369 SMITH CLERK 7902 17-12月-80 800
20
7499 ALLEN SALESMAN 7698 20-2月 -81 1600 300
30
7521 WARD SALESMAN 7698 22-2月 -81 1250 500
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------------- ---------- ----------
DEPTNO
----------
7566 JONES MANAGER 7839 02-4月 -81 2975
20
7654 MARTIN SALESMAN 7698 28-9月 -81 1250 1400
30
7698 BLAKE MANAGER 7839 01-5月 -81 2850
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------------- ---------- ----------
DEPTNO
----------
7782 CLARK MANAGER 7839 09-6月 -81 2450
10
7788 SCOTT ANALYST 7566 19-4月 -87 3000
20
7839 KING PRESIDENT 17-11月-81 5000
10
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------------- ---------- ----------
DEPTNO
----------
7844 TURNER SALESMAN 7698 08-9月 -81 1500 0
30
7876 ADAMS CLERK 7788 23-5月 -87 1100
20
7900 JAMES CLERK 7698 03-12月-81 950
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------------- ---------- ----------
DEPTNO
----------
7902 FORD ANALYST 7566 03-12月-81 3000
20
7934 MILLER CLERK 7782 23-1月 -82 1300
10
已选择14行。
SQL>