Bo's Oracle Station

查看: 1661|回复: 0

2014-08-02-6.sql

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2014-8-6 08:36:11 | 显示全部楼层 |阅读模式
select  * from dict where table_name like '%UNDO%' or table_name like '%ROLL%';

select  * from v$undostat;

select  * from V$ROLLNAME;

select * from V$ROLLSTAT;

select  * from dba_rollback_segs;

create undo tablespace undotbs2 datafile size 256k autoextend off;

drop tablespace undotbs1;

select  * from dba_rollback_segs;

select * from dba_alert_history;

select  * from v$sqltext where sql_id='b4ypsk068tpkv';

select * from v$transaction;

select  * from v$session where taddr='00000001E455FB38';

alter system kill session '12,1176' immediate;

SQL> select  salary  from employees as of timestamp to_timestamp('2014-08-02:17:15:00','YYYY-MM-DD:HH24:MI:SS')  
  2    where employee_id=100;

    SALARY
----------
     24001

SQL>

create undo tablespace undotbs3 datafile size 100M autoextend on maxsize 10G;

alter system set undo_tablespace=undotbs3;

drop tablespace undotbs1;

select  * from dba_rollback_segs;

alter system flush buffer_cache;


create tablespace tbsaudit datafile size 20M  autoextend on ;

drop table  tlogon ;

create table tlogon  (   audit_time  varchar2(100),
                                      audit_ipaddress  varchar2(60),
                                      audit_user  varchar2(30))   tablespace tbsaudit ;



create or replace trigger   trg_logon
after logon on database
when (user ='HR' )
begin
        insert into    tlogon    values(to_char(sysdate,'YYYY-MM-DD:HH24:MI:SS'),
                                             sys_context('userenv' , 'ip_address'),
                                               sys_context('userenv' , 'session_user')             );
        commit;
end;

select  o.status  from dba_objects o where o.owner='SYS' and o.object_name='TRG_LOGON';


select  * from tlogon;














create or replace trigger log_logon
after logon on database
when (user ='SYS' or user like 'OPS$%')
begin
        insert into t2 values('Logon '||user||' at '||to_char(sysdate,'YYYY-MM-DD HH24:MI:SS'));
        commit;
end;


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-5 02:55 , Processed in 0.035330 second(s), 24 queries .

快速回复 返回顶部 返回列表