PL/SQL 导出表结构

  1. 工具栏上方选择Tools(工具)--> Export User Objects(导出用户对象)


    工具栏
  2. 选择要导出的表,可多选,也可选择序列


    PL/SQL 导出表结构_第1张图片
    选择表
  3. 对下方的配置进行选择
    • 设置输出路径
    • 可以选择全部导出到一个文件或每个表分别导出一个文件
    • 如果勾选包括所有者的话,导出的表名前会加用户名,在向其他库导入的时候记得更改
PL/SQL 导出表结构_第2张图片
配置选择
  1. 导出文件大概这样,其中的CASEPROGRAM就是用户名,在向新服务器导入的时候记得修改。
prompt
prompt Creating table COMMODITY
prompt ========================
prompt
create table CASEPROGRAM.COMMODITY
(
  commodity_id    NUMBER(6) not null,
  commodity_name  VARCHAR2(100) not null,
  sell_price      NUMBER(8,2) not null,
  units           VARCHAR2(10) not null,
  stock_price     NUMBER(8,2) not null,
  security_number NUMBER(5) not null,
  buying_unit     VARCHAR2(10) not null,
  supplier_id     NUMBER(4) not null,
  on_number       NUMBER(6) not null
)
tablespace SYSTEM
  pctfree 10
  pctused 40
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
alter table CASEPROGRAM.COMMODITY
  add constraint COMMODITY_COMMODITY_ID_PK primary key (COMMODITY_ID)
  using index 
  tablespace SYSTEM
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
alter table CASEPROGRAM.COMMODITY
  add constraint COMMODITY_SUPPLIER_ID_FK foreign key (SUPPLIER_ID)
  references CASEPROGRAM.SUPPLIER (SUPPLIER_ID);
  1. 连接新服务器,执行刚才导出的SQL即可。

你可能感兴趣的:(PL/SQL 导出表结构)