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