Restoring a database is fairly easy if you have a backup file that was made with the procedure outlined on the how_to_backup_an_oracle_xe_database page.
I'm assuming you have already transferred the backup file to the server where the restoration will happen, and the file is named
ora_backup.tar.gz. The first step is to extract the archive and copy the files to the Oracle home folder:
[me@myhost ~]# /etc/init.d/oracle-xe stop [me@myhost ~]# mkdir ora_backup [me@myhost ~]# cp ora_backup.tar.gz ora_backup/ [me@myhost ~]# cd ora_backup/ [me@myhost ~]# tar xzf ora_backup.tar.gz [me@myhost ora_backup]# cd usr/lib/oracle/xe/ [me@myhost xe]# cp -rf * /usr/lib/oracle/xe/
The copy process will take several minutes, depending on the environment. When finished, all the database files, the flash recovery area files, and the Oracle SP files will have been overwritten with the files from the backup.
At this point, you might think you could simply start the database. Unfortunately this isn't the case. Oracle stores some of the system configuration data inside the database itself. So you have to re-run the XE configuration script again to get the new configuration data into the database files.
Take a look at the
/etc/sysconfig/oracle-xe file. It contains the answers that were given during the original run of the configuration script. You'll need to answer the questions the same way during the next run or your database might not operate the same as before.
[me@myhost ~]# /etc/init.d/oracle-xe stop [me@myhost ~]# cd /etc/sysconfig [me@myhost sysconfig]# mv oracle-xe oracle-xe.original [me@myhost sysconfig]# /etc/init.d/oracle-xe configure Oracle Database 10g Express Edition Configuration ------------------------------------------------- This will configure on-boot properties of Oracle Database 10g Express Edition. The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts. Press <Enter> to accept the defaults. Ctrl-C will abort. Specify the HTTP port that will be used for Oracle Application Express :8888 Specify a port that will be used for the database listener : Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. Oracle recommends the use of different passwords for each database account. This can be done after initial configuration: Confirm the password: Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:y Starting Oracle Net Listener...Done Configuring Database...Done Starting Oracle Database 10g Express Edition Instance...Done Installation Completed Successfully. To access the Database Home Page go to "http://127.0.0.1:8888/apex"
Note the database has been started as part of the configuration script, and it offers a local URL for the database console. You should login and check your system to ensure all data is present.