3 Replies Latest reply: Apr 17, 2012 5:51 PM by 282353 RSS

    DOS scripting

    user522961
      Hi,
      sorry for disturbing you. I did not find proper Forum for my question.

      I'm scripting in DOS . I want to generate three backup RMAN scripts for 3 DB. Then I use FOR :
      FOR %%D in (DB1 DB2 DB3) DO SET  ORACLE_SID=%%D
      echo ORACLE_SID=%ORACLE_SID%
      CALL generate__sql %ORACLE_SID%
      In generate__sql.bat I have :
      echo %1
      echo     run  >> al_%1.sql
      echo     {  >> al_%1.sql
      echo          allocate channel t1 type disk; >>  al_%1.sql
      echo          backup as compressed backupset format 'M:\backup\%1%\full/df_%%d_%%T_%%s_%%p' database;  >>   al_%1.sql
      echo          sql 'alter system switch logfile';  >>   al_%1.sql
      echo          backup as compressed backupset format 'M:\backup\%1%\full/al_%%d_%%T_%%s_%%p' archivelog all delete input;  >>   al_%1.sql
      echo          backup as compressed backupset format 'M:\backup\%1%\full/ctl_%%d_%%T_%%s_%%p' current controlfile;  >>   al_%1.sql
      echo     }  >> al_%1.sql
      echo     crosscheck backup;            >>  al_%1.sql
      echo     delete obsolete;            >>  al_%1.sql
      echo     delete expired backup of database;  >>  al_%1.sql
      ..................................................
      ......................................................
      But it generate only one file (al_DB1.sql) in which I have only :
      run  
      {  
           allocate channel t1 type disk; 
           sql 'alter system switch logfile';  
      }  
      crosscheck backup;            
      delete obsolete;            
      delete expired backup of database;  
      Thank for help