Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Archive Log Backup in DCL

Re: Archive Log Backup in DCL

From: John Hough <q6y_at_ornl.gov>
Date: 1997/01/31
Message-ID: <32F22A63.7D2@ornl.gov>#1/1

Michael:

Here is a SQL Command File to create a hot backup script. It will have to be edited to use an vms filesystem instead of unix file systems. You will also need to add the code to get the control files and the log files. You might have to add a few "/" or semicolons, but this should get you a pretty good start.

Hope this helps:

John Hough

##################################################################
set serveroutput on size 10000
set echo off feed off pages 0
spool hot.backup
select 'File created '||to_char(sysdate,'dd-Mon-yy hh24:mm:ss')   from dual;
prompt
begin
  declare
    target_dir varchar2(100) := 'ORA_BACKUP_DIR:';     source_file varchar2(100);
    ts_name varchar2(100);
    prev_ts_name varchar2(100);
    cursor mycur is
      select file_name,lower(tablespace_name)
        from sys.dba_data_files
       where instr(file_name,'temp') = 0
       order by 2;

  begin
    prev_ts_name := 'X';
    open mycur;
    fetch mycur into source_file,ts_name;     while mycur%found loop
      if ts_name <> prev_ts_name then
         dbms_output.put_line ('#######################');
         dbms_output.put_line ('# Tablespace '||ts_name||'. . .');
         dbms_output.put_line ('#######################');
         dbms_output.put_line ('alter tablespace '||ts_name||' begin
backup');
      end if;
      dbms_output.put_line ('host copy '||source_file||' '||target_dir);
      prev_ts_name := ts_name;
      fetch mycur into source_file,ts_name;
      if ts_name <> prev_ts_name then
         dbms_output.put_line ('alter tablespace '||prev_ts_name||' end
backup')
;
         dbms_output.put_line ('alter system checkpoint');
      end if;
    end loop;
         dbms_output.put_line ('alter tablespace '||prev_ts_name||' end
backup')
;

         dbms_output.put_line ('alter system checkpoint');   end;
end;
/ Received on Fri Jan 31 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US