Share this page

# Back up and restore a shared space

This topic describes how to back up a shared space, and how to restore it from backup.

In this topic:

## Overview

You can back up a shared space, and then restore it from backup, within the original ALM Octane instance. For example, suppose you want to delete a large number of entities and verify that there are no unexpected results. You can back up your space, perform the deletion, and then restore the original data if you need to undo the action.

Note:

- The examples below refer to deployment of ALM Octane on Linux, but they can be adjusted to Windows folders as needed.

- Audit data is saved in the Elasticsearch database only. To preserve audit data, make sure to back up your Elasticsearch database. You may want to truncate the audit table to improve performance.

Back to top

## Prepare space information

Before you begin, collect the required space information.

1. Get space information by issuing this SQL query against the site admin schema:

   SELECT sp_id, sp_logical_name, sp_mode, sp_schema_name, sp_version

   FROM shared_space

   WHERE sp_id = {SP_ID}

2. Locate your repository (storage) path: CD /<repo path>/storage/sharedspaces/sp{SP_ID}

Back to top

## Back up the space

To back up data belonging to a specific space, you need to back up the relevant database schema, zip the relevant part of the ALM Octane repository, and take a snapshot of the associated index in Elasticsearch.

Step 1: Back up the database schema

Use database tools to back up the schema. For example, with the Oracle expdb utility:

- For Oracle: expdp <admin conn> schemas=< SP_SCHEMA_NAME > dumpfile=<dumpfile> directory=<directory>

  SP_SCHEMA_NAME is the value obtained in the preparation step above.

- For SQL Server, see Full back up to disk to default location.

Step 2: Back up the Elasticsearch index

1. Use a REST API client to get the relevant Elasticsearch index name:

       curl 'http://<elastic host>:9200/_cat/indices/mqm_<sp_logical_name>*'

   For Windows, download curl for Windows.

2. Take a snapshot (backup) of the index. For details, see: Snapshot module.

   The general flow will be:

   1. Create a repository (if none exists).

   2. Back up the specific indexes.

   For example (after creating a repository):

   curl -XPUT "http://<elastic host>:9200/_snapshot/<repository_name>/<snapshot_name>?wait_for_completion=true&pretty" -H 'Content-Type: application/json' -d'

   {

   "indices": "mqm_<sp_logical_name>*",

   "ignore_unavailable": true,

   "include_global_state": false

   }

   }

   '

Step 3: Back up the ALM Octane repository

1. Go to the repository directory in your ALM Octane installation directory.

2. Locate the relevant subdirectory using this command:

       cd /<repo path>/storage/sharedspaces/sp{SP_ID}

3. Create a zip file using this command:

       tar cvzf {BACKUP_DIR}/sp{SP_ID}.trz

4. For Windows use 7-Zip or another compression tool to compress the repository.

Back to top

## Prepare to restore

Within ALM Octane you will reuse the shared space, so you should not delete it from the site admin console. Instead, deactivate the shared space.

Prepare ALM Octane

1. In ALM Octane site settings, access Site Admin > Spaces.

2. Select your space (for example, default_shared_space).

3. Click Deactivate Space.

Prepare the database

You will need to connect to the database as an admin user.

- For Oracle Schema (user):

  The user needs to be deleted: Drop user <SP_SCHEMA_NAME> cascade;

- SQL Server:

  During restore there is an option to overwrite. If you do not overwrite, the database needs to be deleted: Drop database <SP_SCHEMA_NAME>

Prepare Elasticsearch

Close the Elasticsearch indexes:

    curl -XPOST 'http://<elastic host>:9200/mqm_<sp_logical_name>*/close'

For Windows, download curl for Windows.

Back to top

## Restore the space

To restore data backed up from a shared space you need to restore the space schema, restore the Elasticsearch snapshot, restore the ALM Octane repository, and activate the space.

Step 1: Restore the space schema

- For Oracle:

  1. Copy the dump file with space schema data to the new database server.

  2. Import the space schema data from backup using an Oracle utility.

  Example: impdp <admin conn> schemas=< SP_SCHEMA_NAME > dumpfile=<dumpfile> directory=<directory>

- For SQL Server, see Restore a Database Backup.

  Example: RESTORE DATABASE < SP_SCHEMA_NAME > FROM DISK = N'<Path to .bak file>' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5

Step 2: Restore the Elasticsearch snapshot

Follow this procedure from elastic.co.

Example:

curl -XPOST "http://<elastic host>:9200/_snapshot/<repository_name>/<snapshot_name>/_restore?pretty" -H 'Content-Type: application/json' -d'

{

"indices": " mqm_<sp_logical_name>*",

"ignore_unavailable": true,

"include_global_state": false

}

'

Step 3: Restore the ALM Octane repository

1. Go to the repo directory in your ALM Octane installation directory (default /opt/octane/repo/).

2. Locate the relevant subdirectory using this command: cd storage/sharedspaces/sp{SP_ID}

3. Delete all the contents of the directory before restoring: rm –fr *

4. Restore the zip file using this command: tar xvzf {BACKUP_DIR}/sp{SP_ID}.trz

5. For Windows use 7-Zip or another compression tool to restore the repository.

Step 4: Activate the space

1. After all preparations are finished and data is restored, restart the ALM Octane service. If there is more than one node of ALM Octane, restart each node.

2. After restart, activate the space:

   1. In site settings, access Site Admin > Spaces.

   2. Select your space (e.g., default_shared_space).

   3. Click Activate.

Back to top

See also:

- Users
- Set up LDAP

https://admhelp.microfocus.com ALM Octane 8942
Tips to improve your search results... ALM Octane Help Center ALM Octane Help 23.4-24.3 All View Local Help Center View Online Help Center Version: