Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sample cold backup script
"eg" <eg.kua_at_felda.net.my> a écrit dans le message news:
b05eb676.0311270016.696cc2c1_at_posting.google.com...
> I am new to oracle backup. Can someone show me how to write unix shell
> script to do a cold backup?
>
> I would like to do the following:
>
> 1. Prompt the user to select an option.
> 2. Say option 2 is to do cold backup.
> 3. Connect to db to get datafiles, control files, redolog files'
> names.
> 4. Shutdown db.
> 5. Send the files' name to a file.
> 6. Perform tar -cvf of the files' name.
> 7. Startup db.
> 8. Show option again.
>
> Thanks,
> eg
Assuming Korn Shell 93
1. & 2.
<
print "select an option :\n\t1: whatever you want\n\t2: cold backup"
read option
case $option in
1)
<stuff>
;;
2)
<stuff>
;;
*)
<stuff>
;;
esac
>
3. assuming 8.1.7.
select f.type,f.name,f.status,f.bytes
from (
select name, 'D' type,status , bytes from v$datafile
union all
select name, 'T' type ,status, bytes from v$tempfile
union all
select name, 'C' type ,status, S.bytes
from v$controlfile,
(select sum(RECORDS_TOTAL*RECORD_SIZE) bytes from
v$controlfile_record_section) S
union all
select v2.member name , 'R' type, v1.status , bytes
from v$log v1 ,v$logfile v2
where v1.group#=v2.group#
) F order by f.type;
I suggest that you swap step 4 et 5
5. spool results of query above (only the field f.name)
4. spool off and shutdown
hth
Alkos
Received on Thu Nov 27 2003 - 02:54:46 CST