type=page
status=published
title=recover-transactions
next=redeploy.html
prev=ping-node-ssh.html
~~~~~~

= recover-transactions

[[recover-transactions-1]][[GSRFM00216]][[recover-transactions]]

== recover-transactions

Manually recovers pending transactions

[[sthref1952]]

=== Synopsis

[source]
----
asadmin [asadmin-options] recover-transactions [--help]
[--transactionlogdir transaction_log_dir]
[--target target_server_name] server_name
----

[[sthref1953]]

=== Description

The `recover-transactions` subcommand manually recovers pending
transactions.

For an installation of multiple server instances, you can run the
`recover-transactions` subcommand from a surviving server instance to
recover transactions after a server failure. To use this subcommand in
this way, the following conditions must be met:

* Delegated transaction recovery is disabled.
* Transaction logs are stored on a shared file system or in a database
that is accessible to all server instances.

For a stand-alone server, do not use this subcommand to recover
transactions after a server failure. For a stand-alone server, the
`recover-transactions` subcommand can recover transactions only when a
resource fails, but the server is still running. If a stand-alone server
fails, only the full startup recovery process can recover transactions
that were pending when the server failed.

This subcommand is supported in remote mode only.

[[sthref1954]]

=== Options

asadmin-options::
  Options for the `asadmin` utility. For information about these
  options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
`--help`::
`-?`::
  Displays the help text for the subcommand.
`--transactionlogdir`::
  The location of the transaction logs for a server for which
  transaction recovery is requested. This option applies only if
  transaction logs are stored on a shared file system.
`--target`::
  The target server that performs the recovery for the server that is
  specified by the server_name operand. The target server should be
  running.
`--destination`::
  This option is deprecated. It works exactly as the `--target` option
  does.

[[sthref1955]]

=== Operands

server_name::
  For a stand-alone server, the value of this operand is typically
  `server`. Transactions are recovered only if a resource fails, but the
  server is still running.

+
For an installation of multiple server instances, the value of this
  operand is the name of the server for which the recovery is required.
  The in-flight transactions on this server will be recovered. If this
  server is running, recovery is performed by the same server. In this
  situation, the `--transactionlogdir` and `--target` options should be
  omitted. If the server is not running, the `--target` option is
  required, and the `--transactionlogdir` option is also required if
  transaction logs are stored on a shared file system.

[[sthref1956]]

=== Examples

[[GSRFM733]][[sthref1957]]

==== Example 1   Recovering transactions on a running server

[source]
----
% asadmin recover-transactions server1
Transaction recovered.
----

[[GSRFM734]][[sthref1958]]

==== Example 2   Recovering transactions for a server that is not running

[source]
----
% asadmin recover-transactions --transactionlogdir /logs/tx --target server1 server2
Transaction recovered.
----

[[sthref1959]]

=== Exit Status

0::
  command executed successfully
1::
  error in executing the command

[[sthref1960]]

=== See Also

link:asadmin.html#asadmin-1m[`asadmin`(1M)]

link:freeze-transaction-service.html#freeze-transaction-service-1[`freeze-transaction-service`(1)],
link:rollback-transaction.html#rollback-transaction-1[`rollback-transaction`(1)],
link:unfreeze-transaction-service.html#unfreeze-transaction-service-1[`unfreeze-transaction-service`(1)]

"link:../administration-guide/transactions.html#GSADG00022[Administering Transactions]"
in {productName} Administration Guide

"https://eclipse-ee4j.github.io/jakartaee-tutorial/#transactions[Transactions]"
in The Jakarta EE Tutorial


