Power Designer逆向工程導入Oracle表,轉爲模型加註釋

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


發佈了22 篇原創文章 · 獲贊 6 · 訪問量 32萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章