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/