Oracle External table Check alter log

Source: Internet
Author: User

--Create a folder where the path is the alter log pathCreate or ReplaceDirectory Data_dir as'/u01/app/oracle/diag/rdbms/orcl/orcl/trace';--Create an external tableCreate TableAlert_log (Text_linevarchar2(225)) organization external (TYPE Oracle_loaderDEFAULTDIRECTORY data_dir ACCESS PARAMETERS (RECORDS delimited byNEWLINE Fields) Location ('Alert_orcl.log'       ));--Querying database startup time SQLSelectTo_char (Last_time)shutdown, To_char (start_time) Starup,round((start_time-Last_time)*  - *  -,2) Mins_down,round((Last_time-Lag (start_time) Over(Order  byR)),2) days_up, Case          when(Lead (R) Over(Order  byR is NULL) Then          round((sysdate-Start_time),2)       Enddays_still_up from(SelectR, 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(SelectR, Text_line, Lag (Text_line,1) Over(Order  byr) start_time, Lag (Text_line,2) Over(Order  byr) Last_time from(Selectrownum R, Text_line fromAlert_logwhereText_line like '___ ___ __ __:__:__ 20__'                            orText_line like 'starting ORACLE instance%'))         whereText_line like 'starting ORACLE instance%');

Oracle External table Check alter log

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.