Skip to content

Importing an Existing Database

Jon Wagner edited this page Sep 19, 2012 · 4 revisions

Importing an Existing Database

Insight now works with existing databases. Just install over it and it will fix up all of the objects it knows about and create a new schema registry.

It will be able to use an existing database as long as it can handle the dependencies on the types of objects. (Currently the list of object types that it does not handle is in the TODO page.)

AllowRepair property

In some cases, when dropping an object, Insight thinks there should be an object in the database, but it's not there, or Insight thinks an object shouldn't be there, but you already added it. It will normally throw an exception in this case to help prevent bugs caused by poor dependency handling.

You can set the AllowRepair property on your SchemaInstaller to let the installer be a little more forgiving when it tries to fix your database. If you use this option, be sure to check your database after the upgrade.

Copy the Insight Schema Registry

If Insight can't handle your existing database or some of the objects in there, there is still a way to get it to work.

The first time you run the installer on your database, Insight will not have a populated schema registry, so it will try to re-create all of the objects in your database, and likely encounter errors. There are a few ways to handle this.

The simplest method is just to copy the schema registry from a copy of the database.

  1. Generate the scripts for the current database and put them in your project.
  2. Run the installer to install your schema to a new database.
  3. Copy the records from the Insight_SchemaRegistry table in the temporary database to your real database.
Clone this wiki locally