Hot Backup Urgent help please [message #56323] |
Wed, 19 March 2003 08:33 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
kjoracle@yahoo.com
Messages: 1 Registered: March 2003
|
Junior Member |
|
|
I have a following scipt for the hotbackup
set serveroutput on
set trimspool on
set line 500
set head off
set feed off
spool backup.cmd
declare
copy_cmnd constant varchar2(30) := 'ocopy'; -- Use "ocopy" for NT
copy_dest constant varchar2(30) := 'c:backup'; -- C:BACKUP for NT
dbname varchar2(30);
logmode varchar2(30);
begin
select name, log_mode
into dbname, logmode
from sys.v_$database;
if logmode <> 'ARCHIVELOG' then
raise_application_error(-20000,
'ERROR: Database must be in ARCHIVELOG mode!!!');
return;
end if;
dbms_output.put_line('spool backup.'||dbname||'.'||
to_char(sysdate, 'ddMonyy')||'.log');
-- Loop through tablespaces
for c1 in (select tablespace_name ts
from sys.dba_tablespaces)
loop
dbms_output.put_line('alter tablespace '||c1.ts||' begin backup;');
-- 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('HOST '||copy_cmnd||' '||c2.fil||' '||copy_dest);
end loop;
dbms_output.put_line('alter tablespace '||c1.ts||' end backup;');
end loop;
-- Backup controlfile and switch logfiles
dbms_output.put_line('alter database backup controlfile to trace;');
dbms_output.put_line('alter database backup controlfile to '||''''||
copy_dest||'control.'||dbname||'.'||
to_char(sysdate,'DDMonYYHH24MI')||''''||';');
dbms_output.put_line('alter system switch logfile;');
dbms_output.put_line('spool off');
end;
/
spool off
set head on
set feed on
set serveroutput off
@backup.cmd
exit
When I execute it everything goes fine until the last command 'Alter system switch
logfile' It simply hangs when this command is being executed. Is it
necessary to execute this command to take a successful backup.
Our server has around 14 GB of archive logs and no backup has been
taken yet. Can I delete the files upto a particular time? Will it
create any problems? If yes how do I create space on the system as only 1 GB is left.
Thanks in advance.
kj
|
|
|
|