You are on page 1of 3

Date: Jan.

11, 2015

This document outlines how to create a new schema, upgrade an existing schema to
the current
version, downgrade a schema to a particular version, and set-up the SQL Agent job
for an
MSPD2 database.

All the scripts mentioned in this document can be located in the


MineSight/scripts/sql/MSPD2 folder.

Creating a new MSPD2 database


_____________________________

1. In SQL Server Management Studio, connect to the SQL Server instance that you
wish to create
an MSPD2 database in.
2. Expand the connected server in the Object Explorer.
3. Right click on "Databases" -> New Database...
4. Enter a database name in the popup wizard.
5. Change other parameters as you wish (e.g. the database files' parameters such as
the file paths).
6. Click "OK" to create the database.
7. Execute the script atlas_full_setup.sql on the newly created database. /
8. If you wish to set up the SQL Agent job, please refer to the section "Setting-up
the SQL Agent
job" below.

Upgrading an existing schema


____________________________

1. In SQL Server Management Studio, connect to the SQL Server instance that
contains the MSPD2 database.
2. Depending on the current version and the version that you want to upgrade the
MSPD2 database to,
execute a series of upgrade scripts against the database.
3. If you wish to set up the SQL Agent job on your upgraded database, please refer
to the section
"Setting-up the SQL Agent job" below.

Example:
Current version: 1.0
Upgrading to: 1.2
Run the upgrade scripts in the following order:
1) atlas_change_script_1_0_to_1_1.sql
2) atlas_change_script_1_1_to_1_2.sql

Downgrading an existing schema


______________________________

1. In SQL Server Management Studio, connect to the SQL Server instance that
contains the MSPD2 database.
2. Depending on the current version and the version that you want to downgrade the
MSPD2 database to,
execute a series of downgrade scripts against the database.
Example:
Current version: 1.3
Upgrading to: 1.1
Run the downgrade scripts in the following order:
1) atlas_change_script_1_3_to_1_2.sql
2) atlas_change_script_1_2_to_1_1.sql

Setting-up the SQL Agent job


____________________________

The following outlines how to set-up the SQL Server Agent and the job required to
delete plans.
This only applies to SQL Server Standard and Enterprise editions. SQL Server Agent
does not
run on the Express edition. The SQL Server Agent service must be running to execute
the job.

Make sure SQL Server Agent service is running:


1. Click START on your computer and in the search bar type "Component Services"
2. From the list that shows up on top, choose "Component Services" and click on it.
3. The Component Services console opens up.
4. Click on "Services" on the left tree.
5. Using Windows' Services console, look for the SQL Server Agent service. If there
is more
than one, select the one with the instance name that matches the instance where the
MSPD2
database resides.
6. Right-click on this service and select Properties. Ensure that the Startup type
is Automatic.
7. If the service is currently stopped, click on the Start button to start the
service.

Create the SQL Agent job:


1. In SQL Server Management Studio, connect to the SQL Server instance that
contains the MSPD2 database.
2. Execute the script atlas_change_script_sqlserver_agent_1_0_to_1_1.sql on the
MSPD2 database.

Notes:
a. The script needs to be updated for the specific environment.
b. The instructions are contained in the script and requires the name of the MSPD2
database as
well as a location where a log file can be stored.
c. This script will have to be executed by an administrator or a user with
privileges to create
SQL Server Agent jobs.
d. By default, the job is scheduled to run every hour at the top of the hour. This
schedule can
be modified using SQL Server Management Studio.

Make sure the job is set up correctly:


1. In the Object Explorer, the last option in the tree is SQL Server Agent. Expand
this tree.
Expand the Jobs branch to see the list of jobs.
2. Find a job called "MSPlanner - Delete Plans Marked for Deletion". This is the
job that is
set up to delete plans marked for deletion in an MSPD2 database.
3. Right-click on this job and select Properties.
4. Under the General page, ensure that the Enabled box is checked.
5. Under the Schedules page, ensure that at least one of the schedules has Enabled
set to Yes.
6. Under the Steps page, there should be one step called sp_delete_all_plan. Select
this step
and click on Edit. Ensure that the database identified on the General page is the
correct MSPD2 database.

At this point, the job is set up and ready to go. Plan saves should no longer
delete old versions of
the plan but will instead mark them for deletion and leave them for the job to
actually delete.

You might also like