dbForge SQL Complete lets you restore closed sessions or documents from the current or other SSMS instances. SQL Complete creates a unique session for each SSMS instance, and each session can have multiple documents.
If you close SSMS without saving or SSMS crashes, SQL Complete saves open tabs to the cache. When you reopen SSMS, dbForge SQL Complete restores tabs from the latest autosaved session.
Note
Only one session can be active at a time. You can restore one document from another session at a time within the active session.
Document restoration is turned on by default. You can turn it off in the Options dialog or in the Documents Sessions window.
1. In the top menu, select SQL Complete > Options.
2. Navigate to the General page and clear Enable document restoring.
3. Click OK to save the changes.
Note
When Enable document restoring is selected, data about open documents is saved in the
docsessions.dbfile. You can use this file to restore documents when reopening dbForge SQL Complete.The default path to the .db file is
C:\Users\<user_name>\AppData\Roaming\Devart\dbForge SQL Complete.
To turn document restoration on, select Enable document restoring, then click OK.
1. In the top menu, select SQL Complete > Documents Sessions.
2. On the toolbar of the Documents Sessions window, clear Restoration Enabled.
The message appears, notifying you that document restoration is turned off.

To turn document restoration on, click Restoration Enabled.
You can restore sessions in the Documents Sessions window.
Warning
If a session runs in another SSMS instance, you can’t activate or change it from the current instance.
To restore a document session:
1. In the top menu, select SQL Complete > Documents Sessions.

The Documents Sessions window lists your recent sessions and documents.
2. Double-click the session you want to restore.
Alternatively, right-click the session and select Restore.

You can restore recently closed documents, including the last closed document.
To restore a recently closed SQL document, use one of these ways:

To restore the last closed document, use one of these ways:
An unmodified tab has no changes since it was last opened or saved. A modified tab has unsaved changes, marked by an asterisk (*).

To close unmodified tabs, right-click a tab and select Close Unmodified Tabs.
Note
Tabs with unsaved changes remain open.

To open the Documents Sessions window, in the top menu, select SQL Complete > Documents Sessions.
The following table describes options available on the Documents Sessions toolbar.
| Icon | Description |
|---|---|
![]() |
Activates the selected document session. The currently opened documents will be closed, and those from the activated session will be restored. Shortcut: Enter |
![]() |
Opens the Rename Session dialog, where you can select the IDE name and version as a session name, or enter a custom session name. Shortcut: F2 |
![]() |
Deletes the selected inactive sessions and/or documents. Shortcut: Delete |
![]() |
Expands all document sessions. |
![]() |
Collapses all document sessions. |
![]() |
Turns document restoration on when selected, or turns it off when cleared. |
Right-click the session and select the required option.
| Name | Description |
|---|---|
| Activate | Activates the selected document session. The option is available for an inactive document session. The currently opened documents will be closed, and those from the activated session will be restored. Shortcut: Enter |
| Rename | Opens the Rename Session dialog, where you can select the IDE name and version as a session name, or enter a custom session name. Shortcut: F2 |
| Expand All | Expands all document sessions. |
| Collapse All | Collapses all document sessions. |
| Delete | Deletes the selected inactive session. Shortcut: Delete |
When you hover over the session name, a tooltip appears displaying the current session status (active), latest backup timestamp, the number of documents in this session, and SSMS version.

Right-click the document and select the required option.
| Name | Description |
|---|---|
| Restore | Restores the selected document. The option is available for an inactive document. Shortcut: Enter |
| Open | Opens the selected document. If it is already opened, the option navigates you to the tab with that document. The option is unavailable for the documents in the active session. |
| Expand All | Expands all sessions and documents. |
| Collapse All | Collapses all sessions and documents. |
| Delete | Deletes the selected session. The option is available for active documents. Shortcut: Delete |
| Close | Closes the selected document. The option is available for the document in the active session. |
When you hover over the document name, a tooltip appears displaying the file name, latest backup timestamp, and file size (in bytes).

For more information about how to reopen closed tabs in SSMS, see How to recover recently closed tabs in SSMS using SQL Complete.