Running SQL Scripts for Microsoft databases

This topic describes the SQL scripts provided with StarTeamthat help you maintain the database.

Script overview

StarTeam Server includes several SQL scripts written specifically for use with your database. These scripts help you maintain and tune StarTeam Server databases. You run some SQL scripts after installation, some on a weekly basis for database performance maintenance, and some scripts are run for you automatically by StarTeam Server.

The SQL scripts for Microsoft SQL Server and Microsoft SQL Server Express databases that you may run are located in the Micro Focus\Hub\DBScripts\Sqlserver_Scripts folder.

Note: The Sqlserver_Scripts folder contains several subfolders: Create_Stored_Procedures, Drop_Stored_Procedures, Install, Preinstall, Generic, and DW (for Data Warehouse). The scripts in these subfolders are run by StarTeam Server as needed. Never execute any of them directly from an external database user interface, such as SQL Query Editor.

The following table lists the SQL scripts that you are most likely to need. Some should be run manually on a regular basis. The table recommends the frequency for running these scripts. You may adjust the frequency depending on the StarTeam Server usage at your facility. Run scripts at times when the server is least used, such as overnight or on weekends.

In addition to running these scripts, you should also run a Purge option from the Server Administration tool to remove deleted views from the database. We recommend purging the database after you have deleted one or more views from a project. See the Server Administration Tool Help for information on the Purge option.

  • Before running any of the StarTeam Server SQL scripts for a Microsoft SQL Server or Microsoft SQL Server Express database, ensure that the database compatibility mode is set correctly. For Microsoft SQL Server 2008-based configurations, set the database compatibility mode to 90.
  • Be sure to backup your StarTeam Server database, as necessary, and verify these backups periodically. You should restore and test backups of your StarTeam Server project data on a test system. Restoring and testing your backups helps to ensure that your data is being backed up correctly.

To run a script for a Microsoft SQL Server or Microsoft SQL Server Express database:

  1. Install SQL Server Management Studio or SQL Server Management Studio Express from Microsoft. Enter the result of your step here (optional).
  2. Click Start > Microsoft SQL Server [or Microsoft SQL Server Express] > SQL Server Manager Studio [or SQL Server Manager Studio Express].
  3. Design a new query or open an existing one in SQL Server Manager Studio.
  4. Click Query > Connection > Connect to connect to the server that contains the database you want to access.
  5. Select the appropriate StarTeam Server database.
  6. Open the tuning script, by choosing File > Open > foldername\scriptname.
  7. Execute the script, by clicking the Execute button on the toolbar or by pressing F5.

Back to top

SQL Scripts for Microsoft SQL Server and SSE Databases

starteam_sqlserver_dbcc.sql

Run: Weekly

This script rebuilds the database indexes and performs a consistency check on the database objects. This script builds the indexes and updates the statistics in the database distribution pages.

starteam_sqlserver_dbcc_reindex.sql

Run: At least twice a week

This script rebuilds all the indexes in the database. It is extremely important to run this script routinely.

starteam_sqlserver_dbcc_showcontig.sql

Run: At least twice a week

This script gives information on database fragmentation.

starteam_sqlserver_dropall.sql

Run: Only if necessary. Running this script deletes all StarTeam Server tables and the data they contain from the database. Use this script with extreme caution.

One use case example is if you migrate a StarTeam Server configuration to another database, you might use this script to remove tables from the original database. Another example is if you mistakenly add the StarTeam Server tables to a tablespace other than the StarTeam Server tablespace, use this script to remove them.

Back to top