# Back Up and Restore Category

The Category component stores some of the data about the categories, clusters, and taxonomies in IDOL Server. Other data is stored in the AgentStore component, which is a specially configured Content component.

TIP: You can back up and restore the AgentStore index in the same way as the main data index. See Back Up and Restore the Data Index.

This section describes methods for backing up and restoring data in the Category component.

## Back Up Category, Cluster, and Taxonomy Data

The `BackupServer` action creates a compressed backup of the Category data files. The backup ZIP file is created in the directory you specify, by default the Category working directory. It is not possible to specify a name for the backup file.

This action backs up the contents of the configured Category, Cluster, and Taxonomy directories, and the queue schedule XML file. The Category directory includes the `cat.db` file, which contains most category details.

You can run the `BackupServer` action at any time, or you can configure it to run at regular intervals, in the same manner as for scheduling cluster or taxonomy actions. In either case, the action is queued and run in a background processing thread.

As an alternative to running the `BackupServer` action, you can back up the Category data files from the Backup/Restore tab on the Console page in the Control section of IDOL Admin.

## Restore Category, Cluster, and Taxonomy Data

The `RestoreServer` action uses the backup file you specify to restore Category to an earlier state. This action overwrites any existing data you may have in Category, including categories and their details, cluster data, and taxonomy data.

This action does not affect the contents of the AgentStore, which is where category details are kept for the purposes of basic search. The `CategorySuggest` actions use the AgentStore index for this purpose.

Therefore, after you run a `RestoreServer` action, Micro Focus recommends that you run a `CategorySyncCatDRE` action to ensure that the details in Category match those in the `AgentStore.` The `CategorySyncCatDRE` action does not have any parameters.

You can run the `RestoreServer` action only on demand. You cannot schedule it.

As an alternative to running the `RestoreServer` action, you can restore a backed up copy of the Category data files from the Backup/Restore tab on the Console page in the Control section of IDOL Admin.

## Export Category Data

In addition to backing up and restoring the entire state of Category, you can also export and import category hierarchies.

To export a category hierarchy, use the `CategoryExportToXML` action. You can use various parameters to export a single category, with or without its parent and child categories, including or excluding its details (for example, training, ID, fields, and so on). You can also specify the root category to export the whole hierarchy tree, including all details of every category.

This action allows you to make lightweight backups, if you do not want to back up cluster or taxonomy data. You can also make different backups of different parts of the hierarchy, rather than backing everything up each time.

The following `CategoryExportToXML` action parameters allow you to control the export.

Parameter | Description
--- | ---
`Category` | The ID of the category to export. The default is `0` (the ID of the root category).
`Above` | Whether to export the parent categories (ancestors) of the specified category. The default is `False`.
`Below` | Whether to export the child categories (descendants) of the specified category. The default is `False`.
`IncludeCatID` | Whether to include category IDs in the exported data. The default is `False`.
`IncludeTopLevel` | Whether to include the specified category in the exported data. The default is `False`.
`ExportFileName` | The name of the XML file to write the exported data into. If no filename is given, the data is returned in the XML response for the action.

## Import Category Data

To import a category hierarchy from an XML file, use the `CategoryImportFromXML` action.

CAUTION: Be careful when using the parameters in this action, as it can overwrite existing categories with data from the export file.

Specifying the root category as the parent of the imported data augments or overwrites the existing hierarchy, as appropriate. If the imported data contains category IDs (which it does if you set `IncludeCatID` in the corresponding `Export` action), then the import uses these values, rather than automatically generating new ones.

NOTE: IDs must not be longer than 18 characters. The action does not import any category with an ID that is longer than 18 characters.

The following `CategoryImportFromXML` action parameters allow you to control the import.

Parameter | Description
--- | ---
`ImportFileName` | The name of the XML file containing the exported category data to import. You must set one of `ImportXML` and `ImportFileName`.
`ImportXML` | The category data to import, as percent-encoded XML. You must set one of `ImportXML` and `ImportFileName`.
`OnConflict` | The behavior to use for conflicting categories. A conflict occurs if a category in the XML data has the same name and hierarchy position as an existing category. Use one of the following values: `KeepExisting`: use the existing category and discard the category in the XML data. This is the default value. `Overwrite`: import the category in the XML data, overwriting the details in the existing category. `Merge`: as far as possible, merge the details of the two categories together. In most cases, new details overwrite old ones if values clash.
`Parent` | The category to use as the parent of the imported hierarchy. The default value is category 0 (the root category).
`BuildNow` | Whether to immediately build the imported categories. The default is `False`.

_FT_HTML5_bannerTitle.htm