Power Designer逆向工程匯入Oracle表,轉為模型加註釋
阿新 • • 發佈:2019-01-08
1.開啟PowerDesigner ——檔案——Reverse Engineer——DataBase
2.選擇所要連線資料庫版本,此處使用的是oracle version 11g。
3.點選紅色區域,選擇資料來源
4.選擇modify
5.在此填寫你的資料庫名稱、連線地址、使用者名稱。確定
6.選擇你新建立的連線資料庫
7.填寫需要轉換為模型的資料庫的使用者名稱和密碼
8.確定即可匯出為模型
9.如果資料庫中對錶或欄位有註釋,那麼通過下面的操作,可以讓這些註釋反映在物理模型上,在檢視pdm圖時更容易理解。
選擇工具——Execute Commands——Edit /Run Script
10.將11步驟中的程式碼貼上到此處,然後執行。即成功加入註釋
11. 需要執行的指令碼語言(不需要做任何修改)
Option Explicit ValidationMode = True InteractiveMode = im_Batch Dim mdl 'the current model 'get the current active model Set mdl = ActiveModel If (mdl Is Nothing) Then MsgBox "There is no current Model" ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then MsgBox "The current model is not an Physical Data model." Else ProcessFolder mdl End If 'This routine copy name into code for each table, each column and each view 'of the current folder Private sub ProcessFolder(folder) Dim Tab 'running table for each Tab in folder.tables if not tab.isShortcut then if len(tab.comment) <> 0 then tab.name = tab.comment end if On Error Resume Next Dim col 'running column for each col in tab.columns if len(col.comment) <>0 then col.name =col.comment end if On Error Resume Next next end if next end sub