Petit script de backup à chaud ecrite par votre humble serviteur sous un environnement linux
sqlplus / as sysdba << EOF
set pagesize 0
set linesize 500
set feedback off
set heading off
set trimspool off
set verify off
set echo off
define dir_backup = ‘/oracle/dir_backup’
define script = ‘/oracle/scripts/backup_bdd_achaud.sh’
ALTER DATABASE BEGIN BACKUP;
spool &script;
select ‘host cp ‘|| name|| ‘ &dir_backup’ from v\$datafile order by 1 ;
select ‘host cp ‘|| member || ‘ &dir_backup’ from v\$logfile order by 1 ;
select ‘host cp ‘|| name || ‘ &dir_backup’ from v\$controlfile order by 1 ;
select ‘host cp ‘|| name || ‘ &dir_backup’ from v\$tempfile order by 1;
spool off;
alter database backup controlfile to trace as ‘/oracle/dir_backup/bkp_controlfil.sql’ REUSE;
@&script;
ALTER DATABASE END BACKUP;
exit;
EOF
if [[ $? -eq 0 ]]
then echo « Sauvegarde a chaud instance ${ORACLE_SID} : OK »
else « Sauvegarde a chaud ${ORACLE_SID} : KO »
fi