Batch Script for select backup report from SAP with Oracle (DB12) on sdbah table

** Myself
set ORACLE_SID=PRD
set CONNECT_BAT=D:\script\connect.bat
set EXECUTE_BAT=D:\script\command.bat
set EXECUTE_TEMP=D:\script\command.txt
set SPOOL_LOG=D:\script\BACKUP_PRD.txt
echo ------------------------------------------------  >> ^%SPOOL_LOG%
date /T  >  ^%SPOOL_LOG%
echo ------------------------------------------------  >> ^%SPOOL_LOG%
echo sqlplus /nolog > ^%CONNECT_BAT%
echo connect /@PRD as sysdba > ^%EXECUTE_BAT%
echo set linesize 120 >> ^%EXECUTE_BAT%
echo select 'PRD_Backup_to_Disk,' ^|^| to_char(to_date(BEG,'YYYYMMDDHH24MISS'),'DD-MON-YYYY HH:MI:SS') ^|^| ',' ^|^| to_char(to_date(ENDE,'YYYYMMDDHH24MISS'),'DD-MON-YYYY
HH:MI:SS') ^|^| ',' ^|^| RC "SID,Backup_Type,Begin,End,RC " from sapr3.sdbah "Backup_Logs" where BEG ^>  to_char(sysdate-6,'YYYYMMDD') and FUNCT = 'afd' order by  BEG desc; >>
^%EXECUTE_BAT%
call ^%CONNECT_BAT% < ^%EXECUTE_BAT%  >> ^%SPOOL_LOG%
echo ------------------------------------------------  >> ^%SPOOL_LOG%
del ^%CONNECT_BAT%
del ^%EXECUTE_BAT%
del ^%EXECUTE_TEMP%

0 comments:

Loading