Sunday 17 March 2013

How to take cold backup of oracle database


Login to linux shell prompt with root user and create directory /oracle_backup/coldbackup for the backup.

mkdir oracle_backup

mkdir /oracle_backup/coldbackup

To change owner to oracle admin user and group to oinstall.

chown -R oracle.oinstall /oracle_backup

To set oracle SID whose backup will be created if there is only one database may not need to execute it.

export ORACLE_SID=ardb

Login to database with sys user


sqlplus sys/oracle as sysdba

At sql prompt execute following script to get path of control ,data and redolog file path.

select 'cp ' ||name|| ' /oracle_backup/coldbackup' from v$datafile
UNION ALL
select 'cp ' ||name|| ' /oracle_backup/coldbackup' from v$controlfile
UNION ALL
select 'cp ' ||name|| ' /oracle_backup/coldbackup' from v$tempfile
UNION ALL
select 'cp ' ||member|| ' /oracle_backup/coldbackup' from v$logfile
order by 1;


shutdown database to take cold backup..

shutdown immediate;

exit;


------------------------
you will get output like below copy this output and paste on shell prompt with oracle user this will copy all oracle files to coldbackup folder.

cp /oracle/oradata/ardb/system01.dbf /oracle_backup/coldbackup
cp /oracle/oradata/ardb/sysaux01.dbf /oracle_backup/coldbackup
cp /oracle/oradata/ardb/undotbs01.dbf /oracle_backup/coldbackup
cp /oracle/oradata/ardb/users01.dbf /oracle_backup/coldbackup
cp /oracle/oradata/ardb/example01.dbf /oracle_backup/coldbackup
cp /oracle/oradata/ardb/control01.ctl /oracle_backup/coldbackup
cp /oracle/flash_recovery_area/ardb/control02.ctl /oracle_backup/coldbackup
cp /oracle/oradata/ardb/temp01.dbf /oracle_backup/coldbackup
cp /oracle/oradata/ardb/redo03.log /oracle_backup/coldbackup
cp /oracle/oradata/ardb/redo02.log /oracle_backup/coldbackup
cp /oracle/oradata/ardb/redo01.log /oracle_backup/coldbackup


Now login again to oracle with sys user.

sqlplus sys/oracle as sysdba

To start the database;

startup;

exit;

your database cold backup is complete.

No comments:

Post a Comment