All offline and online backup methods can be invoked in the CLI by using dsadm or dsconf. The default behavior forthese commands is to operate in synchronous mode. The commands do not return a completion code until the task is complete. The commands also offer an asynchronous mode, by setting the -a flag.
You can perform an online binary backup with dsconf or by using the Directory Service Control Center (DSCC).
For example, to back up master sA1 and store the resulting binary backup in the /install-path/sA1-bak directory, run the following command:
$ dsconf backup -p 20390 /install-path/sA1-bak
Use the -a or --async option to start a backup task that returns immediately.
You can perform an online LDIF export using the command line or using the DSCC. For example, use the following command to export to a file called export.ldif:
$ dsconf export -p 20390 "dc=example,dc=com" /install-path/export.ldif Beginning export of 'example' example: Processed 8 entries (100%). Export finished. Task completed (slapd exit code: 0).
The following command performs an offline binary backup:
$ dsadm backup /install-path/sA1 /install-path/sA1-bak [28/Oct/2006:23:38:13 -0500] - Backup starting (/install-path/sA1-bak) [28/Oct/2006:23:38:13 -0500] - WARNING<20509> - Backend Database - conn=-1 op=-1 msgId=-1 - Cannot create new directory /install-path/sA1-bak/dsA1 (-5943) Cannot create or rename a filename that already exists. [28/Oct/2006:23:38:13 -0500] - Backing up file 1 (/install-path/sA1-bak/dsA1/dsA1_objectclass.db3) [28/Oct/2006:23:38:13 -0500] - Backing up file 2 (/install-path/sA1-bak/dsA1/dsA1_id2entry.db3) [28/Oct/2005:23:38:13 -0500] - Backup completed (/install-path/sA1-bak)
The following command performs an offline LDIF export:
$ dsadm export /install-path/sA1 "dc=example,dc=com" /install-path/export.ldif Exporting data... [28/Oct/2005:23:37:46 -0500] - DEBUG - conn=-1 op=-1 msgId=-1 - Backend Instance: dsA1 ldiffile: /install-path/export.ldif [28/Oct/2005:23:37:46 -0500] - export dsA1: Processed 8 entries (100%).
The dsadm and dsconf commands can also be used to restore data. The commands are used the same way as for backups except that the commands passed are dsadm restore and dsconf restore.