`
拓子轩
  • 浏览: 204645 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

oracle基础

阅读更多

3个默认的用户(oracle9)
 sys      change_on_install [as sysdba] (网络管理员,权限最高)
 system manager    (本地普通管理员)
 scott tiger    (普通用户)


创建用户
 1.打开命令窗口,输入sqlplus / as sysdba
 2.在出现的SQL>m命令行下输入 show user, 会提示USER为“SYS”
 3.然后输入:create user lisi identified by lisi;
 4.授权:grant create session to lisi;
  gramt create table to lisi;
  grant unlimited tablespace to lisi;
  grant create session to public;
  revoke create table from lisi; 收回创建表的权限
 5.另启一个命令行窗口,输入:sqlplus lisi/lisi
 6.创建表:create table mytable (id int);
 7.插入数据并提交:insert into mytable values(1);
   commit;
 8.删除表:drop table mytable;
 9.查看用户被赋予的权限:select * from user_sys_privs;
    select * from user_tab_privs;


对象权限:把自己创建的表的查询权限赋予给另外一个用户
 grant select on mytab to lisi;
 grant all on mytab to lisi;
 revoke select on mytab from lisi;
 revoke all on mytab from lisi;


对象权限可以控制到列:
 grant update(name) on mytab to lisi;
 grant insert(id) on mytab to lisi;
 select * from user_col_privs;
 查询和删除不能控制到列


权限传递:
 grant  alert any table to lisi with admin option;
 grant select on sys.A to wangwu with grant option;


角色:
 create role myrole;
 grant create session to myrole;
 grant create table to myrole;
 create user zhangsan identified by zhangsan;
 grant myrole to zhangsan;
 drop role myrole;
     注意:有些系统权限是不能直接赋予给角色的,如inlimited tablespace
 crate table       create any table
 [alter table] alter any table
 [drop table] drop any table
 表是属于某一个用户的,而角色不属于某个用户
数据库的三种验证机制:操作系统验证、密码文件验证、数据库验证
linux下oracle的启动过程:
 lsnrctl start
 //sqlplus sys/oracle as sysdba
 sqlplus /nolog
 conn sys/oracle as sysdba
 startup
window下oracle的启动过程:
 lsnrctl start
 startup


更改口令文件:
 把原有口令文件删掉
 E:\oracle\ora92\database\pwdora9i.ora;
 orapwd file=E:\oracle\ora92\database\pwdora9i.ora password=sys entries=10;

 select * from v$pwfile_users;

 

Oracle数据库用户
 1.三个常用的系统用户 
  Scott(一个数据库的普通用户)
  Connect scott/tiger

  Manager(数据库管理员)
   Connect system/manager

  Sys(数据库对象的拥有者权限最高)
  Connect sys/change_on_install as sysdba;sss


创建用户
 Create User 用户名
 Indentified by 密码
 Default TableSpace 默认表空间
 Temporay TableSpace 临时表空间
 Quota 整数 K|M|Limited on 表空间


限制用户
 用户加锁:alter User 用户名 Account Lock
 用户解锁:alter User 用户名 Account Unlock
 用户口令立即失效:alter User 用户名 Password Expire


删除用户
 Drop User 用户名[CasCade]
  CasCade表示删除所有对象

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics