---
subtitle: Upgrades
header-img: img/header_img/server.jpg
date: 2018-03-07 09:50:12
description: Upgrading Spectrum Protect Server in a Docker Container
related:
- { page: "index", title: "Containerising SP" }
- { page: "firstrun", title: "Initial Container Setup" }
- { page: "normalrun", title: "Normal Run of Container" }
- { page: "recover", title: "Recoverying the SP Database" }
---
# Upgrading Spectrum Protect Server (in a container)
**NOT YET COMPLETE**
> **NOTES**:
> * The storage used in the example below is from the host filesystems, passed to the container with Docker's `-v` option.
> * Upgrading needs special thought.
 I have found that upgrading within a major release, eg: 7.1.0 to 7.1.1, 7.1.2 to 7.1.3, etc works transparently. Upgrading from 6 to 7 (I havent tried) and 7 to 8 (failed for me). Spectrum Protect is smart enough to realise that it has been upgraded and will do a one time schema update. However, DB2 needs thought, especially if there has been a major change in DB2 between SP releases.
> * As always, make sure you have a backout plan, in case things go pair shaped. I exploit Docker it provides a great backout option, especially if you use it with persistenet Docker Container storage that can exploit snapshots and reverting (or directly accessing) a snapshot. In the example below, I'm using Linux LVM snapshots to provide my backup option. Specturm Scale would also be a good choice.

## Configuration
Our configuration will use these defaults

```bash Container Variables
TSM_DB=/srv/sp/database
TSM_USER=/srv/sp/user
TSM_DATA=/srv/sp/data
```

* **TSM_DB** is where the TSM Database will be stored on the Docker Host, and will be passed to the container with `-v $TSM_DB:/database`
* **TSM_USER** is where the TSM Instance user's home directory is on the Docker Host, and will be passed to the container with `-v $TSM_USER:/tsm`
* **TSM_DATA** is where the TSM Disk based storage pools are stored on the Docker Host, and will be passed to the container with `-v $TSM_DATA:/data`
 If data is stored in a cloud pool, then this would be where the acceleration pool is holding data before it gets sent to the cloud.

# Upgrade Steps

## Backup SP
`backup db type=FULL devclass=<YOUR BACKUP DEVCLASS> protectk=y pass=<PASSWORD> wait=yes`

```plain Expected Output
Protect: SERVER1>backup db t=f devclass=dbb protectk=y pass=password wait=y
ANR0984I Process 8 for Database Backup started in the FOREGROUND at 15:59:21.
ANR4559I Backup DB is in progress.
ANR2280I Full database backup started as process 8.
ANR4626I Database backup will use 1 streams for processing with the number originally requested 1.
ANR4550I Full database backup (process 8) completed. Total bytes backed up: 2,232,418,304.
ANR0985I Process 8 for Database Backup running in the FOREGROUND completed with completion state SUCCESS at 16:02:16.
ANR2394I BACKUP DB: Server device configuration information was written to all device configuration files.

Protect: LEENOOKS>q volh type=dbb
...
                                 Date/Time: 08-03-2018 15:59:22
                               Volume Type: BACKUPFULL
                             Backup Series: 246
                          Backup Operation: 0
                                Volume Seq: 100,001
                              Device Class: DBB
                               Volume Name: /data/dbb/20485162.DBV

```

Make sure your backup is successful and make a note of where it is, in case you need it.

```bash On the Host
[root@host]# ls -aln $TSM_DATA/dbb/|grep 20485162
-rw------- 1 201 201 2232419730 Mar  8 16:01 20485162.dbv
```
## Stop SP

Stop your SP server.

`halt`

<small>**NOTE**: Dont use `docker stop` to stop your SP server.
 By default docker sends a SIGTERM signal to the containers process 1 and then waits 10 seconds for it to die. If it hasnt died, it will then send it a SIGKILL.
 While you can control the timeout between the SIGTERM and SIGKILL signal and you can even control which kill signal is sent, I havent explored what signals SP will act on. So as a recommendation, always use SP `halt` command to stop an SP server.</small>

## If you can, snapshot your persistent storage.
If you can snapshot your persistent storage that you provide to the SP Docker Container, that will save you doing a "restoredb" if something goes pair shaped.

## Delete your container

`docker rm -v spectrumprotect`

## Start the container with the new version of SP

### You need to do a one-time start of the container with the option `upgrade`.

`docker run --detach=true --hostname=tsm --interactive=false -v $TSM_USER:/tsm -v $TSM_DB:/database --privileged=true --rm=true --tty=false --name=spectrumprotect ibm/spectrumprotect:8.1.4 upgrade`

### Normal Run
`docker run --detach=true --hostname=tsm --interactive=false -v $TSM_USER:/tsm -v $TSM_DB:/database -v $TSM_DATA:/data --memory=16g -p 1500:1500 -p 1543:1543 --privileged=true --rm=false --restart=no --tty=false --name=spectrumprotect ibm/spectrumprotect:8.1.4`

```plain Expected Output
show the upgrade
```

Happy days :)

> If something did go pear shapped, then revert your snapshot (or if it is read only, copy the files back to the original path) and then start your container with the original image (the old version) of SP. It should start up as normal as if it was only shut down temporarily.
> If you really have problems, you have that backup to recover from! Start the container with the `restore <PASSWORD>` option - you'll need a DBDIRS.TXT file as well in the instance home directory. More info on recovering [here](recover).
