# Initialize Quartz for MS SQL Server

Follow the steps below to initialize a new Quartz database for a MS SQL Server Pentaho Server repository.

**Note:** You may need administrator permissions to run these scripts on the host OS server.

1. Backup your data. See [Back up your existing Pentaho products and install Pentaho 10.2](/install/10.2-install/pentaho-upgrade-cp/using-the-pentaho-upgrade-installer/use-the-pentaho-upgrade-installer-to-upgrade-archive-installation/back-up-your-pentaho-products-and-install-pentaho-9.1-pentaho-upgrade.md).
2. If the Pentaho Server is currently running, stop it.

   For instructions on stopping the server, see [Stop and start the Pentaho Server and repository](/install/10.2-install/pentaho-configuration/tasks-to-be-performed-by-an-it-administrator/configure-the-pentaho-server/stop-and-start-the-pentaho-server-and-repository.md).
3. Make sure that your MS SQL Server instance is up and running.
4. Browse to the `<*your pentaho directory*>/pentaho-server/data/sqlserver` folder and using any text editor, open the `create_quartz_sqlServer.sql` file.
5. As needed, modify the create script according to your existing setup for the user, password, database, and other required information and then save and close the file.
6. Open a sqlcmd utility window, or from Microsoft SQL Server Management Studio, run the creation script:

   `<*your pentaho directory*>/pentaho-server/data/sqlserver/create_quartz_sqlServer.sql`

   The new Quartz scheduler table prefixed with `QRTZ6_` is created. Any existing `QRTZ5_` scheduler database is retained. However, starting the Pentaho Server at this point will result in an empty schedule.
7. If you want to retain your existing scheduler database, using any text editor, open the `migrate_old_quartz_data_sqlserver.sql` file.
8. As needed, modify the migration script according to your existing setup for the user, password, database and other required information and then save and close the file.
9. Run the migration script:

   `<y*our pentaho directory*>/pentaho-server/data/sqlserver/migrate_old_quartz_data_sqlserver.sql`
10. Restart the Pentaho Server.

The original Quartz scheduler database is migrated to the new Quartz database.

**Note:** The original `QRTZ5_` data is retained. You can delete it at your discretion after confirming the migration was successful and complete within the Pentaho Server repository.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentaho.com/install/10.2-install/pentaho-upgrade-cp/mandatory-quartz-upgrade-for-versions-10.2.0.1-and-later/initialize-quartz-for-ms-sql-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
