完整的建表语句

-- Create table
create table ALERT
(
  ID              VARCHAR2(32) not null,
  FTIME           VARCHAR2(64),
  LTIME           VARCHAR2(64),
  CTIME           VARCHAR2(64),
  CREASON         VARCHAR2(256),
  CONTENT         VARCHAR2(4000),
  CATE            NUMBER(2),
  TYPE            NUMBER(2),
  LEV             NUMBER(2),
  STATUS          NUMBER(2),
  SOURCE          VARCHAR2(32),
  SOURCEIP        VARCHAR2(32),
  AREA_CODE       VARCHAR2(16),
  BUSINESSID      VARCHAR2(16),
  BUSINESSNAME    VARCHAR2(32),
  RESOURCEID      VARCHAR2(64),
  RESOURCENAME    VARCHAR2(64),
  CLASSNAME       VARCHAR2(64),
  SUBRESOURCEID   VARCHAR2(64),
  SUBRESOURCENAME VARCHAR2(64),
  SUBCLASSNAME    VARCHAR2(64),
  KPI             VARCHAR2(16),
  HANDLENAME      VARCHAR2(16),
  FZRULEID        VARCHAR2(16),
  YWRULEID        VARCHAR2(16),
  COMES           VARCHAR2(32)
)
tablespace PERFDATA
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64
    next 1
    minextents 1
    maxextents unlimited
  );
-- Add comments to the columns 
comment on column ALERT.ID
  is '告警ID';
comment on column ALERT.FTIME
  is '首次发生时间';
comment on column ALERT.LTIME
  is '最后发生时间';
comment on column ALERT.CTIME
  is '关闭时间';
comment on column ALERT.CREASON
  is '关闭原因';
comment on column ALERT.CONTENT
  is '告警内容';
comment on column ALERT.CATE
  is '告警分类';
comment on column ALERT.TYPE
  is '告警类型';
comment on column ALERT.LEV
  is '告警等级';
comment on column ALERT.STATUS
  is '告警处理状态';
comment on column ALERT.SOURCE
  is '告警来源';
comment on column ALERT.SOURCEIP
  is '告警来源IP';
comment on column ALERT.AREA_CODE
  is '地域ID';
comment on column ALERT.BUSINESSID
  is '业务系统ID';
comment on column ALERT.BUSINESSNAME
  is '业务系统名称';
comment on column ALERT.RESOURCEID
  is '资源ID';
comment on column ALERT.RESOURCENAME
  is '资源名称';
comment on column ALERT.CLASSNAME
  is '资源类型';
comment on column ALERT.SUBRESOURCEID
  is '子资源ID';
comment on column ALERT.SUBRESOURCENAME
  is '子资源名称';
comment on column ALERT.SUBCLASSNAME
  is '子资源类型';
comment on column ALERT.KPI
  is '告警KPI ID';
comment on column ALERT.HANDLENAME
  is '处理人';
comment on column ALERT.FZRULEID
  is '阀值规则ID';
comment on column ALERT.YWRULEID
  is '业务规则ID';
comment on column ALERT.COMES
  is '告警出处';
-- Create/Recreate primary, unique and foreign key constraints 
alter table ALERT
  add constraint PK_ALERT primary key (ID)
  using index 
  tablespace PERFDATA
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Grant/Revoke object privileges 
grant select, insert, update, delete, references, alter, index on ALERT to DICTDBA;
grant select, insert, update, delete, references, alter, index on ALERT to REPORTDBA;
grant select, insert, update, delete, references, alter, index on ALERT to RESOURCEDBA;
grant select, insert, update, delete, references, alter, index on ALERT to STATDBA;
grant select, insert, update, delete, references, alter, index on ALERT to WEBDBA;

你可能感兴趣的:(完整的建表语句)