<strong>創(chuàng)建用戶,、授權(quán)和撤消權(quán)限</strong>
登錄oracle:
sqlplus / as sysdba
啟動(dòng)監(jiān)聽:
lsnrctl start
啟動(dòng)數(shù)據(jù)庫的實(shí)例:
oradim -startup -sid orcl
SQL> show user ; //顯示當(dāng)前用戶
SQL> create user lisi identified by lisi; //創(chuàng)建一個(gè)用戶
SQL> grant create session to lisi; //給用戶授予會(huì)話權(quán)限
SQL> sqlplus lisi/lisi //用創(chuàng)建的用戶進(jìn)行登錄
SQL> grant unlimited tablespace to lisi //給用戶授予表空間權(quán)限
SQL> grant create table to lisi; //給用戶創(chuàng)建表的權(quán)限
SQL> create table mytable (id int ); //創(chuàng)建表
SQL> insert into mytable values (1); //插入數(shù)據(jù)
SQL> select * from mytable; //查詢數(shù)據(jù)
SQL> drop table mytable //刪除表
SQL> revoke create table from lisi; //撤消對(duì)表操作的權(quán)限
SQL> select * from user_sys_privs; //查詢當(dāng)前用戶擁有哪些權(quán)限
SQL> revoke unlimited tablespace from lisi; //撤消對(duì)表空間操作的權(quán)限
<strong>丟失管理員密碼怎么辦,?</strong>
用sys用戶進(jìn)行修改
sqlplus / as sysdba
alter user scott Identified by tiger;
oracle 9
更改口令文件
把原有口令文件刪掉
E:\oracle\ora92\ database \pwdora9i.ora;
orapwd file=E:\oracle\ora92\ database \pwdora9i.ora password =sys entries=10;
select * from v$pwfile_users;
oracle 10+
更改口令文件
把原有口令文件刪掉
E:\oracle\ora92\ database \PWDorcl.ora;
orapwd file=E:\oracle\ora92\ database \PWDorcl.ora password =sys entries=10;
select * from v$pwfile_users;
<strong>角色管理</strong>
角色就是一個(gè)權(quán)限的集合,。
show user ; 顯示當(dāng)前用戶
create role myrole; 創(chuàng)建一個(gè)角色
grant create session to myrloe; 給角色授予session權(quán)限
grant create table to myrole; 給角色授予表操作權(quán)限
create user zhangsan identified by zhangesan; 創(chuàng)建一個(gè)用戶
grant myrole to zhangsan; 把角色授予給用戶
sqlplus zhangsan/zhangsan 用戶登錄
drop role myrole; 刪除角色
grant unlimited tablespace to myrole; 這個(gè)權(quán)限比較大,,不能通過角色授權(quán),,只能授權(quán)給用戶
<strong>權(quán)限的傳遞</strong>
|