Oracle 基础之数据库管理

来源:互联网 发布:影楼后期制作软件 编辑:程序博客网 时间:2024/06/04 18:10

Oracle数据库管理需要对应的权限,最好是DBA权限

用户管理:

01--创建用户给其一个密码(必须给其一个密码)
02create user king IDENTIFIED by king;
03--创建的新用户要给其权限
04grant connect to king;
05grant resource to king;
06--给用户scott解锁
07alter user scott account unlock ;
08--把用户锁住
09alter user scott account lock;
10--给用户scott修改密码
11alter user scott IDENTIFIED by tarena123;

别名管理:

11. 定义同义词
2--定义一个公有的别名 scott.emp ----> emp 
3create public synonym emp for scott.emp;

  

12.删除同义词:
2  drop public synonym table_name;

 

13.查看所有同义词:
2  select * from dba_synonyms

 权限管理:

    对表操作的权限:

1grant select on emp to jsd1404;
2grant insert on emp to jsd1404;
3grant delete on emp to jsd1404;
4grant update on emp to jsd1404;
5grant alter on emp to jsd1404;
6grant update on emp to jsd1404 with grant option; 授权更新权限转移给xujin用户,许进用户可以继续授权;

   收回权限:

1revoke  select on emp from jsd1404;
2revoke  insert on emp from jsd1404;
3revoke  update on emp from jsd1404;
4revoke  delete on emp from jsd1404;
5revoke  alter on emp from jsd1404;

    对用户操作的权限:

1grant connect to king;--给用户授予连接的权限
2grant resource to king;--给用户king授予 所有资源的权限

    对存储过程的权限:

1grant create procedure to jsd1404;--授予创建存储过程的权限
2grant execute procedure_name to jsd1404;--授予执行某个存储过程的权限

    对表空间操作的权限:

1grant create tablespace to jsd1404; --授予可以创建tablespace 的权限
2grant alter tablespace to jsd1404;--授予可以修改tablespace 的权限


    其他:

view source
print?
1select * from dba_users;-- 查询数据库中的所有用户
2select table_name,privilege from dba_tab_privs where grantee='jsd1404';-- 查询一个用户拥有的对象权限
3select * from dba_sys_privs where grantee='jsd1404';-- 查询一个用户拥有的系统权限
4select * from session_privs; --当钱会话有效的系统权限

1grant update on table1 to jsd1404 with grant option; 授权更新权限转移给xujin用户,许进用户可以继续授权;
0 0