Oracle使用者管理概述

來源:互聯網
上載者:User

user, user account, schema的區別

A user isa person who connects to a user account by establishing a session against theinstance and log on with the user account name

A schemais a set of objects owned by a user account.

使用者帳號的屬性

1、使用者名稱(必須)

2、認證方法(必須)

3、預設資料表空間

4、資料表空間的配額

5、預設暫存資料表空間

6、使用者的設定檔

7、使用者帳號的狀態

使用者名稱必須以字母開頭,不能超過30個字元,可以包含字母,數字,$ 和底線_,並且不能使用保留字;字母是大小寫敏感的,但是儲存的時候都會儲存為大寫。這些規則可以通過雙引號打破;

sql> create user"john%#" identified by pa55w0rd;

使用者名稱一旦建立就不允許修改,除非你把使用者刪掉重建,但是這個相當危險,因為你刪除使用者的同時會刪除其所有對象;

設定預設資料表空間:

設定整個資料庫的預設資料表空間:ALTER DATABASE DEFAULT TABLESPACE tablespacename;如果沒有指定的話,預設的是SYSTEM資料表空間;

--查看使用者的預設資料表空間和臨時空間

selectusername,default_tablespace,temporary_tablespace from dba_users whereusername='SJ';

配額是一個使用者其擁有的對象在資料表空間中可以佔用的容量;

--更改一個使用者在資料表空間中的配額

alter user SJ quota500M on sj;

--將一個使用者在資料表空間中的配額更改為無限制

alter user SJ quotaunlimited on sj;

--查看使用者在資料表空間中的配額情況

selecttablespace_name,bytes,max_bytes from dba_ts_quotas where username='SJ';

--查看整個資料庫的預設資料表空間和預設暫存資料表空間

selectproperty_name,property_value from database_properties

where property_namelike '%TABLESPACE';

暫存資料表空間:

當一個session進行某個操作時需要的記憶體容量超過了該session的PGA容量,那麼這個時候session就會用到temporary tablespace;

使用暫存資料表空間的操作包括:

1、行排序

2、表串連

3、構建索引

4、使用暫存資料表

暫存資料表空間的空間管理時系統自動進行的

使用者不需要在暫存資料表空間上分配配額,因為暫存資料表空間的所有對象都屬於SYS,SYS使用者在所有資料表空間上都有unlimited的配額;

--更改使用者的暫存資料表空間

ALTER USER username TEMPORARYTABLESPACE tablespacename;

當有大量使用者使用同一個使用者賬戶的時候,就會造成暫存資料表空間的瓶頸,這個時候可以為每個帳號分配自己的暫存資料表空間

 

設定檔:Profile

設定檔的主要作用:控制密碼的設定格式並且限制使用者對資源的佔用情況;

 

使用者帳號狀態:

1、OPEN

2、LOCKED

3、EXPIRED

4、EXPIRED&LOCKED

5、EXPIRED(GRACE)

6、LOCKED(TIMED)

7、EXPIRED&LOCKED(TIMED)

8、EXPIRED(GRACE)&LOCKED

9、EXPIRED(GRACE)&LOCKED(TIMED)

 

ALTER USER username ACCOUNT LOCK;

ALTER USER username ACCOUNTUNLOCK;

ALTER USER username PASSWORDEXPIRE;

 

認證方法

1、作業系統認證:sysdba/sysoper

2、密碼檔案認證:  sysdba/sysoper

3、密碼認證

4、external 認證

5、global 認證      LDAP directory server

--如果要查看哪些使用者擁有sysdba/sysoper許可權,可以查看V$PWFILE_USER視圖;

select * fromv$pwfile_users;

還有一種許可權也很特別SYSASM,這個許可權是在ASM執行個體中使用的;

SYS使用者不允許使用密碼認證方式進行串連,它只能使用密碼檔案方式,作業系統方式和LDAP認證方式;

在建立串連時,密碼在網路上傳輸的時候必須使用AES密碼編譯演算法加密,對於其他會話內容是不提供加密的,如果需要加密,需要 AdvancedSecurity Option的支援;

SYSTEM使用者可以更改其他使用者的密碼:

ALTER USER usename IDENTIFIED BYpassword;

外部認證:

If theAdvanced Security Option has been licensed , then the external service can beKerberos server, a RADIUS server,  or inthe Windows native authentication

Without  the Advanced security Option, the only form of external authenticationthat can be used is operating system authentication;

Thetechnique is to create an Oracle user account with the same name as theoperating system user account but prefixed with a string specified by theinstance parameter OS_AUTHENT_PREFIX

selectvalue from v$parameter where name='os_authent_prefix';

在linux或unix環境中建立外部作業系統認證的方法很簡單,假定系統上有一個系統使用者為cedar,

在Oracle需要以下兩步:

createuser ops$cedar identified externally;

grantcreate session to ops$cedar;

在windos環境中,假定使用者名稱為cedarfan 所在的域為DBA,那麼在Oracle中需要如下的語句

createuser "OPS$DBA\CEDAR FAN" identified externally;

GlobalAuthentication

Anemerging standard for identity management makes user of LDAP servers


系統管理使用者帳號:

--建立使用者帳號

create user sjidentified by sj

default tablespace sjtemporary tablespace temp

quota 500M onsj,quota unlimited on users

profile test_frofile

password expire

account unlock;

--刪除使用者

drop user sj --這個命令只有在該使用者沒有任何對象的情況下才能執行成功

drop user sjcascade;--這個命令可以先刪除對象,然後再刪除使用者

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.