Knowledgebase
Oracle 8i tablespace backup
ORACLE_HOME=/u01/app/oracle/OraHome1
ORACLE_SID=norvel
#path to directory where backup files are going to be copied to
BACKUP_HOME=/u04/oracle_backup/norvel
# path to directory with data files
TABLESPACE_PATH=/u02/oradata/norvel
#path to archive redo logs directory
ARCHIVE_PATH=/u03/oracle/norvel/arch
export ORACLE_HOME
export ORACLE_SID
#copy initialization file
cp $ORACLE_HOME/dbs/initnorvel.ora $BACKUP_HOME
# copy tnsnames.ora and listener.ora
cp $ORACLE_HOME/network/admin/listener.ora $BACKUP_HOME
cp $ORACLE_HOME/network/admin/tnsnames.ora $BACKUP_HOME
# take tablespaces into backup mode
$ORACLE_HOME/bin/sqlplus /nolog > /dev/null << END
connect internal
alter tablespace indx begin backup;
alter tablespace rbs begin backup;
alter tablespace temp begin backup;
alter tablespace tools begin backup;
alter tablespace users begin backup;
alter tablespace system begin backup;
alter database backup controlfile to '$BACKUP_HOME/controlfile.clt' REUSE;
END
#copy tablespace files
cp $TABLESPACE_PATH/*.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/indx01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/rbs01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/system01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/temp01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/tools01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/users01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/cmp01.dbf $BACKUP_HOME
# take tablespaces back online
$ORACLE_HOME/bin/sqlplus /nolog > /dev/null << END
connect internal
alter tablespace system end backup;
alter tablespace tools end backup;
alter tablespace users end backup;
alter tablespace temp end backup;
alter tablespace indx end backup;
alter tablespace rbs end backup;
END
# copy archived redo logs
cp $ARCHIVE_PATH/*.arc $BACKUP_HOME/arch
ORACLE_SID=norvel
#path to directory where backup files are going to be copied to
BACKUP_HOME=/u04/oracle_backup/norvel
# path to directory with data files
TABLESPACE_PATH=/u02/oradata/norvel
#path to archive redo logs directory
ARCHIVE_PATH=/u03/oracle/norvel/arch
export ORACLE_HOME
export ORACLE_SID
#copy initialization file
cp $ORACLE_HOME/dbs/initnorvel.ora $BACKUP_HOME
# copy tnsnames.ora and listener.ora
cp $ORACLE_HOME/network/admin/listener.ora $BACKUP_HOME
cp $ORACLE_HOME/network/admin/tnsnames.ora $BACKUP_HOME
# take tablespaces into backup mode
$ORACLE_HOME/bin/sqlplus /nolog > /dev/null << END
connect internal
alter tablespace indx begin backup;
alter tablespace rbs begin backup;
alter tablespace temp begin backup;
alter tablespace tools begin backup;
alter tablespace users begin backup;
alter tablespace system begin backup;
alter database backup controlfile to '$BACKUP_HOME/controlfile.clt' REUSE;
END
#copy tablespace files
cp $TABLESPACE_PATH/*.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/indx01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/rbs01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/system01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/temp01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/tools01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/users01.dbf $BACKUP_HOME
#cp $TABLESPACE_PATH/cmp01.dbf $BACKUP_HOME
# take tablespaces back online
$ORACLE_HOME/bin/sqlplus /nolog > /dev/null << END
connect internal
alter tablespace system end backup;
alter tablespace tools end backup;
alter tablespace users end backup;
alter tablespace temp end backup;
alter tablespace indx end backup;
alter tablespace rbs end backup;
END
# copy archived redo logs
cp $ARCHIVE_PATH/*.arc $BACKUP_HOME/arch
Post Date: 2015-02-22 17:58:13 · Tags: Knowledgebase,