//创建和使用角色:
create role APPLICATION_USER;
grant CREATE SESSION to APPLICATION_USER;
grant APPLICATION_USER to username;
//回滚段的管理
create rollback segment SEGMENT_NAME tablespace RBS;
alter rollback segment SEGMENT_NAME offline;
drop rollback segment SEGMENT_NAME;
alter rollback segment SEGMENT_NAME online;
//回滚段上指定事务
commit;
set transaction use rollback segment ROLL_BATCH;
insert into TABLE_NAME
select * from DATA_LOAD_TABLE;
commit;
//查询回滚段的 大小和优化参数
select * from DBA_SEGMENTS
where Segment_Type = ’ROLLBACK’;
select N.Name, /* rollback segment name */
S.OptSize /* rollback segment OPTIMAL size */
from V$ROLLNAME N, V$ROLLSTAT S
where N.USN=S.USN;
//回收回滚段
alter rollback segment R1 shrink to 15M;
alter rollback segment R1 shrink;
//例子
set transaction use rollback segment SEGMENT_NAME
alter tablespace RBS
default storage
(initial 125K next 125K minextents 18 maxextents 249)
create rollback segment R4 tablespace RBS
storage (optimal 2250K);
alter rollback segment R4 online;
select Sessions_Highwater from V$LICENSE;
grant select on EMPLOYEE to PUBLIC;
//用户和角色
create role ACCOUNT_CREATOR;
grant CREATE SESSION, CREATE USER, ALTER USER
to ACCOUNT_CREATOR;
alter user THUMPER default role NONE;
alter user THUMPER default role CONNECT;
alter user THUMPER default role all except ACCOUNT_CREATOR;
alter profile DEFAULT
limit idle_time 60;
create profile LIMITED_PROFILE limit
FAILED_LOGIN_ATTEMPTS 5;
create user JANE identified by EYRE
profile LIMITED_PROFILE;
grant CREATE SESSION to JANE;
alter user JANE account unlock;
alter user JANE account lock;
alter profile LIMITED_PROFILE limit
PASSWORD_LIFE_TIME 30;
alter user jane password expire;