create user and profile
1.create user 包含的参数 username,password,default tablespace,temporary tablespace,quota xxx on tablespace,profile.
2.quota select * from dba_ts_quotas
3.要启动资源限制,必须resource_limit=true
alter system set resource_limit=true
4.create profile 数据字典 select * from dba_profiles
l Sessions_per_user---用户帐户同时连接的会话数量,当达到限制时,产生ora-02391
l Cpu_per_session---限制用户在一次数据库会话期间可以占用的cpu时间的总量,单位为百分之一秒。
l User_per_call---限制用户可用的cpu时间总量,单位为百分之一秒。和cpu_per_session不同,该资源是一每次调用的SQL语句为基准来限制的,不以每次会话为基准。
l Logical_reads_per_session---限制在一次给定的数据库会话期间能够进行的逻辑读(单位为数据块)的次数。
l Logical_reads_per_call---一次cpu调用的SQL语句期间,可以读取的数据库块数。
l Idle_time---指定用户在数据库终止之前,可以让连接处于多长的空闲时间,以分为单位。
l Connect_time---限定用户可以和数据库连接的时间总量,单位为分钟
l Private_sga---表示用户私有的SGA区的大小,单位为数据块,默认值为unlimited
l Composite_limit---是一项由多个资源限制参数构成的复杂的资源项, alter resource cost connect_time 10;
l Failed_login_attempts---该参数限制用户在登录到oracleDB时运行失败的次数。
l Password_life_time---用于设定用户口令的有效时间,单位为天数,超过这一事件,必须重新设口令,默认为unlimited
l Password_reuse_time---设定了一个实效口令在经过多少天后才可以由用户重新使用,默认为unlimited
l Password_reuse_max---再次启动一个已经用过的口令前必须对该口令进行重新设置的次数(重复用的次数)
l Password_lock_time---当登录失败达到failed_login_attempts,该帐户被锁定的天数。
l Password_grace_time---设定在口令实效前,给予的重新设定该口令的天数。
eg:create profile best limit
sessions_per_user 2
idle_time 2
connect_time 10
failed_login_attempts 3
password_life_time 9
password_reuse_time 3
alter profile best limit failed_login_attempts 2
alter user user_name account unlock
drop profile best cascade
5.create user
create user lll identified by lll
default tablespace users
temporary tablespace temp
quota 100m[unlimited] on system
profile best
password expire ; ---要求用户第一次登陆数据库时就必须确定有效的口令字
quota的表空间限制 select * from dba_ts_quotas
alter user user_name identified by password; 其他的类似
drop user user_name cascade;
6.监视用户
select * from v$session
alter system kill session 'sid,serial#'
select * from v$open_cursor 显示当前正在运行的sql语句。
session_wait 监视数据库中时间的等待信息