--模式(方案)逻辑概念:一个数据对象的集合,每一个用户
--都有一个与之同名的模式,用于存放此用户名下的所有数据对象。
select * from user_objects
select * from dba_users;
--创建用户
1、给用户创建自己的数据表空间
create tablespace ts
datafile 'd:\123.dbf' size 10m autoextend on;
2、创建临时表空间
create temporary tablespace tmp_ts
tempfile 'd:\tmp123.dbf' size 5m autoextend on;
3、创建用户,并给他指导表空间
create user zhangsan
identified by zs123
default tablespace ts
temporary tablespace tmp_ts
4、修改用户密码
alter user zhangsan identified by zs321;
5、给用户加锁、解锁
alter user zhangsan account lock;
alter user zhangsan account unlock;
--给用户授权
--权限:--系统权限(create session、访问目录,alter database)
--对象权限(对于某张表的insert、update、delete)
1、直接
grant create session,alter database to zhangsan;
2、间接
1)创建角色(角色相当于一个权限的集合)
create role role_zjl;
2)给角色授权
grant create session,alter database,create table to role_zjl;
3)把角色授权给用户
grant role_zjl to zhangsan;
--关于表级别的权限
直接:
grant insert ,update on scott.emp to zhangsan;
grant all on scott.emp to zhangsan;
间接:
grant all on scott.emp to role_zjl;
grant role_zjl to zhangsan;
--撤销权限
revoke all on scott.emp from zhangsan;
revoke role_zjl from zhangsan;
--删除用户
drop user zhangsan cascade;
--基本的授权 connect resource dba 都是系统角色
--查询当前有哪些角色
select * from dba_roles;
--查询指定系统角色拥有哪些权限
select * from role_sys_privs where role='DBA'
--------------部署---------------------------------
grant dba to zhangsan;
--exp/imp传统的数据导入导出工具
导出:
exp scott/tiger@xe file='d:\123.dmp'
导入:
imp scott/tiger@xe file='d:\123.dmp'