Oracle 事件跟踪

--查询30分钟前的数据
select * from t as of timestamp sysdate - 1/24/2 where t.id = 999;


--以下命令需要在SQLPLUS中执行:
--获取sql执行计划以及统计信息
set autotrace traceonly explain statistics;

 

--以下命令需要能访问oracle服务器查看输出日志:
--开启事件跟踪
alter session set events '10046 trace name context forever,level 1';
--关闭事件跟踪
alter session set evevts '10046 trace name context off';

--开启sql跟踪
alter session set sql_trace true;
--关闭sql跟踪
alter session set sql_trace false;

--设置跟中日志名称
alter session set tracefile_identifier = 'fileName';

 

alter table chg_number nologging; --取消打印日志
alter table chg_number logging;--允许打印日志

 

--创建DBlink

create public database link chg_dbl
  connect to scott identified by tiger
  using 'big';

 

 

(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = szxdb32-ts)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = szxdb33-ts)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = podb)
    )
  )

你可能感兴趣的:(oracle,sql,SQL Server)