Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to reviewing tail 20 lines for log.xml file by my SHELL script?

Quanwen ZhaoMay 13 2019 — edited May 14 2019

Hi guys and friends ,

These two days I give my client to write a series of SQL statement of Oracle Database Routine Inspection Script. On reviewing tail 20 lines for log.xml aspect I encounter some issue. BTW my SHELL script (by calling SQL and PL/SQL) is as follows,

[oracle@xxxx ~]$ vi orc.sh

sqlplus -S / as sysdba <<EOF

set serveroutput on

set feedback off

declare

  db_name varchar2(30);

  ins_name varchar2(30);

begin

  select value into db_name from v\$parameter where name = 'db_name';

  select wm_concat(instance_name) into ins_name from v\$instance;

  dbms_output.put_line(chr(10)||db_name);

  dbms_output.put_line(ins_name||chr(10));

end;

/

ho tail -20 $ORACLE_BASE/diag/rdbms/$db_name/$ins_name/alert/log.xml

EOF

You can take a look at the following running result,

[oracle@xxxx ~]$ ./orc.sh

test

test

tail: cannot open `/u01/app/oracle/diag/rdbms///alert/log.xml' for reading: No such file or directory

Could you help me troubleshooting it? Very appreciate you if any help.

Best Regards

Quanwen Zhao

This post has been answered by Gaz in Oz on May 13 2019
Jump to Answer
Comments
Post Details
Added on May 13 2019
8 comments
828 views