이 섹션의 스크립트를 사용하여 환경의 활동 보고서를 로컬 컴퓨터로 다운로드하는 프로세스를 자동화할 수 있습니다.
syncAprReports.bat
를 사용하여 활동 보고서를 다운로드합니다. Windows 스케줄러를 통해 뱃치 파일을 스케줄하여 활동 보고서 다운로드를 자동화할 수 있습니다. 활동 보고서에 대한 자세한 내용은 관리자용 Oracle Enterprise Performance Management Cloud 시작하기에서 활동 보고서 및 액세스 로그로 사용량 모니터를 참조하십시오.
다음 절차에 제공된 스크립트를 복사한 다음 연결 매개변수를 업데이트하여 수동으로 syncAprReports.bat
를 생성합니다. 이 스크립트는 환경을 확인하고 로컬 컴퓨터의 다운로드 디렉토리에서 사용할 수 있는 보고서보다 최신 버전인 보고서만 다운로드합니다.
주:
syncAprReports.bat
라는 뱃치(.BAT
) 파일을 생성한 후 C:\automate_scripts
등의 편리한 위치에 저장합니다.
@echo off title APR setlocal DisableDelayedExpansion REM To hardcode the values in the script replace %1, %2, %3, and %4, with the actual values. REM Example: REM set apr_dir="C:\Oracle\apr" REM set username="serviceAdmin" REM set password="Ex@mple!" REM set url="https://test-example.stg-pbcs.us1.oraclecloud.com" set apr_dir=%1 set username=%2 set password=%3 set url=%4 setlocal EnableDelayedExpansion set epmautomate_dir=%cd% set lastfile= set argC=0 for %%x in (%*) do Set /A argC+=1 if %argC% neq 0 ( if %argC% neq 3 ( if %argC% neq 4 ( goto :usage ) ) ) goto :login :usage echo. echo Invalid syntax. Please check the parameters. echo Syntax: echo 1) syncAprReports.bat APR_FolderPath_on_client username password url echo or echo 2) set the parameters in the file and use below syntax echo syncAprReports.bat goto :end :login setlocal DisableDelayedExpansion for /f "delims=" %%i in ('epmautomate login %username% %password% %url%') do set result=%%i if "Login successful" neq "%result%" ( echo Login Failed goto :end ) if not exist %apr_dir% ( echo. echo apr folder does not exist GOTO :end ) cd /D %apr_dir% for /f "delims=" %%D in ('dir /a:d /b /o:-n') do ( REM AFTER: for /f "delims=" %%D in ('dir /a-d /b /s /o:-n') do ( set "lastFile=%%~nD" goto :next ) :next setlocal EnableDelayedExpansion echo. echo Most Recent APR on client is %lastFile% set "output_cnt=0" cd /D %epmautomate_dir% for /F "delims=" %%f in ('epmautomate listfiles') do ( cd /D !apr_dir! set "line=%%f" for /f "tokens=* delims= " %%a in ("!line!") do set line=%%a if "!line:~0,3!" equ "apr" ( if "!line:~4,8!" neq "Feedback" ( set isValidFile=false if "!line:~-5!" equ ".html" set isValidFile=true if "!line:~-5!" equ ".json" set isValidFile=true if "!isValidFile!" equ "true" ( if "%lastFile%" lss "!line:~4,19!" ( if "!line:~4,19!" neq "!dirname!" ( set apr_dir=!apr_dir:"=! set /a output_cnt+=1 set "output[!output_cnt!]=!apr_dir!\!line:~4,19!" set "dirname=!line:~4,19!" REM start downloading mkdir "!dirname!" cd /D !dirname! echo downloading !line! set "downloadDir=!apr_dir!\!dirname!" cd /D %epmautomate_dir% for /f "delims=" %%i in ('epmautomate downloadfile "!line!"') do set result1=%%i move "!line:~24!" "!downloadDir!" > nul echo !result1! REM end downloading ) else ( REM start downloading cd /D !dirname! echo downloading !line! set apr_dir=!apr_dir:"=! set "downloadDir=!apr_dir!\!dirname!" cd /D %epmautomate_dir% for /f "delims=" %%i in ('epmautomate downloadfile "!line!"') do set result1=%%i move "!line:~24!" "!downloadDir!" > nul echo !result1! REM end downloading ) ) else ( REM TO-DO ) ) ) ) ) echo. echo %output_cnt% APR's downloaded for /L %%n in (1 1 !output_cnt!) DO echo !output[%%n]! goto :end :end cd /D %epmautomate_dir% endlocal
syncAprReports.bat
를 수정하여 다음 표의 매개변수 값을 설정합니다. 이러한 값은 환경에 액세스하여 활동 보고서를 다운로드하는 데 사용됩니다.
표 3-3 syncAprReports.bat
에 포함할 매개변수 값
매개변수 | 예상 값 |
---|---|
set apr_dir=%1 |
활동 보고서를 다운로드할 기존 디렉토리를 지정합니다.
예: |
set username=%2 |
환경에 사인인하여 활동 보고서를 다운로드하는 데 사용되는 Oracle Enterprise Performance Management Cloud 사용자 이름입니다.
예: |
set password=%3 |
예:
|
set url=%4 |
환경의 URL입니다.
예: |
syncAprReports.bat
를 스케줄합니다. 자세한 단계는 스크립트 실행 자동화를 참조하십시오.