# xSQL Recover

> It is possible to direct xSQL to connect to an existing database in shared memory.

> ### For an overview see page xSQL Server Instrumentation

> Specifying the command line option `-daemon` directs xSQL to connect to an existing database in shared memory (instead of creating new one) and start as a Remote SQL server for the database. This is especially useful for recovering a shared memory database opened by xSQL or another application, and then left “orphaned” when the xSQL process terminates ungracefully or the other application crashes.

> For example, suppose the database was created with the following command:

>         ./xsql -size 100m -shared -dbname mydb -p 12345

> Then the xSQL process is ungracefully terminated for some reasons. To restore remote access to the database we can start xSQL as follows:

>         xsql mydb -recovery -p 12345 -daemon