Draft:Oracle tablespace report aman

@echo off

REM Initialize Excel spreadsheet echo Generating Excel spreadsheet... echo Database Name, Application Name, Disk Group Name, Total Disk Group (GB), Used Disk Group (GB), Free Disk Group (GB), Used Disk Group (%), Free Disk Group (%), Tablespace Name, Allocated Size (GB), Used (GB), Free (GB), Used (%), Free (%) > tablespaces_report.csv

REM Loop over each line in db_details.txt for /f "tokens=1-4 delims=," %%A in (db_details.txt) do (   set "APP_NAME=%%A"    set "DB_NAME=%%B"    set "USERNAME=%%C"    set "PASSWORD=%%D"

echo Connecting to %%B... sqlplus %USERNAME%/%PASSWORD%@%%B @tablespace_report.sql | findstr /v "rows selected" | findstr /v "^$" | findstr /v "connected" | findstr /v "disconnected" | findstr /v "SQL>" | findstr /v "SQL*Plus" | findstr /v "echo on" | findstr /v "SET" | findstr /v "COLUMN" | findstr /v "^$" | findstr /v "-" | findstr /v "Elapsed: 00:00:00" | findstr /v "end of" | findstr /v "PL/SQL" | findstr /v "Result" | findstr /v "Oracle" | findstr /v "automatic" | findstr /v "specify" | findstr /v "error" | findstr /v "SP2-" | findstr /v "memory" | findstr /v "Using" | findstr /v "Session" | findstr /v "TIMESTAMP" | findstr /v "Usage" | findstr /v "session" | findstr /v "Idle" | findstr /v "-" | findstr /v "SQL>" >> tablespaces_report.csv echo %%B report generated. )

echo All reports generated.

REM Open the Excel spreadsheet start excel tablespaces_report.csv