What is H2 and how is it used in VirtServer?
VirtServer uses H2 as its embedded database. This is Java-based relational database management system. It stores the following:
- Virtual Service details
- Transactional and HAR logs
- User information
- Data for managing virts, tests, transactions, and users
As part of SmartBear's continuous maintenance and program to enhance VirtServer, we are upgrading to the latest version of H2, currently at V 2.3.232 (October 2024). This upgrade enhances security management and leverages the latest embedded database versions for improved performance.
Do I need to go through this upgrade process?
All customers migrating to the latest version of VirtServer 3.23.0, will be required to go through the migration process.
Without H2 migration, if you try to run VirtServer 3.23.0 you will get the following error:
ERROR [YYYY-MM-DD hh:mm:ss,SSS]
com.smartbear.virtserver.VirtServer: H2 database migration is required.
For more information, please go to H2 Database Migration.
Customers using VirtServer versions earlier than 3.6.0 must first upgrade to version 3.14 before upgrading to 3.23.0. This step is necessary due to changes in user management in the H2 database introduced in version 3.6. For more information, click here. |
Download the VirtServer 3.14 Installers here:
Steps to migrate the database
Before running the VirtServer installer for the latest version, you must perform the database migration. |
Note: | Migrating large virtual services (150-200 MB+) to the new database may take some time. To reduce migration time, consider undeploying large virtual services from VirtServer before the migration and then redeploying them using ReadyAPI or the VirtServer CLI after upgrading to version 3.23.0. Otherwise, please be patient during the migration process, as very large virtual services (400 MB+) can take up to 2 hours to migrate. |
To migrate the database, follow these steps:
-
Download the Migration Scripts: Download the H2 migration package from H2 Migrator.
-
Extract the Package: Unzip the package into your Downloads folder. This will create a new H2 migration folder.
-
Navigate to the Migration Folder: Open the folder relevant to your operating system.
The README file contains further instructions for steps 4-6 below.
-
Stop VirtServer: Ensure VirtServer is not running.
Database migration can only be performed when VirtServer is stopped. -
Run the Migration Script: Execute the
h2-migrator.bat
(for Windows) orh2-migrator.sh
(for Linux/Mac) migration script. Wait for the process to complete and follow any on-screen prompts. -
Start VirtServer: Once the migration is complete, start VirtServer as an application or as a service.
Need assistance? Contact Support
If you have any questions or encounter issues during the upgrade process, please reach out to Support for assistance. You can also request a technical session with our Solution Engineering team for additional help. To arrange this, please contact your SmartBear Account Manager.
How to revert to an earlier version of VirtServer
If you’ve upgraded to version 3.23.0 and need to revert to an earlier version, please note that file-based licensing will no longer be available as of October 2023. This will be fully replaced by SmartBear ID-based licensing, which was introduced in ReadyAPI 3.8.1 and supported in VirtServer versions 3.16.0 and 3.17.0.
To ensure your SmartBear License Management (SLM) works, you must revert to a version later than 3.17.0. For more information, click here.
To downgrade your version and restore your previous H2 database, follow these steps:
-
For VirtServer 3.16.0 or Earlier: If you want to revert after migrating to H2, manually delete the
virt-server.h2.mv.db
file and restart VirtServer 3.16.0.-
Windows:
C:\Users\<user>\.readyapi\virt-server\virt-server.h2.mv.db
-
Linux:
/home/user/.readyapi/virt-server/virt-server.h2.mv.db
-
-
If H2 Database Files Are in
.readyapi/virt-server
: Run thevirtserver-h2-migration-revert
script.-
Windows:
revert-h2-migrator.bat
-
Linux/Mac:
revert-h2-migrator.sh
-
-
If Database Files Are in Another Directory other than
.readyapi/virt-server
: Use the following command:-
Windows:
revert-h2-migrator.bat --db_path=C:\path\to\virt-server\virt-server.h2.mv.db
-
Linux/Mac:
./revert-h2-migrator.sh --db_path=path/to/virt-server/virt-server.h2.mv.db
-
Running VirtServer in Docker
If you are running the VirtServer Docker image without mounting it to a local folder, the H2 migration is not required.
However, if you are running the VirtServer Docker image with a mounted local folder,
such as: docker run -v C:\Users\user\DockerVS1:/virtserver smartbear/ready-api-virtserver-dev
then you will need to follow these steps for migration:
-
A
virt-server-docker.yml
file should be created in theC:\Users\user\DockerVS1
folder. -
The
.readyApi
folder will also be created in the same directory.
For further instructions, refer to the README file.