> For the complete documentation index, see [llms.txt](https://docs.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.collibra.com/data-quality-self-hosted/installation/upgrade-data-quality-observability-self-hosted/roll-back-data-quality-observability-self-hosted/roll-back-a-spark-standalone-data-quality-observability-self-hosted-deployment.md).

# Roll back a Spark standalone Data Quality & Observability (self-hosted) deployment

In a Spark standalone deployment, `dq-webapp` and `dq-agent` run as JVM processes on the same host or separate hosts, managed by `owlmanage.sh`. Use this procedure to restore the previous version after an unsuccessful upgrade.

{% hint style="info" %}
Before you start, confirm you completed the [Roll back Data Quality & Observability (self-hosted)](/data-quality-self-hosted/installation/upgrade-data-quality-observability-self-hosted/roll-back-data-quality-observability-self-hosted.md#pre-upgrade-checklist) before upgrading. If you did not take a Metastore snapshot before upgrading, a full rollback may not be possible.
{% endhint %}

## Prerequisites

* `owlmanage.sh` access on the host.
* The previous version JARs available at a backup path.
* The Metastore snapshot from before the upgrade (required if schema migrations ran).

## Steps

{% stepper %}
{% step %}
Stop the agent and the web application.

```
$OWL_BASE/owl/bin/owlmanage.sh stop=owlagent
$OWL_BASE/owl/bin/owlmanage.sh stop=owlweb
```

Confirm both processes stopped.

```
cat $OWL_BASE/owl/pids/owl-web.pid    # file should be removed
cat $OWL_BASE/owl/pids/owl-agent.pid  # file should be removed
```

{% endstep %}

{% step %}
Restore the previous JARs.

```
cd $OWL_BASE/owl/bin
 
# Rename the new JARs so you can reference them if needed
mv dq-webapp-<new-version>.jar                     dq-webapp-<new-version>.jar.bad
mv dq-agent-<new-version>.jar                      dq-agent-<new-version>.jar.bad
mv dq-core-<new-version>-with-dependencies.jar     dq-core-<new-version>-with-dependencies.jar.bad
 
cp /path/to/backup/dq-webapp-<old-version>.jar                  .
cp /path/to/backup/dq-agent-<old-version>.jar                   .
cp /path/to/backup/dq-core-<old-version>-with-dependencies.jar  .
```

{% endstep %}

{% step %}
Restore the config directory if it changed during the upgrade.

```
cp -r $OWL_BASE/owl/config_backup_<timestamp>/* $OWL_BASE/owl/config/
```

{% endstep %}

{% step %}
Restore the Metastore if schema migrations ran during the upgrade.

{% hint style="info" %}
Skip this step if the upgrade was a patch release with no schema migrations.
{% endhint %}

```
psql -h <METASTORE_HOST> -U <METASTORE_USER> -c "DROP DATABASE owldb;"
psql -h <METASTORE_HOST> -U <METASTORE_USER> -c "CREATE DATABASE owldb;"
pg_restore -h <METASTORE_HOST> -U <METASTORE_USER> -d owldb owldb_backup_<timestamp>.dump
```

{% endstep %}

{% step %}
Start the web application, then the agent.

```
$OWL_BASE/owl/bin/owlmanage.sh start=owlweb
sleep 10
$OWL_BASE/owl/bin/owlmanage.sh start=owlagent
```

{% endstep %}

{% step %}
Verify the rollback was successful.

```
tail -f $OWL_BASE/owl/log/owl-web.log   # check for startup errors
tail -f $OWL_BASE/owl/log/owl-agent.log # check the agent connects to the metastore
curl -s http://localhost:<PORT>/dq/api/health
```

Confirm all items in the [Roll back a Spark standalone Data Quality & Observability (self-hosted) deployment](#verification-checklist).
{% endstep %}
{% endstepper %}

## Rollback verification checklist

After the rollback, confirm the following before declaring success:

* `dq-webapp` health endpoint returns HTTP 200.
* `dq-webapp` logs show no Flyway version mismatch errors.
* `dq-agent` log shows a successful connection to the Metastore.
* The agent appears as `ACTIVE` in the `agent` table in the Metastore.
* A test job submits successfully and reaches `FINISHED` status in `agent_q`.
* The scheduler picks up and runs a scheduled job (check the `job_schedule_attempt` table).
* The UI loads and displays historical findings correctly.
