Oracle XE Backup

After installing Oracle XE you should setup backups.

Backups for XE

For Oracle XE there is ready a backup script that uses Oracle’s RMAN.

 

Setup Archive Log Mode

After installing the database change it to archivelog mode:

[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Sun May 25 01:28:00 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  289406976 bytes
Fixed Size                  1258488 bytes
Variable Size              92277768 bytes
Database Buffers          192937984 bytes
Redo Buffers                2932736 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL>

To make sure the database is really in archive log mode run the following sql statement:

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
ARCHIVELOG

SQL>

Run the Initial Backup

Windows run $ORACLE_HOME/bin/Backup.bat

Linux run $ORACLE_HOME/config/scripts/backup.sh

[oracle@localhost ~]$ $ORACLE_HOME/config/scripts/backup.sh 
Doing online backup of the database.
Backup of the database succeeded.
Log file is at /usr/lib/oracle/xe/oxe_backup_current.log.
Press ENTER key to exit
[oracle@localhost ~]$

 

Run the Backups Daily

Windows add the $ORACLE_HOME/bin/Backup.bat to a job scheduler.

  • Make sure the user running the job is the same user who installed Oracle.

 

Linux add the $ORACLE_HOME/config/scripts/backup.sh to cron.daily

  • Remove the user notification line from the end of the script

 

Backing up files

Make sure that your backup script backups up the $ORACLE_HOME directory.  On windows make sure the oradata directory is excluded since this might cause file locking issues.

One thought on “Oracle XE Backup”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>