OracleDB‎ > ‎

Manual Backup

shutdown the database in a consistent state: (normal, immediate, or transactional shutdown) Backup datafiles: get a list of all datafiles

SQL> SELECT file_name FROM dba_data_files;

Backing up the online redo log files: get a list of online redo files

SQL> SELECT member FROM v$logfile;

Backing up the control files: get a list of the control files

SQL> SELECT name FROM v$controlfile;

Backup Script

#!/bin/ksh
ORACLE_SID=$1
export ORACLE_SID
export ORAENV_ASK=NO
BACKUP_DIR=/test01/app/oracle
. oraenv
sqlplus -s system/remorse1 << EOF
SET HEAD OFF FEED OFF ECHO OFF TRIMSPOOL ON LINESIZE 200
SPOOL /u01/app/oracle/dba/cold_backup.ksh
SELECT 'cp ' ||file_name|| ' ${BACKUP_DIR}' from sys.dba_data_files;
SELECT 'cp ' ||name || ' ${BACKUP_DIR}' from V$controlfile;
SELECT 'cp ' ||member|| ' ${BACKUP_DIR}' from V$logfile;
SPOOL OFF;
EXIT;
EOF

Comments