天天看點

【Powerdsiger】 逆向工程擷取oracle資料庫中PMD

  在資料模組化過程中,我們建立概念資料模型,通過正向工程生成實體資料模型,生成資料庫建庫腳本,最後将實體資料模型生成關系資料庫。系統資料庫設計人員希望能夠将資料庫設計和關系資料庫生成無縫地內建起來,如何保證實體資料模型與其對應資料庫之間的雙向同步成為資料模組化非常關鍵的一點。Powerdesigner作為強大的Case工具,為我們提供了友善的逆向工程特性。可以将目前所有流行的後端資料庫(包括Sybase、DB2、Oracle等)的結構資訊通過逆向工程加入到PowerDesigner的實體資料模型和概念資料模型中,包括表、索引、觸發器、視圖等。

需要使用powerdsigner做逆向工程擷取資料庫中建立表的相關聯系。在使用,連接配接資料庫時候出現如下錯誤:

第一次連接配接資料庫,powerdsigner·會在資料庫上建立以‘PM’開頭的表和視圖。第二次連接配接的時候出現

repository -> connect 連接配接時出現報錯:

The repository does not contain all the required definitions. Only an administrator can update it.

點選 确定,出現錯誤:

The connection failed because the repository has not been installed on this database.

解決方法:

set echo off feed off heading off

spool /home/oracle/droppmtable.sql 

select 'drop table '||tname||' purge;' from tab where tname like 'PM%';

spool off

之後執行産生出的腳本 ,删除資料庫中的pm開頭的表就解決問題了。

使用powerdsigner·的逆向工程必須先建立ODBC資料源。

1.打開或建立一個PhysicalDataModel檔案(.pdm) 

2.在菜單項 Database->Configure Connections ->System DSN ->Add ->選擇Oracle ODBC Driver完成->輸入Data Source Name(資料源名稱,比如RAC),輸入Service Name(就是你要連接配接的資料庫的TNSNAMES.ORA 檔案裡的網絡服務名) ,UserID(可以先不填)  點選 OK 

<a href="http://blog.itpub.net/batch.download.php?aid=32291" target="_blank"></a>

3.Database-&gt;Connet-&gt;選擇第一項Machine data source 選擇剛才建好的資料源

RAC,在Login裡輸入UserID和Password,點選 Connect 。提示連接配接成功。

4.Database-&gt;Reverse Engineer Database -&gt;選擇 Using an ODBC data source項,下拉框中是剛才配好的資料源 ,點選确定-&gt;一個連接配接輸入框輸入User Name和Password點選OK 

<a href="http://blog.itpub.net/batch.download.php?aid=32292" target="_blank"></a>

5.出現表格的清單,選擇需要導出的表-&gt;點 OK,資料表比較多就需要等待一段時間。

<a href="http://blog.itpub.net/batch.download.php?aid=32293" target="_blank"></a>

6.将導好的pdm檔案轉成cdm檔案 Tools-&gt;Generate Conceptual Data Model -&gt; Ceneral 項:預設的name和code可以自己改改,Detail項: 将 Check model 前面的勾去掉,-&gt;确定 cdm圖生成。

<a href="http://blog.itpub.net/batch.download.php?aid=32294" target="_blank"></a>