已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> show user;
User is "scott"
SQL> show user
User is "scott"
SQL> show
SQL> user
2 show user;
user
show user
ORA-00900: 无效 SQL 语句
SQL> show user;
User is "scott"
SQL> alter user scott identified by 123;
用户已改变
SQL> show user
User is "scott"
SQL> conn scott/LIjun521
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> alter scott identified LIjun521;
alter scott identified LIjun521
ORA-00940: 无效的 ALTER 命令
SQL> alter user scott identified LIjun521;
alter user scott identified LIjun521
ORA-00924: 缺失 BY 关键字
SQL> alter scott identified by LIjun521;
alter scott identified by LIjun521
ORA-00940: 无效的 ALTER 命令
SQL> alter user scott identified by LIjun521;
用户已改变
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> edit
SQL> @d:123.tex;
读文件错误
SQL> start d:123.txt
User is "scott"
SQL> start d:123.txt;
User is "scott"
SQL> @d:123.txt;
User is "scott"
SQL> edit d:123.txt
未知的对象: d:123.txt
SQL> edit d:123.sql;
未知的对象: d:123.sql
SQL> @d:123.sql;
User is "scott"
SQL> edit d:123.sql;
未知的对象: d:123.sql
SQL> edit d:\123.sql;
未知的对象: d:\123.sql
SQL> spool d:bb.sql;
被开始脱机到 d:bb.sql
SQL> edit d:bb.sql;
未知的对象: d:bb.sql
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 行 已选择
SQL> spool d:bb.sql;
被停止脱机到 d:bb.sql
被开始脱机到 d:bb.sql
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 行 已选择
SQL> spool off;
被停止脱机到 d:bb.sql
SQL> select*from dept;
DEPTNO DNAME LOC
------ -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> spool d:bb.sql;
被开始脱机到 d:bb.sql
SQL> select*from dept;
DEPTNO DNAME LOC
------ -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> spool off;
被停止脱机到 d:bb.sql
SQL> edit d:bb.sql;
未知的对象: d:bb.sql
SQL> @d:bb.sql;
7
SQL> @d:123.sql;
User is "scott"
SQL> show user;
User is "scott"
SQL>
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> creat user xiaogang identified by 123;
creat user xiaogang identified by 123
ORA-00900: 无效 SQL 语句
SQL> create user xiaogang identified by 123;
create user xiaogang identified by 123
ORA-01031: 权限不足
SQL> create user xiaogang identified by m123;
create user xiaogang identified by m123
ORA-01031: 权限不足
SQL> conn system/LIjun521
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> create user xiaogang identified by 123;
用户被创建
SQL> password xiaogang;
SQL> alter user xiaogang identified by LIjun521;
用户已改变
SQL> show user;
User is "system"
SQL> conn xiaogang/LIjun521;
没有登录
SQL> conn system/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> drop user xiaogang;
用户被删掉
SQL> show user'
SQL> show user;
User is "system"
SQL> create user xiaogang identified by 123;
用户被创建
SQL> grant connect to xiaogang;
授予成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL>
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select *from emp;
select *from emp
ORA-00942: 表或视图不存在
SQL> conn xiaoming/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaoming
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> conn system/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> grant resource to xiaogang;
授予成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> create table test(userId varchar2(30),userName varchar2(30));
表被创建
SQL> conn xiaoming/LIjun521;
没有登录
SQL> conn xiaoming/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaoming
SQL> create table test(userId varchar2(30),userName varchar2(30));
create table test(userId varchar2(30),userName varchar2(30))
ORA-00955: 名称已由现有对象使用
SQL> create table test1(userId varchar2(30),userName varchar2(30));
表被创建
SQL> conn system/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> create user xiaojun identified by 123;
用户被创建
SQL> conn xiaojun/123;
没有登录
SQL> conn system/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> grant conn to xiaojun;
grant conn to xiaojun
ORA-01919: 角色 'CONN' 不存在
SQL> grant connect to xiaojun;
授予成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> create table test2(userId varchar2(30),userName varchar2(30));
create table test2(userId varchar2(30),userName varchar2(30))
ORA-01031: 权限不足
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select *from text;
select *from text
ORA-00942: 表或视图不存在
SQL> select *from test;
USERID USERNAME
------------------------------ ------------------------------
SQL> desc test;
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
USERID VARCHAR2(30) Y
USERNAME VARCHAR2(30) Y
SQL> select *from emp;
select *from emp
ORA-00942: 表或视图不存在
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant select on emp to xiaogang;
授予成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select *from emp;
select *from emp
ORA-00942: 表或视图不存在
SQL> select*from emp on scott;
select*from emp on scott
ORA-00933: SQL 命令未正确结束
SQL> select*from emp scott.emp
2 select*from emp scott.emp;
select*from emp scott.emp
select*from emp scott.emp
ORA-00933: SQL 命令未正确结束
SQL> select*from emp scott.emp;
select*from emp scott.emp
ORA-00933: SQL 命令未正确结束
SQL> select * from emp scott.emp;
select * from emp scott.emp
ORA-00933: SQL 命令未正确结束
SQL> select * from scott.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 行 已选择
SQL> creat table test(userID varchar2(30),userName varchar2(30));
creat table test(userID varchar2(30),userName varchar2(30))
ORA-00900: 无效 SQL 语句
SQL> create table test(userID varchar2(30),userName varchar2(30));
create table test(userID varchar2(30),userName varchar2(30))
ORA-00955: 名称已由现有对象使用
SQL> create table emp(userID varchar2(30),userName varchar2(30));
表被创建
SQL> show user
User is "xiaogang"
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant update on emp to xiaogang;
授予成功
SQL> grant all on emp to xiaogang;
授予成功
SQL> revoke select on emp to xiaogang;
revoke select on emp to xiaogang
ORA-00905: 缺失关键字
SQL> revoke select on emp from xiaogang;
撤回成功
SQL> revoke update on emp from xiaogang;
撤回成功
SQL> revoke all on emp from xiaogang;
撤回成功
SQL> conn xiaogang /123;
没有登录
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant select on emp to xiaogang;
授予成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.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 行 已选择
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> revoke select on emp from xiaogang;
撤回成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant select on emp to xiaogang with grant option;
授予成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> select *from scott.emp;
select *from scott.emp
ORA-00942: 表或视图不存在
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> grant select on scott.emp to xiaojun;
授予成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> select *from scott.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 行 已选择
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> revoke select on emp from xiaogang;
撤回成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> show user;
User is "xiaojun"
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL>
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select *from emp;
select *from emp
ORA-00942: 表或视图不存在
SQL> conn xiaoming/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaoming
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> conn system/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> grant resource to xiaogang;
授予成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> create table test(userId varchar2(30),userName varchar2(30));
表被创建
SQL> conn xiaoming/LIjun521;
没有登录
SQL> conn xiaoming/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaoming
SQL> create table test(userId varchar2(30),userName varchar2(30));
create table test(userId varchar2(30),userName varchar2(30))
ORA-00955: 名称已由现有对象使用
SQL> create table test1(userId varchar2(30),userName varchar2(30));
表被创建
SQL> conn system/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> create user xiaojun identified by 123;
用户被创建
SQL> conn xiaojun/123;
没有登录
SQL> conn system/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> grant conn to xiaojun;
grant conn to xiaojun
ORA-01919: 角色 'CONN' 不存在
SQL> grant connect to xiaojun;
授予成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> create table test2(userId varchar2(30),userName varchar2(30));
create table test2(userId varchar2(30),userName varchar2(30))
ORA-01031: 权限不足
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select *from text;
select *from text
ORA-00942: 表或视图不存在
SQL> select *from test;
USERID USERNAME
------------------------------ ------------------------------
SQL> desc test;
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
USERID VARCHAR2(30) Y
USERNAME VARCHAR2(30) Y
SQL> select *from emp;
select *from emp
ORA-00942: 表或视图不存在
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant select on emp to xiaogang;
授予成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select *from emp;
select *from emp
ORA-00942: 表或视图不存在
SQL> select*from emp on scott;
select*from emp on scott
ORA-00933: SQL 命令未正确结束
SQL> select*from emp scott.emp
2 select*from emp scott.emp;
select*from emp scott.emp
select*from emp scott.emp
ORA-00933: SQL 命令未正确结束
SQL> select*from emp scott.emp;
select*from emp scott.emp
ORA-00933: SQL 命令未正确结束
SQL> select * from emp scott.emp;
select * from emp scott.emp
ORA-00933: SQL 命令未正确结束
SQL> select * from scott.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 行 已选择
SQL> creat table test(userID varchar2(30),userName varchar2(30));
creat table test(userID varchar2(30),userName varchar2(30))
ORA-00900: 无效 SQL 语句
SQL> create table test(userID varchar2(30),userName varchar2(30));
create table test(userID varchar2(30),userName varchar2(30))
ORA-00955: 名称已由现有对象使用
SQL> create table emp(userID varchar2(30),userName varchar2(30));
表被创建
SQL> show user
User is "xiaogang"
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant update on emp to xiaogang;
授予成功
SQL> grant all on emp to xiaogang;
授予成功
SQL> revoke select on emp to xiaogang;
revoke select on emp to xiaogang
ORA-00905: 缺失关键字
SQL> revoke select on emp from xiaogang;
撤回成功
SQL> revoke update on emp from xiaogang;
撤回成功
SQL> revoke all on emp from xiaogang;
撤回成功
SQL> conn xiaogang /123;
没有登录
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant select on emp to xiaogang;
授予成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.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 行 已选择
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> revoke select on emp from xiaogang;
撤回成功
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> grant select on emp to xiaogang with grant option;
授予成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> select *from scott.emp;
select *from scott.emp
ORA-00942: 表或视图不存在
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> grant select on scott.emp to xiaojun;
授予成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> select *from scott.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 行 已选择
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> revoke select on emp from xiaogang;
撤回成功
SQL> conn xiaojun/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaojun
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL> show user;
User is "xiaojun"
SQL> conn xiaogang/123;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 xiaogang
SQL> select*from scott.emp;
select*from scott.emp
ORA-00942: 表或视图不存在
SQL>
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> create profile www limit failed_login_attempts 3 password_lock_time 2;
配置文件被创建
SQL> alter user scott profile www;
用户已改变
SQL> create profile wwww limit password_life_time 10 password_grace_time 2;
配置文件被创建
SQL> alter user scott profile wwww;
用户已改变
SQL> create profile ssss limit password_life_time 10 password_grace_time 2 password_reuse_time 10;
配置文件被创建
SQL> alter user scott profile ssss;
用户已改变
SQL> drop profile wwww;
配置文件被删掉
SQL>
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 system
SQL> conn scott/LIjun521;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> create table users(userName char(2001));
create table users(userName char(2001))
ORA-00910: 指定的长度对于数据类型而言过长
SQL> create table users(userName char(200));
表被创建
SQL> select*from users
2 ;
USERNAME
--------------------------------------------------------------------------------
SQL> drop table users;
表被删掉
SQL> create table users(userName char(2000));
表被创建
SQL> create table users(userName char(2001));
create table users(userName char(2001))
ORA-00910: 指定的长度对于数据类型而言过长
SQL> create table users(userName char(2000));
create table users(userName char(2000))
ORA-00955: 名称已由现有对象使用
SQL> create table student(
2 xh number(4),
3 xm varchar2(20),
4 xm varchar2(20),
5 sex char(2),
6 birthday date,
7 sal number(7,2),
8 );
create table student(
xh number(4),
xm varchar2(20),
xm varchar2(20),
sex char(2),
birthday date,
sal number(7,2),
)
ORA-00957: 重复的列名
SQL> create table student(
2 xh number(4),
3 xm varchar2(20),
4 sex char(2),
5 birthday date,
6 sal number(7,2),
7 );
create table student(
xh number(4),
xm varchar2(20),
sex char(2),
birthday date,
sal number(7,2),
)
ORA-00904: : 标识符无效
SQL>
SQL> create table student(
2 xh number(4),
3 xm varchar2(20),
4 sex char(2),
5 birthday date,
6 sal number(7,2),
7 )
8 ;
create table student(
xh number(4),
xm varchar2(20),
sex char(2),
birthday date,
sal number(7,2),
)
ORA-00904: : 标识符无效
SQL>
SQL> create table student(
2 xh number(4),
3 xm varchar2(20),
4 sex char(2),
5 birthday date,
6 sal number(7,2),
7 )
8
SQL>
SQL>
SQL> create table student(
2 xh number(4),
3 xm varchar2(20),
4 sex char(2),
5 birthday date,
6 sal number(7,2)
7 );
create table student(
xh number(4),
xm varchar2(20),
sex char(2),
birthday date,
sal number(7,2)
)
ORA-00955: 名称已由现有对象使用
SQL> drop table student;
表被删掉
SQL>
SQL> create table student(
2 xh number(4),
3 xm varchar2(20),
4 sex char(2),
5 birthday date,
6 sal number(7,2)
7 )
8
SQL>
SQL>
SQL> create table student(
2 xh number(4),
3 xm varchar2(20),
4 sex char(2),
5 birthday date,
6 sal number(7,2)
7 );
表被创建
SQL> create table classes(
2 classId number(2),
3 cname varchar2(20)
4 );
create table classes(
classId number(2),
cname varchar2(20)
)
ORA-00955: 名称已由现有对象使用
SQL> desc student;
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
XH NUMBER(4) Y
XM VARCHAR2(20) Y
SEX CHAR(2) Y
BIRTHDAY DATE Y
SAL NUMBER(7,2) Y
SQL> alter table student add(classId varchar(20));
表被改变
SQL> desc student
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
XH NUMBER(4) Y
XM VARCHAR2(20) Y
SEX CHAR(2) Y
BIRTHDAY DATE Y
SAL NUMBER(7,2) Y
CLASSID VARCHAR2(20) Y
SQL> insert into student values(1,'小明','男','11-12月-1997',2345.23,'A102')
2 ;
1 行 已插入
SQL> alter session set nls_date_format='yyyy-mm-dd';
会话被改变
SQL> insert into student values(1,'小明','男','1988-12-3',2345.23,'A102')
2 ;
1 行 已插入
SQL> select*from student;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
1 小明 男 1997-12-11 2345.23 A102
1 小明 男 1988-12-3 2345.23 A102
SQL>
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> desc student;
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
XH NUMBER(4) Y
XM VARCHAR2(20) Y
SEX CHAR(2) Y
BIRTHDAY DATE Y
SAL NUMBER(7,2) Y
CLASSID VARCHAR2(20) Y
SQL> insert into student(xh,xm,sex,birthday) values(3,'aa','女',null);
1 行 已插入
SQL> select*from student;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
1 小明 男 1997-12-11 2345.23 A102
1 小明 男 1988-12-3 2345.23 A102
3 aa 女
SQL> select*from student where birthday=null;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
SQL> select*from student where birthday is null;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
3 aa 女
SQL> select*from student where birthday is not null;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
1 小明 男 1997-12-11 2345.23 A102
1 小明 男 1988-12-3 2345.23 A102
SQL> 已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> update student set sal=sal/2 where sex='男'
2 ;
3 select*from student;
update student set sal=sal/2 where sex='男'
;
select*from student
ORA-00911: 无效字符
SQL> desc student;
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
XH NUMBER(4) Y
XM VARCHAR2(20) Y
SEX CHAR(2) Y
BIRTHDAY DATE Y
SAL NUMBER(7,2) Y
CLASSID VARCHAR2(20) Y
SQL> update student set sal=sal/2 where sex='男';
2 行 已更新
SQL> select*from student;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
1 小明 男 1997-12-11 1172.62 A102
1 小明 男 1988-12-3 1172.62 A102
3 aa 女
SQL> delete from student;
3 行 已删除
SQL> select*from student;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
SQL> rollback;
回滚完成
SQL> insert into student(xh,xm,sex,birthday) values(3,'aa','女',null);
1 行 已插入
SQL> select*from student;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
3 aa 女
SQL> savepoint aa;
保存点被创建
SQL> delete from student;
1 行 已删除
SQL> select*from student;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
SQL> rollback to aa;
回滚完成
SQL> select*from student;
XH XM SEX BIRTHDAY SAL CLASSID
----- -------------------- --- ----------- --------- --------------------
3 aa 女
SQL>
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 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 行 已选择
SQL> desc dept;
Name Type Nullable Default Comments
------ ------------ -------- ------- --------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14) Y
LOC VARCHAR2(13) Y
SQL> select ename,sal,job,deptno from emp;
ENAME SAL JOB DEPTNO
---------- --------- --------- ------
SMITH 800.00 CLERK 20
ALLEN 1600.00 SALESMAN 30
WARD 1250.00 SALESMAN 30
JONES 2975.00 MANAGER 20
MARTIN 1250.00 SALESMAN 30
BLAKE 2850.00 MANAGER 30
CLARK 2450.00 MANAGER 10
SCOTT 3000.00 ANALYST 20
KING 5000.00 PRESIDENT 10
TURNER 1500.00 SALESMAN 30
ADAMS 1100.00 CLERK 20
JAMES 950.00 CLERK 30
FORD 3000.00 ANALYST 20
MILLER 1300.00 CLERK 10
14 行 已选择
SQL> select distinct job,deptno from emp;
JOB DEPTNO
--------- ------
MANAGER 20
PRESIDENT 10
CLERK 10
SALESMAN 30
ANALYST 20
MANAGER 30
MANAGER 10
CLERK 30
CLERK 20
9 行 已选择
SQL> set timing on;
SQL> select distinct job,deptno from emp;
JOB DEPTNO
--------- ------
MANAGER 20
PRESIDENT 10
CLERK 10
SALESMAN 30
ANALYST 20
MANAGER 30
MANAGER 10
CLERK 30
CLERK 20
9 行 已选择
已执行耗时 0.109 秒
SQL> select ename,sal,job,deptno from emp;
ENAME SAL JOB DEPTNO
---------- --------- --------- ------
SMITH 800.00 CLERK 20
ALLEN 1600.00 SALESMAN 30
WARD 1250.00 SALESMAN 30
JONES 2975.00 MANAGER 20
MARTIN 1250.00 SALESMAN 30
BLAKE 2850.00 MANAGER 30
CLARK 2450.00 MANAGER 10
SCOTT 3000.00 ANALYST 20
KING 5000.00 PRESIDENT 10
TURNER 1500.00 SALESMAN 30
ADAMS 1100.00 CLERK 20
JAMES 950.00 CLERK 30
FORD 3000.00 ANALYST 20
MILLER 1300.00 CLERK 10
14 行 已选择
已执行耗时 0.157 秒
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 行 已选择
已执行耗时 0.187 秒
SQL> create table users1(userId varchar2(20),userName varchar2(30),userPss varchar2(30));
表被创建
已执行耗时 0.094 秒
SQL> insert into users1('a0001','韩顺平哈哈哈奥','shunping@sohu.com')
2 ;
insert into users1('a0001','韩顺平哈哈哈奥','shunping@sohu.com')
ORA-00928: 缺失 SELECT 关键字
SQL> insert into users1 values('a0001','韩顺平哈哈哈奥','shunping@sohu.com');
1 行 已插入
已执行耗时 0.141 秒
SQL> select *from users1;
USERID USERNAME USERPSS
-------------------- ------------------------------ ------------------------------
a0001 韩顺平哈哈哈奥 shunping@sohu.com
已执行耗时 0.031 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
1 行 已插入
已执行耗时 0.047 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
2 行 已插入
已执行耗时 0.015 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
4 行 已插入
已执行耗时 0 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
8 行 已插入
已执行耗时 0.047 秒
SQL>
SQL> insert into users1(userId,userName,userPss) select*from users1;
16 行 已插入
已执行耗时 0 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
32 行 已插入
已执行耗时 0.016 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
64 行 已插入
已执行耗时 0.062 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
128 行 已插入
已执行耗时 0.062 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
256 行 已插入
已执行耗时 0.078 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
512 行 已插入
已执行耗时 0.14 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
1024 行 已插入
已执行耗时 0.062 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
2048 行 已插入
已执行耗时 0.203 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
4096 行 已插入
已执行耗时 0.344 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
8192 行 已插入
已执行耗时 0.281 秒
SQL>
SQL> insert into users1(userId,userName,userPss) select*from users1;
现在不能执行命令
SQL>
16384 行 已插入
已执行耗时 1.391 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
32768 行 已插入
已执行耗时 1 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
65536 行 已插入
已执行耗时 3 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
131072 行 已插入
已执行耗时 3.75 秒
SQL> insert into users1(userId,userName,userPss) select*from users1;
262144 行 已插入
已执行耗时 6.094 秒
SQL> select*from users
2 ;
USERNAME
--------------------------------------------------------------------------------
已执行耗时 0.047 秒
SQL> select*from users1;
已连接到 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
已连接为 scott
SQL> select distinct job from emp;
JOB
---------
CLERK
SALESMAN
PRESIDENT
MANAGER
ANALYST
已执行耗时 0.031 秒
SQL> select distinct job,empno from emp;
JOB EMPNO
--------- -----
CLERK 7369
SALESMAN 7499
SALESMAN 7521
MANAGER 7566
SALESMAN 7654
MANAGER 7698
MANAGER 7782
ANALYST 7788
PRESIDENT 7839
SALESMAN 7844
CLERK 7876
CLERK 7900
ANALYST 7902
CLERK 7934
14 行 已选择
已执行耗时 0.203 秒
SQL> select deptno,job from emp;
DEPTNO JOB
------ ---------
20 CLERK
30 SALESMAN
30 SALESMAN
20 MANAGER
30 SALESMAN
30 MANAGER
10 MANAGER
20 ANALYST
10 PRESIDENT
30 SALESMAN
20 CLERK
30 CLERK
20 ANALYST
10 CLERK
14 行 已选择
已执行耗时 0.125 秒
SQL> select distinct empno,job from emp;
EMPNO JOB
----- ---------
7369 CLERK
7499 SALESMAN
7521 SALESMAN
7566 MANAGER
7654 SALESMAN
7698 MANAGER
7782 MANAGER
7788 ANALYST
7839 PRESIDENT
7844 SALESMAN
7876 CLERK
7900 CLERK
7902 ANALYST
7934 CLERK
14 行 已选择
已执行耗时 0.141 秒
SQL> select distinct deptno,job from emp;
DEPTNO JOB
------ ---------
20 CLERK
30 SALESMAN
20 MANAGER
30 CLERK
10 PRESIDENT
30 MANAGER
10 CLERK
10 MANAGER
20 ANALYST
9 行 已选择
已执行耗时 0.109 秒
SQL> desc dept;
Name Type Nullable Default Comments
------ ------------ -------- ------- --------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14) Y
LOC VARCHAR2(13) Y
SQL> desc emp;
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
EMPNO NUMBER(4)
ENAME VARCHAR2(10) Y
JOB VARCHAR2(9) Y
MGR NUMBER(4) Y
HIREDATE DATE Y
SAL NUMBER(7,2) Y
COMM NUMBER(7,2) Y
DEPTNO NUMBER(2) Y
SQL> select sal,job,depno from emp;
select sal,job,depno from emp
ORA-00904: "DEPNO": 标识符无效
SQL> select sal,job,deptno from emp;
SAL JOB DEPTNO
--------- --------- ------
800.00 CLERK 20
1600.00 SALESMAN 30
1250.00 SALESMAN 30
2975.00 MANAGER 20
1250.00 SALESMAN 30
2850.00 MANAGER 30
2450.00 MANAGER 10
3000.00 ANALYST 20
5000.00 PRESIDENT 10
1500.00 SALESMAN 30
1100.00 CLERK 20
950.00 CLERK 30
3000.00 ANALYST 20
1300.00 CLERK 10
14 行 已选择
已执行耗时 0.141 秒
SQL> select sal,job,deptno from emp where ename='smith';
SAL JOB DEPTNO
--------- --------- ------
已执行耗时 0.016 秒
SQL> select sal,job,deptno from emp where ename='SMITH';
SAL JOB DEPTNO
--------- --------- ------
800.00 CLERK 20
已执行耗时 0.031 秒
SQL> select SAL,job,deptno from emp where ename='SMITH';
SAL JOB DEPTNO
--------- --------- ------
800.00 CLERK 20
已执行耗时 0.047 秒
SQL> desc dep
对象 dep 不存在.
SQL>
SQL> desc dept;
Name Type Nullable Default Comments
------ ------------ -------- ------- --------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14) Y
LOC VARCHAR2(13) Y
SQL> desc emp;
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
EMPNO NUMBER(4)
ENAME VARCHAR2(10) Y
JOB VARCHAR2(9) Y
MGR NUMBER(4) Y
HIREDATE DATE Y
SAL NUMBER(7,2) Y
COMM NUMBER(7,2) Y
DEPTNO NUMBER(2) Y
SQL>