Oracle入门(六)之用户操作
定義:也叫方案,是一組邏輯對(duì)象的所有者。
驗(yàn)證方式:數(shù)據(jù)庫(kù)驗(yàn)證和操作系統(tǒng)驗(yàn)證。
表空間和臨時(shí)表空間:表空間為用戶創(chuàng)建數(shù)據(jù)對(duì)象的存儲(chǔ)表空間;臨時(shí)表空間用于創(chuàng)建臨時(shí)段。
空間分配:表空間中,必須要為一個(gè)用戶指派空間配額,用于存儲(chǔ)數(shù)據(jù)庫(kù)對(duì)象。一、創(chuàng)建用戶
create? user 用戶名??identified by 新密碼 [ default? tablespace 表空間名(默認(rèn)為users)]? ?[ temporary? tablespace? 臨時(shí)表空間]? ? [quota 大小 on 表空間名]*?;
SQL> create user java identified by oracle default tablespace users temporary tablespace temp quota 100m on users quota 100m on system; --注意temp表空間不支持表空間配額 注: Oracle表空間配額(quota)二、修改用戶
(1)修改密碼
a.? 在有權(quán)限的情況下,修改任一用戶密碼
語(yǔ)法:alter user 用戶名 identified by 新密碼;
SQL> alter user sys identified by abc; b.修改當(dāng)前登錄用戶的密碼 SQL> password 更改 SYS 的口令 舊口令: 新口令: 重新鍵入新口令:口令已更改(3)修改默認(rèn)表空間
語(yǔ)法:alter user 用戶名 default tablespace 表空間名;
alter user user01 default tablespace tbs;注:
在線指定系統(tǒng)默認(rèn)表空間? ?alter database default tablespace 表空間名;
(4)修改臨時(shí)表空間
修改用戶aa的默認(rèn)表空間
alter user aa temporary tablespace 表空間名;
注:
將系統(tǒng)的默認(rèn)臨時(shí)表空間? alter database default temporary tablespace 表空間名;
三、刪除用戶
drop user 用戶名? [cascade];
說(shuō)明: cascade為級(jí)聯(lián)刪除該用戶創(chuàng)建的schema objects,不會(huì)刪除相應(yīng)的tablespace的。若用戶有創(chuàng)建schema objects,缺少cascade則會(huì)報(bào)錯(cuò)。
四、賦權(quán)限
grant connect,dba to 用戶名;
五、用戶鎖定和解鎖
alter user 用戶名 account lock/unlock;
六、查詢用戶
(1)查看數(shù)據(jù)庫(kù)里面所有用戶
前提是你是有dba權(quán)限的帳號(hào),如sys,system
select * from dba_users;?
SQL> select username from dba_users;USERNAME ------------------------------------------------------------ MGMT_VIEW SYS SYSTEM DBSNMP ......已選擇37行。(2)查看你能管理的所有用戶
select * from all_users;?
SQL> select username from all_users;USERNAME ------------------------------------------------------------ USER1 BI PM SH IX OE HR ......已選擇37行。(3)查看當(dāng)前用戶的用戶信息?
?select * from user_users;? SQL> select username from user_users;USERNAME ------------------------------------------------------------ SYS總結(jié)
以上是生活随笔為你收集整理的Oracle入门(六)之用户操作的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: OPPOA5怎么样?
- 下一篇: Oracle入门(八)之权限