Restore document sessions

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.

Turn document restoration off

Document restoration is turned on by default. You can turn it off in the Options dialog or in the Documents Sessions window.

Turn off in the Options dialog

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.db file. 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.

Turn off in the Documents Sessions window

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.

Document restoration is turned off

To turn document restoration on, click Restoration Enabled.

Restore a session

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.

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.

Documents Sessions window

Restore documents

You can restore recently closed documents, including the last closed document.

Restore a recently closed document

To restore a recently closed SQL document, use one of these ways:

  • Right-click the tab, select Recently Closed Documents, and select the document you want to restore.
  • In the top menu, select SQL Complete > Recently Closed Documents, and select the document you want to restore.

Restore a recently closed document

Restore the last closed document

To restore the last closed document, use one of these ways:

  • Right-click the tab and select Restore Last Closed Document.
  • In the top menu, select SQL Complete > Restore Last Closed Document.
  • Press Alt+Z.

Close all unmodified tabs

An unmodified tab has no changes since it was last opened or saved. A modified tab has unsaved changes, marked by an asterisk (*).

Unmodified and modified tabs

To close unmodified tabs, right-click a tab and select Close Unmodified Tabs.

Note

Tabs with unsaved changes remain open.

Close All Unmodified

Documents Sessions window

To open the Documents Sessions window, in the top menu, select SQL Complete > Documents Sessions.

Documents Sessions toolbar

The following table describes options available on the Documents Sessions toolbar.

Icon Description
Activate Activates the selected 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
Delete Deletes the selected inactive sessions and/or documents.
Shortcut: Delete
Expand All Expands all document sessions.
Collapse All Collapses all document sessions.
Restoration Enabled Turns document restoration on when selected, or turns it off when cleared.

Shortcut menu for sessions

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.

Information on the session

Shortcut menu for documents

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).

Information on the document

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