By William Sescu

Backing up an OUD consists of several components

  • The OUD software itself
  • The OUD back end data
  • The OUD configuration
  • The OUD logical export as a ldif file

However, in this post I would like to take a closer look at the back end data. Unlike the old OID, the OUD directory server uses the Berkeley DB Java Edition (JE) as its primary back end. The OUD backup command allows you to backup all back ends in one shot, or a single back end, you can do full or incremental backups, you can compress it and you can even encrypt your back end data, if you like too.

One of the first questions that comes up is where to put the backup files. In a replicated environment, it makes a lot of sense to put them on a NFS share. In case you should lose one OUD host, you still have the access to backups on the other host.

I choose to backup the back end data to /u99/backup/OUD, which is a directory on a NFSv4 mount.

[dbafmw@dbidg01 OUD]$ mount | grep u99
dbidg03:/u99 on /u99 type nfs4 (rw,relatime,vers=4.1,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.56.201,local_lock=none,addr=192.168.56.203)

Before we issue the first backup command, it is good to know which back ends we have. Some back ends change quite frequently and others might not. I am using the OUD only for TNS name resolution, so, the most important for me is the OracleContext0.

[dbafmw@dbidg01 ~]$ list-backends
Backend ID        : Base DN
------------------:----------------------------------------
Eus0              :
EusContext0       :
Fa0               :
OIDCompatibility  : cn=OracleContext,cn=OracleSchemaVersion
OracleContext0    : "cn=OracleContext,dc=dbi,dc=com"
adminRoot         : cn=admin data
ads-truststore    : cn=ads-truststore
backup            : cn=backups
monitor           : cn=monitor
schema            : cn=schema
subschemasubentry :
tasks             : cn=tasks
userRoot          : "dc=dbi,dc=com"
virtualAcis       : cn=virtual acis


[dbafmw@dbidg01 ~]$ list-backends -n OracleContext0
Backend ID     : Base DN
---------------:---------------------------------
OracleContext0 : "cn=OracleContext,dc=dbi,dc=com"

Ok. Let’s start a full backup of all back ends to the backup directory /u99/backup/OUD and compress them.

[dbafmw@dbidg01 ~]$ backup --backUpAll --compress --backupDirectory=/u99/backup/OUD
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend virtualAcis
[29/Mar/2017:08:55:49 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend OracleContext0
[29/Mar/2017:08:55:49 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend tasks
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend schema
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend OIDCompatibility
[29/Mar/2017:08:55:49 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend userRoot
[29/Mar/2017:08:55:49 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend replicationChanges
[29/Mar/2017:08:55:49 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:55:49 +0200] category=TOOLS severity=NOTICE msgID=10944795 msg=The backup process completed successfully

For backing up your OUD server back ends, the OUD itself does not have to be up and running. You can back it up while it is offline too.

[dbafmw@dbidg01 ~]$ stop-ds
Stopping Server...

[29/Mar/2017:08:57:46 +0200] category=BACKEND severity=NOTICE msgID=9896306 msg=The backend cn=OIDCompatibility,cn=Workflow Elements,cn=config is now taken offline
[29/Mar/2017:08:57:46 +0200] category=BACKEND severity=NOTICE msgID=9896306 msg=The backend cn=OracleContext0,cn=Workflow elements,cn=config is now taken offline
[29/Mar/2017:08:57:46 +0200] category=BACKEND severity=NOTICE msgID=9896306 msg=The backend cn=userRoot,cn=Workflow Elements,cn=config is now taken offline
[29/Mar/2017:08:57:46 +0200] category=BACKEND severity=NOTICE msgID=9896306 msg=The backend cn=virtualAcis,cn=Workflow Elements,cn=config is now taken offline
[29/Mar/2017:08:57:46 +0200] category=CORE severity=NOTICE msgID=458955 msg=The Directory Server is now stopped


[dbafmw@dbidg01 ~]$ backup --backUpAll --compress --backupDirectory=/u99/backup/OUD
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend virtualAcis
[29/Mar/2017:08:58:06 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend OracleContext0
[29/Mar/2017:08:58:06 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend tasks
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend schema
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend OIDCompatibility
[29/Mar/2017:08:58:06 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend userRoot
[29/Mar/2017:08:58:06 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend replicationChanges
[29/Mar/2017:08:58:06 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:08:58:06 +0200] category=TOOLS severity=NOTICE msgID=10944795 msg=The backup process completed successfully
[dbafmw@dbidg01 ~]$

Backing up a single back end is done by the following command.

[dbafmw@dbidg01 ~]$ backup --backendID OracleContext0 --compress --backupDirectory=/u99/backup/OUD
[29/Mar/2017:15:14:22 +0200] category=TOOLS severity=NOTICE msgID=10944792 msg=Starting backup for backend OracleContext0
[29/Mar/2017:15:14:22 +0200] category=JEB severity=NOTICE msgID=8847446 msg=Archived: 00000000.jdb
[29/Mar/2017:15:14:22 +0200] category=TOOLS severity=NOTICE msgID=10944795 msg=The backup process completed successfully

The backup which I have done is reflected now in the following directory.

[dbafmw@dbidg01 OUD]$ ls -rtl /u99/backup/OUD/backup-OracleContext0*
-rw-r--r-- 1 dbafmw oinstall 19193 Mar 28 15:11 /u99/backup/OUD/backup-OracleContext0-20170328131137Z
-rw-r--r-- 1 dbafmw oinstall 56904 Mar 28 15:20 /u99/backup/OUD/backup-OracleContext0-20170328132004Z
-rw-r--r-- 1 dbafmw oinstall 27357 Mar 29 15:14 /u99/backup/OUD/backup-OracleContext0-20170329131419Z
-rw-r--r-- 1 dbafmw oinstall 27357 Mar 29 15:15 /u99/backup/OUD/backup-OracleContext0-20170329131552Z
-rw-r--r-- 1 dbafmw oinstall 84556 Mar 29 15:16 /u99/backup/OUD/backup-OracleContext0-20170329131622Z

The backups done via the OUD backup command are documented in a file called backup.info. If you grep for the last backup piece, you will find it there as the last entry.

[dbafmw@dbidg01 OUD]$ cat /u99/backup/OUD/backup.info | grep -B 8 backup-OracleContext0-20170329131622Z

backup_id=20170329131622Z
backup_date=20170329131625Z
incremental=false
compressed=false
encrypted=false
property.last_logfile_name=00000000.jdb
property.last_logfile_size=84330
property.archive_file=backup-OracleContext0-20170329131622Z

There is another method to find the last backup which was done. Before the backup command starts, it copies the current backup.info to backup.info.save, and so, you just need to do a diff, and then you know which is the latest backup.

[dbafmw@dbidg01 OUD]$ diff backup.info backup.info.save
48,56d47
< backup_id=20170329131622Z
< backup_date=20170329131625Z
< incremental=false
< compressed=false
< encrypted=false
< property.last_logfile_name=00000000.jdb
< property.last_logfile_size=84330
< property.archive_file=backup-OracleContext0-20170329131622Z
<

But what happens if you don’t need some old backup anymore. e.g. the backup-OracleContext0-20170328131137Z.

[dbafmw@dbidg01 OUD]$ cat backup.info | grep backup-OracleContext0-20170328131137Z
property.archive_file=backup-OracleContext0-20170328131137Z

Unfortunately, there is no purge procedure delivered with OUD to clean up old backups. You have to clean it up yourself. e.g. in case you want to clean up Oracle Context backups older than 2 days, you could do like this.

[dbafmw@dbidg01 OUD]$ find /u99/backup/OUD -maxdepth 1 -type f -name "backup-OracleContext0*" -mtime +2 | awk -F "/" '{ print $5 }' | awk -F "-" '{ print $3 }'
20170328132004Z

[dbafmw@dbidg01 OUD]$ find /u99/backup/OUD -maxdepth 1 -type f -name "backup-OracleContext0*" -mtime +2 | awk -F "/" '{ print $5 }' | awk -F "-" '{ print $3 }' | while read i
do
echo /u99/backup/OUD/backup-OracleContext0-${i}
rm /u99/backup/OUD/backup-OracleContext0-${i}
sed -i "/backup_id=${i}/,/property.archive_file=backup-OracleContext0-${i}/d" /u99/backup/OUD/backup.info
done
[dbafmw@dbidg01 OUD]$ cat backup.info | grep 20170328132004Z
[dbafmw@dbidg01 OUD]$

This script is of course not baby save, but you got the idea. 😉

Conclusion

The Oracle OUD delivers quite a lot good options regarding backups. However, regarding purging the old stuff, you have to handle it yourself.