Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Hot backups
Brian Lane wrote:
>
> Hi all,
> Does anyone have any Sun Unix scripts for doing Oracle hot backups.
> We have just found out that our current backup srategy is inconsistant and
> now the s... has hit the fan.
>
> Regards
> Brian
Brian:
Here is a SQL Command File to create a hot backup script. You might have to add a few "/" or semicolons, but it should create you a pretty good backup command file.
Note: This script only backups the tablespace datafiles. For a backup to be complete you will need to backup controlfiles, and of course archive log files. Note that in the cursor it assumes that the temporary tablespace is named 'temp'. This will of course have to be changed if your name for the temporary space is different.
Hope this helps!
John Hough
##################################################################set serveroutput on size 10000
select file_name,lower(tablespace_name) from sys.dba_data_files where instr(file_name,'temp') = 0 order by 2;
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 cp '||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||' endbackup')
dbms_output.put_line ('alter system checkpoint'); end if; end loop; dbms_output.put_line ('alter tablespace '||prev_ts_name||' endbackup')
dbms_output.put_line ('alter system checkpoint');
end;
end;
/
Received on Wed Apr 09 1997 - 00:00:00 CDT