1、概念
(1)使用者 User:使用者(賬戶)是定義在資料庫裡的一個名稱。
(2)特權使用者:特權使用者是指具有特殊許可權(sysdba 或 sysoper)的資料庫使用者。
SYSDBA 自動具備了DBA角色的所有許可權,而sysoper則不具備DBA角色的許可權。
(3)方案(Schema):方案是使用者所擁有資料庫物件的集合。
2、使用者認證方式
(1)OS認證:是指使用OS檢查使用者、口令和使用者身份的方式。
(2)database認證
3、建立使用者
(1)建立資料庫認證的使用者
SQL> create user rose
2 identified by oracle
3 default tablespace users
4 temporary tablespace temp
5 quota 10m on users
6 password expire; ——使用者一登入密碼就到期,需要重新設定
User created.
SQL> grant create session to rose;
Grant succeeded.
SQL> conn rose/oracle
ERROR:
ORA-28001: the password has expired
Changing password for rose
New password:
Retype new password:
Password changed
Connected.
(2)建立OS認證(作業系統認證)使用者(sys 使用者屬於os 認證)
SQL> show parameter auth
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix string ops$ ——建立OS認證的使用者名稱前面一定要加上這個參數
remote_os_authent boolean FALSE
1 create user ops$oracle ——建立使用者,不要加雙引號
2 identified externally
3 profile default
4 default tablespace users
5 temporary tablespace temp
6* quota 10m on users
SQL> /
User created.
SQL> select username,account_status from dba_users;
USERNAME ACCOUNT_STATUS
--------------- -------------------------
OUTLN OPEN
SYS OPEN
SYSTEM OPEN
ROSE OPEN
SCOTT OPEN
ops$oracle OPEN
TOM OPEN
DBSNMP EXPIRED & LOCKED
TSMSYS EXPIRED & LOCKED
DIP EXPIRED & LOCKED
10 rows selected.
SQL> select username ,password ,PROFILE,DEFAULT_TABLESPACe,TEMPORARY_TABLESPACE from dba_users;
USERNAME PASSWORD PROFILE DEFAULT_TABLESP TEMPORARY_TABLE
--------------- -------------------- --------------- --------------- ---------------
OUTLN 4A3BA55E08595C81 DEFAULT SYSTEM TEMP
SYS 8A8F025737A9097A DEFAULT SYSTEM TEMP
SYSTEM 2D594E86F93B17A1 DEFAULT SYSTEM TEMP
ROSE 1166A1F535AF6EFB DEFAULT USERS TEMP
SCOTT F894844C34402B67 DEFAULT USERS TEMP
ops$oracle EXTERNAL DEFAULT USERS TEMP
TOM 0473A0A9140BFBD7 DEFAULT USERS TEMP
DBSNMP E066D214D5421CCC DEFAULT SYSAUX TEMP
TSMSYS 3DF26A8B17D0F29F DEFAULT USERS TEMP
DIP CE4A36B8E06CA59C DEFAULT USERS TEMP
SQL> grant create session to ops$oracle;
Grant succeeded.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@solaris10 ~]$id
uid=100(oracle) gid=100(oinstall)
[oracle@solaris10 ~]$sqlplus / ——登入不需要提供使用者名稱和密碼(oracle 必須屬於os的dba組)
SQL*Plus: Release 10.2.0.2.0 - Production on Wed Mar 14 16:07:43 2012
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> show user
USER is "OPS$ORACLE"
查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/