SET HEA OFF
SET PAGESIZE 250
SPOOL C:\temp_script\tablespace_benginBackup.sql
SELECT 'ALTER TABLESPACE ' || TABLESPACE_NAME || ' BEGIN BACKUP;'
FROM DBA_TABLESPACES
WHERE CONTENTS IN ('PERMANENT','UNDO')
AND STATUS <> 'READ ONLY'
/
SPOOL OFF
@C:\temp_script\tablespace_benginBackup.sql