zoukankan      html  css  js  c++  java
  • 数据库用户的建立,表空间的建立,数据的编辑

    //表空间
    CREATE SMALLFILE TABLESPACE "ZUOYE" DATAFILE 'D:ORACLE11GORADATAORCLUOYE.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
    
    //表空间的空间修添加
    ALTER TABLESPACE "ZUOYE" ADD DATAFILE 'D:ORACLE11GORADATAORCLUOYE1.DBF' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED
    
    //创建用户
    -- Create the user 
    create user zuoye            //用户名
      identified by "123654789"        //密码
      default tablespace ZUOYE        //表空间
      temporary tablespace TEMP;        //临时表空间
    -- Grant/Revoke role privileges 
    grant connect to zuoye;            //授予connect权限
    grant dba to zuoye;            //授予dba权限
    
    //列的内容
    -- Create table
    create table T_HQ_ZYl
    (
      "bianh"   number not null,
      "xingm"   varchar2(10) not null,
      "xingb"   number default 1 not null,
      "nianl"   number not null,
      "jiatzz"  varchar2(50),
      "xins"    number default 0 not null,
      "gongzsj" number not null
    )
    ;
    
    //注释
    -- Add comments to the columns 
    comment on column T_HQ_ZYl."bianh"
      is '编号';
    comment on column T_HQ_ZYl."xingm"
      is '姓名';
    comment on column T_HQ_ZYl."xingb"
      is '性别:男-1;女-2;';
    comment on column T_HQ_ZYl."nianl"
      is '年龄';
    comment on column T_HQ_ZYl."jiatzz"
      is '家庭住址';
    comment on column T_HQ_ZYl."xins"
      is '薪水';
    comment on column T_HQ_ZYl."gongzsj"
      is '工作时间';
    
    //检查,约束
    -- Create/Recreate check constraints 
    alter table T_HQ_ZY
      add constraint CHECK_BIANH
      check (bianh != bianh);
    alter table T_HQ_ZY
      add constraint CHECK_NIANL
      check (nianl>20 and nianl<50);
    alter table T_HQ_ZY
      add constraint CHECK_XINGB
      check (xingb = 1 or xingb = 2);

    创建用户前需要先创建表空间。

    创建表空间时注意将表空间文件的后缀名添加上!比如:biaokongjian.DBF 。    .DBF  就是需要注意的文件后缀

  • 相关阅读:
    css 网格布局简单应用
    服务器常用状态码
    js 操作数组
    下拉框 tree 基于 EasyUi
    c# 导出Excel
    select 多选 (EasyUI)
    如何提高sql查询速度
    总结JS中string、math、array的常用的方法
    php 验证邮箱 php验证手机号码 ph验证身份证
    jquery+php ajax上传多图片即时显示
  • 原文地址:https://www.cnblogs.com/name-hanlin/p/4908925.html
Copyright © 2011-2022 走看看