In the data modeling process, we establish a conceptual data model, generate a physical data model through a forward project, generate a database creation script, and finally generate a relational database from the physical data model. System database designers hope to seamlessly integrate database design and relational database generation. How to ensure two-way synchronization between physical data models and their corresponding databases becomes a key aspect of data modeling. As a powerful case tool, powerdesigner provides us with convenient reverse engineering features. You can add the structure information of all popular backend databases (including Sybase, DB2, and Oracle) to the physical data model and conceptual data model of powerdesigner through reverse engineering, including tables, indexes, triggers, and views. This document describes only the reverse engineering of PDM (physical data model. Reverse Engineering in PDM refers to the process of generating PDM from the user database of the existing DBMS or the SQL script of the existing database. There are two types of reverse engineering objects: 1) connecting to the database through the ODBC data source 2) existing database SQL scripts. The system environment in this example is as follows: 1. The database has been created, and the access user and password settings are complete. The database is Oracle9i. 2. the ODBC data source has been created by Oracle's net configuration assistant. The local network Naming Service "Database" is used ". 3. SQL script example crebas. SQL. 4. powerdesigner9.5 has been installed successfully. 1. Use the data source to connect to the database and reverse engineer to generate PDM 1. Configure user database connection Parameters Select database-> Configure connections to go to the system DSN tag, Click Add, select oracle as the database type, and click Finish. Enter datasource name "pdmtest" and servername "Database". The configuration is complete. Click "test connect" and enter servername "Database", user name and password. If the connection is successful, the following information is displayed: Choose database? Connect, select the ODBC data source, and enter servername "Database", user name, and password. If no prompt is displayed, the connection is successful. At the same time, you can use the database? View the connection information. 2. Set reverse engineering options to generate PDM Create a PDM file and select the matched Database Type "Oracle9i ". Select database? Reverse Engineer database. The database reverse engineering dialog box is displayed. Select using an ODBC data source and select ODBC Data Source "pdmtest" Click OK to display all tables, views, and users in the database. Select as needed and convert to PDM. 3. View data For the generated PDM, right-click a table graphical symbol and select View data to access the data in the table. Ii. Generate PDM through SQL script Reverse Engineering 1. Database SQL script file crebas. SQL. The following is a script instance: /* ===================================================== ======================================= */ /* Database Name: physicaldatamodel_1 */ /* DBMS name: Oracle version 9i */ /* Created on: 10:49:08 */ /* ===================================================== ======================================= */ /* ===================================================== ======================================= */ /* Table: "class "*/ /* ===================================================== ======================================= */ Create Table "class "( "Classid" number (2) not null, "Classname" varchar2 (24 ), Constraint pk_class primary key ("classid ") ) / /* ===================================================== ======================================= */ /* Table: "student "*/ /* ===================================================== ======================================= */ Create Table "student "( "Studentid" number (10) Not null, "Studentname" varchar2 (4 ), "Classid" number (2 ), Constraint pk_student primary key ("studentid ") ) / Alter table "student" Add constraint fk_student_reference_class foreign key ("classid ") References "class" ("classid ") / 2. Create a PDM and select database? Reverse Engineer database, select using script files. 3. See the PDM generated automatically by the script as follows: |