--Create a view that spools an alpha script to do a cold backup of the Oracle Database.

-- ARTICLES ¤ WHITE PAPERS ¤ HOME PAGE

CREATE OR REPLACE FORCE VIEW SYSTEM.CREATE_BACKUP_SCRIPT
(TEXT)
AS 
SELECT  /* 2004 by Edward Stoever,  */
          '$copy ' || RPAD (NAME, 55) || ' disk1:[backup]'
     FROM v$datafile
   UNION ALL
   SELECT '$copy ' || RPAD (NAME, 55) || ' disk1:[backup]'
     FROM v$controlfile
   UNION ALL
   SELECT '$copy ' || RPAD (MEMBER, 55) || ' disk1:[backup]'
     FROM v$logfile
   UNION ALL
   SELECT '$copy ' || RPAD (NAME, 55) || ' disk1:[backup]'
     FROM v$tempfile
   UNION ALL
   SELECT    RPAD ('$copy DISK3:[ORACLE.V92.dbs]INITPROD.ORA', 55)
          || ' disk1:[backup]'
     FROM DUAL
   UNION ALL
   SELECT    RPAD ('$copy DISK3:[ORACLE.V92.dbs]orapwprod.', 55)
          || ' disk1:[backup]'
     FROM DUAL
   UNION ALL
   SELECT    RPAD ('$copy DISK3:[ORACLE.V92.dbs]SPFILEPROD.ORA', 55)
          || ' disk1:[backup]'
     FROM DUAL
   UNION ALL
   SELECT '$mail nl: smtp%""/subject="BACKUP COMPLETED"'
     FROM DUAL;