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

Home -> Community -> Usenet -> c.d.o.server -> Re: Sample cold backup script

Re: Sample cold backup script

From: Alkos <azerty_at_nospam.org>
Date: Thu, 27 Nov 2003 09:54:46 +0100
Message-ID: <bq4e4n$i9v1@news.rd.francetelecom.fr>

"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

Original text of this message

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