if you want to run it at database level you can set this procedure as a job; this has some benefits as logging messages at a log table, to easily query it
Main Topics
Browse All Topicshi
i have written a hotbackup script as ....
set serveroutput on
set line 500
set head off
set feed off
declare
copy_cmnd constant varchar2(30) := 'cp';
copy_dest constant varchar2(30) := '/backup/';
dbname varchar2(30);
logmode varchar2(30);
begin
select name, log_mode
into dbname, logmode
from v$database;
if logmode <> 'ARCHIVELOG' then
raise_application_error(-2
'ERROR: Database must be in ARCHIVELOG mode!!!');
return;
end if;
-- Loop through tablespaces
for c1 in (select tablespace_name ts
from sys.dba_tablespaces)
loop
dbms_output.put_line('alte
-- Loop through tablespaces' data files
for c2 in (select file_name fil
from sys.dba_data_files
where tablespace_name = c1.ts)
loop
dbms_output.put_line('!'||
end loop;
dbms_output.put_line('alte
end loop;
-- Backup controlfile and switch logfiles
dbms_output.put_line('alte
dbms_output.put_line('alte
copy_dest||'control.'||dbn
to_char(sysdate,'DDMonYYHH
dbms_output.put_line('alte
end;
/
set head on
set feed on
set serveroutput off
--------------------------
This file is saved as hotbackup.sql
now my question is how should i execute this sql file on a shell command
i am using oracle 9i [Release 2] on redhat linux 9.0
also
if i want to set a cron job for it
how should i go for it ?....
thanks
tushar
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: johnsonePosted on 2004-06-07 at 11:51:45ID: 11252241
The basic idea is this:
#!/bin/sh
# set up enviornment, this is necessary to run through cron
ORACLE_SID=
ORACLE_HOME=
...
# run backup
sqlplus -s <<EOF
/ as sysdba
spool hotbackup_tmp
@hotbackup.sql
spool off
@hotbackup_tmp
exit
EOF