ERwin使用说明(中英文)
- 格式:doc
- 大小:1.39 MB
- 文档页数:23
Getting Started with ER win (Erwin 入门)by Dr。
Peter WolcottDepartment of Information Systems and Quantitative AnalysisCollege of Information Science and TechnologyUniversity of Nebraska at Omaha(由内布拉斯加州的奥马哈大学信息科学与技术学院门的信息系统和定量分析博士彼得著)Introduction (介绍)ER win is a popular data modeling tool used by a number of major companies in Omaha and throughout the world. (Erwin是受奥马哈和世界各地的一些主要的公司欢迎的数据模型工具) The product is currently owned,developed, and marketed by Computer Associates, a leading software developer.(该产品是由具有领导地位的CA软件开发公司拥有、开发和销售)The product supports a variety of aspects of database design, including data modeling, forward engineering (the creation of a database schema and physical database on the basis of a data model), and reverse engineering (the creation of a data model on the basis of an existing database) for a wide variety of relational DBMS, including Microsoft Access, Oracle, DB2, Sybase, and others。
ERwin相关概念快速入门适用于对ERwin初学者使用1、如果只做文档,可以选择只建立logical view2、如果是做项目,需要同时使用Logical view 和physical view3、一般Logical view是用于做文档的,而physical view是用于生成或者导出脚本的4、表之间的三种连接线,第一种用于把表1中的主键插入到表2中的外键,且插入的作为表2的主键第二种用于多对多,很少用到第一种用于把表1中的主键插入到表2中的外键,且插入的不作为表2的主键5、Logical中的和physical中对应的表的名称可以不一样,一般在physical中的表的名称用英文名称在Logical中的表的名称则无所谓,如果需要可以用中文6、在Physical view中的Tools中的[Forward Engineer/Schema Generation]中在右侧的表中用对勾可以选择需要操作的项目点击【preview】可以看到脚本,可以复制过来改改就能是脚本了点击【report】可以直接导出脚本点击【Generate】则可以直接连接到数据库,把相关的Scheme都建立起来7、在Logical view的一个Entity上右键点击,选择attributes,就进入了给表加入column 的界面了在General中选择一种基本类型(Domain)比如string后,就能加入一个名称了,Attribute name就是Logical view中的名字Column name就是用于生成脚本的名称。
在General中的Primary Key的checkbox就是选为主键的地方了。
在DataType中就能设定具体的数据类型,比如VARCHAR2,NUMBER等。
8、关于索引和约束的建立右键在Entity上,选择Key Group就能新建约束了9、在Attribute中选择Datatype就能在Validate中选择这个column相关的约束,在Default中选择这个column的默认值了10、关于Domains的概念Domain的概念在Sql server中是支持的,可以在脚本的最开始就定义一堆的Domain,然后在其后的脚本中都引用相关的域名,而不用直接原始的数据类型了。
【聚杰网Oracle开发】ERwin相关概念快速入门适用于对ERwin初学者使用1、如果只做文档,可以选择只建立logical view2、如果是做项目,需要同时使用Logical view 和physical view3、一般Logical view是用于做文档的,而physical view是用于生成或者导出脚本的4、表之间的三种连接线,第一种用于把表1中的主键插入到表2中的外键,且插入的作为表2的主键第二种用于多对多,很少用到第一种用于把表1中的主键插入到表2中的外键,且插入的不作为表2的主键5、Logical中的和physical中对应的表的名称可以不一样,一般在physical中的表的名称用英文名称在Logical中的表的名称则无所谓,如果需要可以用中文6、在Physical view中的Tools中的[Forward Engineer/Schema Generation]中在右侧的表中用对勾可以选择需要操作的项目点击【preview】可以看到脚本,可以复制过来改改就能是脚本了点击【report】可以直接导出脚本点击【Generate】则可以直接连接到数据库,把相关的Scheme都建立起来7、在Logical view的一个Entity上右键点击,选择attributes,就进入了给表加入column 的界面了在General中选择一种基本类型(Domain)比如string后,就能加入一个名称了,Attribute name就是Logical view中的名字Column name就是用于生成脚本的名称。
在General中的Primary Key的checkbox就是选为主键的地方了。
在DataType中就能设定具体的数据类型,比如VARCHAR2,NUMBER等。
8、关于索引和约束的建立右键在Entity上,选择Key Group就能新建约束了9、在Attribute中选择Datatype就能在Validate中选择这个column相关的约束,在Default中选择这个column的默认值了10、关于Domains的概念Domain的概念在Sql server中是支持的,可以在脚本的最开始就定义一堆的Domain,然后在其后的脚本中都引用相关的域名,而不用直接原始的数据类型了。
Erwin 的使用:一、正向工程1、新建文件,如图1所示:图1(1) Logical :只创建逻辑模型 (2) Physical :只创建物理模型(3) Logical/ Physical :二者均可创建2、假设创建逻辑模型,可选择Logical ,如图2所示:图2常用的有以下几种::用于移动;绘图区工具栏:用于创建实体。
:用于“Complete sub-category ”:用于连接。
“Identifying relationship ”,即为标值关系。
注意:先点的为被引用的表,后点的为引用的表。
:用于多对多连接。
“Many-to-many relationship ” 注意:先点的为被引用的表,后点的为引用的表。
:用于连接。
“Non- identifying relationship ”,即为非标值关系。
注意:先点的为被引用的表,后点的为引用的表。
如创建学生信息表,点击,在绘图区一点,便如图3所示:图3注:单击“表名”位置可输入表名;一次回车或点击“主关键字”位置可输入或连续输入主关键字;连续两次回车“主关键字”位置可输入非主属性;“非主属性”位置同理。
如图4所示:图4表名主关键字非主属性还可双击“学生”或“课程表”实体,调出如图5所示:图5 (a )图5 (b )3、建立连接学生与课程之间为多对多关系;学生与班级之间为一对多关系。
应选择使用连接符,如图6所示。
图6可通过双击改变其性质。
如图7所示:主关键字类型类型约束 默认值一对多一对多强制关系,图7一、正向工程1、新建逻辑图:new->logical->ok 完成ER图的建立。
2、编辑命名标准并使用(1)tools->names->edit names standards->glossary 输入词对照表并存盘(2)tools->names->mode names options->use file找到刚存盘的文件再存盘3、驱动新模型:tools->derive new model->选择“database” ->下一步->下一步->出现了三个复选按钮“□”,全选中,单击“完成”4、将上述所建表放入数据库中:tools->Forward Engineer(第一项) ->preview 可查看命令Generate可完成将表连接到库中(输入库名及IP地址,连接,OK)说明:库名必须已经存在。
Erwin操作说明
域操作
1、鼠标右击“Domains”,选择“New”
2、点击新建的“域名”,点击鼠标右键,选中“属性”
3、在Logical模式下,选择General下的Name Inherited by Column,输入中文名称,如“步
骤”
4、在Logical模式下选择“Rename”,将名字修改为刚刚输入的中文名称,即“步骤”
5、在Physical模式下的General下的Name Inherited by Column,输入英文名字,即“FStep”
6、在Physical模式下Comment下的Comment Inherited by Col,输入注释,该注释将和数据
库中的字段的注释一致
7、在Physical模式下选择“Rename”,将名字修改为刚刚输入的中文名称,即“步骤”
表操作
1、Logical模式下,鼠标右击“Entities”,选择“New”
2、Logical模式下,选择新建的表,点击鼠标右键,选中“属性”
3、编辑Name,修改表名,如“测试表”
4、在Physical模式下选择新建的表,点击鼠标右键,选中“属性”编辑Name,修改表名,
如“TBL_TEST”,该名字与建的表名保持一致
主题模块
鼠标右击“Subject Areas”,选择“New”即可
显示设定
鼠标右击主题区域相关的Stored_Display,选择属性,然后在“Logical”和“Physical”相关选项中进行设定即可。
目录1.通过Erwin建立er1文件 (1)2用ERWin的方法将ERWin中的表导入到数据库中 (5)3用ERWin的方法将数据库表结构导入到ERWin中 (16)Erwin数据库设计工具介绍数据库设计错误将会导致在很长一段时间内不断听到各种抱怨,因此,选择一个适合的数据库开发工具对数据环境进行规范将非常重要 .Erwin在物理数据库的生成和反向生成、双向同步和比较功能方面居领先地位 ,可以进行逆向工程、能够自动生成文档、支持与数据库同步、支持团队式开发,所支持的数据库多达20多种。
Erwin数据库设计工具可以用于设计生成客户机/ 服务器、Web、Intranet和数据仓库等应用程序数据库。
1.通过Erwin建立er1文件在开始\程序菜单中打开Erwin,在Erwin主窗口中单击create model图标弹出如下窗口:在new model type选项中选择physical项,在database中选择oracle类型,version中选择9.x版本,如下图:点击ok按钮.1.1建表单击independent table控件图标,在页面上点击如下图:单击E_1处可以修改表名:选中此表点击右键选择columns如下图:单击new按钮增加字段如下图:选择字段类型为string型,字段名称为name如下图:单击ok按钮,如下图:在oracle选项卡中设置好字段的相关属性,单击ok按钮如下图,根据以上方法,增加相关字段.这样我们就建好了一个表,保存就会生成er1文件.2通过ERWin将表导入到数据库中导入方法如下:进入REWin,打开要往oracle中导入表的er1文件如下图:Connection,用户名的口令(如qts)、Connect String指连接的数据库名称及机器名(如qts_wangchao)。
选中要导入的数据表,点鼠标右键,选中columns,如下图选中DB Sync 按钮,出现下图选中Next 按钮,出现下图选中Next 按钮,出现下图选中Next 按钮,出现下图选中Next 按钮,出现下图过一会儿,出现下图显示当前选中的数据表与要导入的数据库中的数据库表进行比较。
Getting Started with ER win (Erwin入门)by Dr. Peter WolcottDepartment of Information Systems and Quantitative AnalysisCollege of Information Science and TechnologyUniversity of Nebraska at Omaha(由内布拉斯加州的奥马哈大学信息科学与技术学院门的信息系统和定量分析博士彼得著)Introduction (介绍)ER win is a popular data modeling tool used by a number of major companies in Omaha and throughout the world. (Erwin是受奥马哈和世界各地的一些主要的公司欢迎的数据模型工具) The product is currently owned, developed, and marketed by Computer Associates, a leading software developer.(该产品是由具有领导地位的CA软件开发公司拥有、开发和销售) The product supports a variety of aspects of database design, including data modeling, forward engineering (the creation of a database schema and physical database on the basis of a data model), and reverse engineering (the creation of a data model on the basis of an existing database) for a wide variety of relational DBMS, including Microsoft Access, Oracle, DB2, Sybase, and others.该软件为多种多样的关系型数据库管理系统,包括Microsoft Access,甲骨文,Sybase,DB2,和其他人提供支持数据库设计的各个方面,包括数据建模、正向工程(在现有的数据模型的基础上创建数据模式和物理数据库)和逆向工程(在现在的数据库基础上创建数据模型)This brief tutorial steps you through the process of creating a data model using ER win.(你可以通过这个简单教程中的步骤运用Erwin来创建数据模型) It will not explain all aspects of ERwin, but will show you the minimum necessary to create and use data models for this class. (这个课程不可能全面地讲解Erwin,但它向你展示了必要的最基本的创建和使用数据模型的知识) It consists of three major segments, which correspond to the project-related assignments in your class: (这个课程由三个主要部分组成,它与有关项目任务相符)1.Creation of a basic data model (Conceptual data model) 创建一个基本的数据模型(概念数据模型)2.Creation of a database schema 建立数据库模式3.Creation of the database创建数据库This tutorial is a static one, suitable for printing.本教程是一个静态的,适合印刷A tutorial using screen captures and narration is also available. 一个指南使用屏幕捕捉和叙述是可用的。
Section 1. Creation of a basic data modelYou will be creating a data model similar to that created for the Heartland Properties case study used in class.教程中你将创建一个和研究心脏地带个案相似的数据模型 The Entities involved in this model include: Employee, Office, Property, and Inspection. 参与本次的实体模型包括:员工、办公、财产、及检验。
First, invoke ER win from Start->Programs->Computer Associates->All Fusion-> ERwin Data Modeler-> Erwin首先,从开始——程序——CA——所有程序——ERwin Data ModelerYou will first encounter a dialog box entitled "ModelMart Connection Manager"(经理ModelMart连接). Simply click on Cancel.将首先遇到一个对话框题为“ModelMart Connection Manager”。
只需点击“取消”。
You will be asked to choose between creating a new model, and opening an existing model, as shown in Figure 1你将被要求之间作出选择,创造了一种新的模式,开放一个现有的模型,如图1所示. For this exercise, create a new model.通过这个练习,创建一个新的模型Figure 1: Create a new modelThe next dialog box, shown in Figure 2, will ask you to choose the template to be used to create the new model. 下一个对话框,如图2所示,会让你选择的模板可以被用来创造新的模型 At this point, you may associate the model with a target DBMS product, such as Microsoft Access, Oracle, DB2, etc.在这一点上,你可以把这个模型与如Microsoft Access,甲骨文,DB2等目标数据库产品联系在一起 You will have the opportunity to change this choice later, but for now choose Microsoft Access. 你之后将有机会改变这种选择,但是现在选择Microsoft Access。
Also, choose Logical/Physical as the new model type.同时,选择的逻辑或者物理作为新模型形式 This choice will allow us to switch back and forth easily between a logical model (ER Diagram) and a physical model (database schema). 这个选择将让我们轻易之间来回切换逻辑模型(ER图)和物理模型(资料库)Figure 2: Selecting a model typeERwin will now display the main window from which most of your ER diagram development will be done, as shown in Figure 3. ERwin现在将显示在主窗口大部分你ER图发展来完成,如图3。
Figure 3: The ERwin Workplace ERwin工作场所The ERwin workplace consists of two main parts. On the left is the Model Navigator, which displays a hierarchy of items of importance, such as entities, domains, and subject areas. 左面是模型的领航员,显示某一层次的物品的重要性,如实体、领域和课题。
On the right is the Display Window, which will show the ER diagram itself. 右边是显示窗口,它能够显示ER图本身 As you create objects, they will appear in the display window (if they are visual in nature, like entities), and appear in the hierarchy within the Model Navigator.当你创建对象时,他们将会出现在显示器窗口(如果它们是视觉的自然属性,就像实体),并将出现在层级模型导航器。
Setting Preferences 偏好设置A tool like ER win can accomodate a number of data modeling notations and conventions. 像ER这样工具可以容纳大量的数据建模的符号和对话 In myclass please make the following changes to the preferences before you begin to create your model在我的课上请完成下面的改变的偏好,在你开始之前,创造你的模型:1.From the Format->Entity Display menu, make sure that Primary KeyDesignator is checked从格式- >实体显示菜单,确保主键栏进行检查2.From the Format->Entity Display menu, make sure that Foreign KeyDesignator (FK) is un checked.从格式- >实体显示菜单,确保外国关键指示器(FK)是不能检查3.From the Format->Entity Display menu, make sure that Show MigratedAttributes is un checked.从格式- >实体显示菜单,确保显示属性迁移到un checked4.From the Format->Relationship Display, make sure that Verb Phraseis checked. 从格式- >关系显示、确保动词短语进行检查In addition, you may choose between two different E-R diagramming notations. 另外,你可以选择两种不同的e - r种画图符号In ERwin, click on Model->Model Properties to see the window shown in Figure 3b:点击模型- >窗口模型属性看到如图3b.Figure 3b: Choice of notationThis tutorial is based on the Information Engineering ("Crows Foot") notation. You may also use IDEF1X, if you wish.本教程是基于信息工程(“乌鸦脚”)的符号。