Reverse engineer an existing database into a database model

With the Reverse Engineer Wizard in Microsoft Visio Professional and Premium editions, you can create a database model from an existing database or a Microsoft Office Excel workbook. Database models graphically show the structure of a database so you can see how database elements, such as tables and views, relate to each other without showing the actual data. This can streamline creating a new database or understanding the structure of an existing one.

What do you want to do?


Review what the Reverse Engineer Wizard extracts

The schema definition information that the wizard can extract depends on a combination of things, such as the capabilities of the database management system (DBMS) and ODBC driver. The wizard shows all the elements it can extract and lets you choose which ones you want. For example, you may be interested in only 5 out of 10 tables, and 2 out of 4 views.

While you are running the wizard you can choose to have it automatically create the drawing in addition to listing the reverse engineered items in the Tables and Views window. If you decide not to have the drawing created automatically, you can drag the items from the Tables and Views window onto your drawing page to manually assemble the database model.

To the extent that they are available from the target DBMS, you can extract the following:

  • Tables
  • Views
  • Primary keys
  • Foreign keys
  • Indexes
  • Triggers (including code)
  • Check clauses (including code)
  • Stored procedures (including code)

Prepare to start the wizard

If you are reverse engineering an Excel workbook, before you start the wizard you need to open the workbook and name the group (or range) of cells that contain the column headings. If you want to use more than one worksheet, just name the group of column cells in each worksheet. These ranges are treated like tables in the wizard. For more information about how to name a range of cells, see the Microsoft Office Excel help.

For best results, set your default driver to the target database that you want to reverse engineer before you run the Reverse Engineer Wizard. This ensures that the wizard maps the native data types correctly and that all the code extracted by the wizard displays correctly in the Code window.

  1. Click the File tab, click New, click Software and Database, and then double-click Database Model Diagram.
  2. On the Database tab, in the Manage group, click Database Drivers.
  3. On the Drivers tab select the Visio-supplied driver for your DBMS. For example, if you are designing an Access database you would choose Microsoft Access.

If you are reverse engineering an Excel worksheet, choose the ODBC Generic Driver.

  1. Click Setup.
  2. On the ODBC drivers tab, select the check box for the vender-supplied driver for your DBMA. For example, if you are designing an Access database you would select the Microsoft Access Driver (*.mdb) check box.
  3. Click OK in each dialog box.

A vendor-supplied 32-bit ODBC driver must be from an ODBC Data Access Pack greater than version 2.0 and ODBC Level 1-compliant or greater. A vendor-supplied OLE DB provider must be compliant with the OLE DB version 1.0 or later specification.

Reverse engineer an existing database

  1. In your database model diagram, on the Database tab, click Reverse Engineer.
  2. On the first screen of the Reverse Engineer Wizard, do the following:
  1. Select the Microsoft Visio database driver for your database management system (DBMS). If you have not already associated the Visio database driver with a particular ODBC data source, click Setup to do so now.

If you are reverse engineering an Excel worksheet, choose the ODBC Generic Driver.

  1. Select the data source of the database you are updating. If you have not already created a data source for the existing database, click New to do so now.

When you create a new source, its name is added to the Data Sources list.

  1. When you are satisfied with your settings, click Next.
  2. Follow the instructions in any driver-specific dialog boxes. For example, in the Connect Data Source dialog box, type a user name and password, and then click OK. If your data source isn't password protected, click OK.
  1. Select the check boxes for the type of information that you want to extract, and then click Next.

Some items may be grayed out because not all systems support all the kinds of elements the wizard can extract.

  1. Select the check boxes for the tables (and views, if any) that you want to extract, or click Select All to extract them all, and then click Next.

If you are reverse engineering an Excel worksheet and don't see anything in this list, then it is likely that you need to name the range of cells that contain the column headings in your spreadsheet.

  1. If you selected the Stored Procedures check box in step 5, select the procedures that you want to extract, or click Select All to extract them all, and then click Next.
  2. Select whether you want the reverse engineered items added automatically to the current page.

You can choose to have the wizard automatically create the drawing in addition to listing the reverse engineered items in the Tables and Views window. If you decide not to have the drawing created automatically, you can drag the items from the Tables and Views window onto your drawing page to manually assemble the database model.

  1. Review your selections to verify that you are extracting the information you want, and then click Finish.

If you use the ODBC Generic Driver, you may receive an error that indicates that the reverse engineered information may be incomplete. In most cases this isn't a problem — just click OK and continue with the wizard.

The wizard extracts the selected information and displays notes about the extraction process in the Output window.

Top of Page Top of Page

 
 
Applies to:
Visio 2010