继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

Oracle创建用户和表空间

哎_梦
关注TA
已关注
手记 6
粉丝 0
获赞 3


  1. 在system下创建表空间:

    create tablespace CASETABLE
    datafile 'D:\app\CASETABLE.dbf' size 1024M --存储地址 初始大小1G
    autoextend on next 1024M maxsize unlimited   --每次扩展1G,无限制扩展
    EXTENT MANAGEMENT local  autoallocate
    segment space management auto;

  2. 在system下创建用户

    -- 创建用户
      create user ONECASE
      default tablespace CASETABLE
      temporary tablespace TEMP
      IDENTIFIED BY 123
      profile DEFAULT;

    -- 给用户授权
    -- Grant/Revoke role privileges
      grant connect to ONECASE;
      grant dba to ONECASE;
    -- Grant/Revoke system privileges
       grant create database link to ONECASE;
       grant unlimited tablespace to ONECASE;

  3. 在ONECASE用户下创建用户信息表

    -- Create table
    create table case_user
    (
      username VARCHAR2(32) not null,
      password  VARCHAR2(32) not null
    )
    tablespace CASETABLE
      pctfree 10
      initrans 1
      maxtrans 255
      storage
      (
        initial 64
        next 1
        minextents 1
        maxextents unlimited
      );
    -- Add comments to the table
    comment on table case_user
      is '用户登入信息表';
    -- Add comments to the columns
    comment on column case_user.username
      is '用户名';
    comment on column case_user.password
      is '密码';
    -- Create/Recreate primary, unique and foreign key constraints
    alter table case_user
      add constraint PK_LAS_CAMERABARCODE primary key (username)
      using index
      tablespace CASETABLE
      pctfree 10
      initrans 2
      maxtrans 255
      storage
      (
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
      );

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP