Make the database (BPC RM on SQL2000)

From RiskWiki
Revision as of 15:19, 10 September 2019 by Bishopj (talk | contribs) (Created page with "=Introduction= Two options are available for creating a new risk database. The first option is easiest (BUT NOT PREFERRED) for users who do not have access to SQL Server too...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Two options are available for creating a new risk database. The first option is easiest (BUT NOT PREFERRED) for users who do not have access to SQL Server tools (Eg Enterprise Manager or SQL Studio). This generally applies only to users of MSDE 2000. The second option is the safest and therefore preferred, but requires access to the Enterprise Manager (SQL 2000) or Database Management Studio (2005/Express) shipped with the database software. Detaching and reattaching Microsoft databases on different computers is not recommended by Microsoft.


The following instructions assume the default drive and directories are used for database files. You may substitute your own locations but must edit the supplied sql files accordingly.


OPTION 1 – Attach Database (NOT PREFERRED in Enterprise)

This is the best method for MSDE 2000 and single user installs.


For MS SQL Server 2000/MSDE 2000

  • Attach database MDF file provided
    • Copy file [RMInstallDir]\Database\MDFToAttach\RiskManDB_Data.MDF to folder: 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\'
    • Run batch file: [RMInstallDir]\Database\MDFToAttach\AttachRiskMDFFile.bat


Notes: Please edit SQL file (AttachRiskMDFFile.sql) if you copy the file to a different location, a new SQL Server log file is automatically created.


OPTION 2 – Create & Restore Database (PREFERRED)

  • Database can be restored from SQL Server backup file. Follow these steps:


Create database 'RiskManDB’ in SQL Server (any version)

  • It is a good idea to create a couple of databases. Eg. a Training database, a Production (main) database and possibly a Testing database. You can have as many databases as you like in RiskManager.
  1. Right click on the “DataBases” folder and choose “New Database” from the properties.

    SQLEnt NewDB1.png

  2. Enter a database name that makes sense to you. We recommend that you adopt a sensible, consistent naming convention for your databases to make management easier later. We suggest you start it with “RiskManDB” ending with a character string that identifies the database. E.G. “RiskManDB_Train08”

    SQLEnt NewDB2.png

  3. Select OK to generate the new database


Restore the backup file

  • The backup file is held in [RMInstallDir]\Database\BackupToRestore\2000\RiskManDB2000.bak to database. We must force the restore over the existing database file and fix the file locations.


  1. In windows explorer, navigate to the supplied backup master directory: [RMInstallDir] \Database\BackupToRestore\2000\
  2. Either double click on the supplied batch file “CopyMasterToDefaultBackup2000.bat” or manually copy the file:

    [RMInstallDir] \Database\BackupToRestore\2000\RiskManDB2000.bak to the backup directory
    (DO NOT RESTORE DIRECTLY FROM THE SUPPLIED FILE).

    The default SQL 2000 backup directory (and used by the batch file) is: “C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP”

    THE BATCH FILE IS ONLY APPROPRIATE IF THE DATABASE SERVER IS ON THE SAME COMPUTER

  3. In Enterprise Manager Expand the database list for the target server.
  4. Right click on the database you wish to restore (in this case it is the database you just created)
  5. From the Menu that appears choose “All Tasks” then “Restore Database”
  6. The Restore Database window will open. On that window the database name should already be displayed in the :”Restore as database” field. Select “From device” and click on the “Select Devices” button on the right hand side.

    SQLEnt RestoreDB1.png

  7. In the Choose Restore Devices window, select “Add”

    SQLEnt RestoreDB2.png

  8. Select the “File Name” radio button and select the ellipsis button on the right hand side. Navigate to and select the file we just copied into your backup area and select OK.

    SQLEnt RestoreDB3.png

  9. The “Choose Restore Devices” window should now be populated with your backup file. Select OK again.

    SQLEnt RestoreDB4.png


  10. In the “Restore Database” window, copy the database name string from the “Restore as Database” field and select the Options tab.
  11. Tick the “Force restore over existing database and replace the file name portion of the physical file name (PRESERVING the path and the “_data.mdf” and “_log.log” portions of the file name) column in the grid with the database name you copied in the previous step. You should do this on both lines.

    SQLEnt RestoreDB5.png

  12. Select OK to start the restore.


BackLinks