SET LINESIZE 150
SET TERMOUT ON
SET ECHO OFF
SET VERIFY OFF


SPOOL rm_check_fra.log

ACCEPT Server PROMPT 'Enter DATABASE name (default - MAGICASH): ' DEFAULT MAGICASH
ACCEPT SYSpsw PROMPT 'Enter SYS password: ' DEFAULT NCTSYS HIDE

CONNECT SYS/&SYSpsw@&Server AS SYSDBA

column name format A70	HEADING "Путь к FRA"
column SPACE_MAX format A20	HEADING "Лимит размера"
column SPACE_USED format A20	HEADING "Сейчас использовано"
column Free_space format A20	HEADING "Свободно в %"
column NUMBER_OF_FILES format 999,999	HEADING "Кол-во файлов"
select 			name, 
				round(SPACE_LIMIT/1024/1024/1024,1)  || ' Gb'  "SPACE_MAX", 
				round(SPACE_USED/1024/1024/1024,1)|| ' Gb' "SPACE_USED", 
				round((SPACE_LIMIT-SPACE_USED)/SPACE_LIMIT*100,1)||'%' "Free_space", 
				NUMBER_OF_FILES   
from V$RECOVERY_FILE_DEST
ORDER BY 1;	

SPOOL OFF

SET FEEDBACK ON
SET TERMOUT ON
SET ECHO ON
EXIT
