首页 > 代码库 > oracle 外部表查alter日志
oracle 外部表查alter日志
--创建文件夹,路径是alter日志的路径 create or replace directory data_dir as ‘/u01/app/oracle/diag/rdbms/orcl/orcl/trace‘; --创建外部表 create table alert_log( text_line varchar2(225) ) organization external ( TYPE ORACLE_LOADER DEFAULT DIRECTORY DATA_DIR ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE FIELDS ) LOCATION ( ‘alert_orcl.log‘ ) ); --查询数据库启动时间sql select to_char(LAST_TIME) shutdown, to_char(start_time) starup, round((start_time - LAST_TIME) * 24 * 60, 2) mins_down, round((LAST_TIME - lag(start_time) over(order by r)), 2) days_up, case when (lead(r) over(order by r) is null) then round((sysdate - start_time), 2) end days_still_up from (select r, to_date(last_time, ‘Dy Mon DD HH24:MI:SS YYYY‘, ‘NLS_DATE_LANGUAGE = American‘) LAST_TIME, to_date(start_time, ‘Dy Mon DD HH24:MI:SS YYYY‘, ‘NLS_DATE_LANGUAGE = American‘) start_time from (select r, text_line, lag(text_line, 1) over(order by r) start_time, lag(text_line, 2) over(order by r) last_time from (select rownum r, text_line from alert_log where text_line like ‘___ ___ __ __:__:__ 20__‘ or text_line like ‘Starting ORACLE instance %‘)) where text_line like ‘Starting ORACLE instance %‘);
oracle 外部表查alter日志
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。