Starting Oracle Enterprise Manager

For the oracle database Enterprise Manager (EM) runs on port 1158. But it needs to be started by itself.


Login as oracle and run:

$ORACLE_HOME/bin/emctl start dbconsole

On some systems a xserver session needs to be running for the graphs to be created correctly.  The best solution for this is to run vncserver on port 5910 and set the display to use :10.


vncserver :10

set DISPLAY=localhost:10

Then start EM.

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 - Production on Sun May 25 01:28:00 2008

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

SQL> connect / as sysdba
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.


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




Run the Initial Backup

Windows run $ORACLE_HOME/bin/Backup.bat

Linux run $ORACLE_HOME/config/scripts/

[oracle@localhost ~]$ $ORACLE_HOME/config/scripts/ 
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/ 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.

Checking for a User in OID

Test to see if a user is already in OID

The following java code checks to see if there is a user in OID, returning true if they are there.


import oracle.ldap.util.*;

import oracle.ldap.util.jndi.*;
import java.util.*;
import javax.naming.*;



public class Application1 {

InitialDirContext ctx;
public Application1() throws NamingException {
// Create InitialDirContext

try {

ctx  = ConnectionUtil.getDefaultDirCtx(“linux02”, “389”, “cn=orcladmin”, “orcladmin1”);

} catch (NamingException e) {

throw e;


public static void main(String[] args) throws NamingException {

Application1 appl1 = new Application1();

if (appl1.exec(“cn=mark.allen,cn=Users,dc=markcallen,dc=com”))

System.out.println(“Found mark.allen”);

if (! appl1.exec(“cn=unknown,cn=Users,dc=markcallen,dc=com”))

System.out.println(“Could not find unknown”);
public boolean exec(String userId) {

try {

Util.getUserDn(ctx, userId, Util.IDTYPE_DN, null);
} catch (oracle.ldap.util.NoSuchUserException e) {

return false;


catch (UtilException e) {

throw e;


return true;