ITandME blog


Notes on making an Oracle database backup

		
		# oracle Database backup (manual)
		# Version 11.2.x.x
		# Backing up database to local directory.
		# Date: 08/26/16
		#
		# First, make a directory target for backups, control, and redolog.
		root # mkdir /target/backup/folder
		root # mkdir /target/backup/folder/control
		root # mkdir /target/backup/folder/data
		root # mkdir /target/backup/folder/redolog
		#
		# make sure the oracle ID (oracle default) owns the backup.
		root # chown -R oracle /target/backup/folder/
		#
		# drop into oracle id
		su oracle
		oracle # cd /path/to/oracle/product/11.2.0/bin
		#
		# create sql management session
		oracle # ./sqlplus /nolog
		#
		# connect to database
		SQL> conn /as sysdba
		Connected.
		SQL >_
		#
		# map target file to SQL for backup
		SQL > create pfile='/u01/odysseyBUR'
		#
		# generates listings of important files the need to be copied
		SQL > pfile='/u03/odysseyBUR/odysseyprod_20160826.ora' from spfile;
		SQL > alter database backup controlfile to trace as '/u03/odysseyBUR/odysseyprod_controlfile.sql' resetlogs;
		#
		# once you know what you're copying, stop database
		SQL > shutdown immediate;
		#
		# files to copy, login to another terminal and su oracle
		#
		oracle # cp /u02/oradata/dbf/system01.dbf /u01/odysseyBUR/data
		oracle # cp /u02/oradata/dbf/sysaux01.dbf /u01/odysseyBUR/data
		oracle # cp /u02/oradata/dbf/undotbs01.dbf /u01/odysseyBUR/data
		oracle # cp /u02/oradata/dbf/users01.dbf /u01/odysseyBUR/data
		oracle # cp /u02/oradata/dbf/odyssey.dbf /u01/odysseyBUR/data
		oracle # cp /u02/oradata/dbf/odysseyindex.dbf /u01/odysseyBUR/data
		#
		oracle # cp /u02/oradata/redo/redo01b.log /u01/odysseyBUR/redolog
		oracle # cp /u01/oradata/redo/redo01a.log /u01/odysseyBUR/redolog
		oracle # cp /u03/oradata/redo/redo01c.log /u01/odysseyBUR/redolog
		oracle # cp /u01/oradata/redo/redo02a.log /u01/odysseyBUR/redolog
		oracle # cp /u02/oradata/redo/redo02b.log /u01/odysseyBUR/redolog
		oracle # cp /u03/oradata/redo/redo02c.log /u01/odysseyBUR/redolog
		oracle # cp /u02/oradata/redo/redo03b.log /u01/odysseyBUR/redolog
		oracle # cp /u01/oradata/redo/redo03a.log /u01/odysseyBUR/redolog
		oracle # cp /u03/oradata/redo/redo03c.log /u01/odysseyBUR/redolog
		#
		oracle # cp /u01/oradata/ctl/control01.ctl /u01/odysseyBUR/control
		oracle # cp /u02/oradata/ctl/control02.ctl /u01/odysseyBUR/control
		oracle # cp /u03/oradata/ctl/control03.ctl /u01/odysseyBUR/control
		#
		# once files are copied, go back to SQL terminial and start the database
		SQL > startup;
		#
		# check listener
		oracle # lsnrctl status
		#
		# check database service
		oracle # ps -ef | grep pmon
		

HOME