<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    數據加載中……
    Oracle創建數據表空間,用戶,授權,表,索引,簇(2008-07-26 22:38:59)

    //創建臨時表空間(日志文件)
    create temporary tablespace test_temp
    tempfile 'E:\oracle\test_temp01.dbf'
    size 32m
    autoextend on
    next 32m maxsize 2048m
    extent management local;

    //創建數據表空間
    create tablespace test_data
    logging
    datafile 'E:\oracle\test_data01.dbf'
    size 32m
    autoextend on
    next 32m maxsize 2048m
    extent management local;

    //創建用戶并指定表空間
    create user 用戶名 identified by 密碼
    default tablespace test_data
    temporary tablespace test_temp;

    //給用戶授予權限

    grant connect,resource to 用戶名

    ————————————————————————————————————

    create cluster s_t_cluster(tid number(8));--創建索引簇
    ----------------------------------------------------1
    --建立簇表stu
    create table stu(
           tid number(8),
           sname varchar2(50),
           sinfo varchar2(50),
           constraint pk_tid primary key(tid)
    )cluster s_t_cluster(tid)
    --建立簇表sc
    create table sc(
           tid number(8),
           score number(8),
           constraint fk_tid foreign key(tid) references stu(tid)
    )cluster s_t_cluster(tid)
    ------------------------------------------------------2
    --建立簇索引
    create index s_t_idx on cluster s_t_cluster;
    ------------------------------------------------------3
    --插入數據
    insert into stu(tid,sname,sinfo)values(1,'haha','usa');
    insert into stu(tid,sname,sinfo)values(2,'gaga','Japan');
    insert into sc values(1,90);
    insert into sc values(2,85);
    --查詢
    select s.sname,s.sinfo,i.score from stu s,sc i where s.tid=i.tid
    --建立序列
    create sequence stu_SEQ
    minvalue 1
    maxvalue 99999999
    start with 3
    increment by 1
    cache 20;

    --用命令插入N條數據往表stu
    declare
    x number;
    begin
      for x in 1..100000 loop
        insert into stu values(stu_seq.nextval,'名字'||x,'地址'||x);
      end loop;
    end;
    ---------------------------------------------
    --用命令插入N條數據往表sc
    declare
    x number;
    begin
      for x in 1..10000 loop
        insert into sc values(sc_seq.nextval,x+50);
      end loop;
    end;
    ---------------------------------------------
    --查詢
    select s.sname,s.sinfo,i.score from stu s,sc i where s.tid=i.tid--未加索引時的普通查詢太慢了
    --使用索引簇查詢
    select s.sname,s.sinfo,i.score from stu s,sc i where s.tid=i.tid

    ————————————————————————————————————————

    //創建表,序列號(sequence)

    create table test1(
           tid number(8),
           tname varchar2(50),
           tbd date,
           constraint pk_tid primary key(tid)
    )
    select * from test1
    ==============================================================
    create sequence test1Seq --自定義的序列名
    increment by 1           --每次加幾個,即遞增的間隔
    start with 1             --從1開始計數
    nomaxvalue               --不設置最大值
    nocycle                  --一直累加,不循環
    cache 10;
    ==============================================================
    insert into test1(tid,tname,tbd)values(test1Seq.Nextval,'ccc',sysdate);

    posted on 2009-03-19 20:13 flyleer 閱讀(907) 評論(0)  編輯  收藏

    主站蜘蛛池模板: 久久精品国产亚洲av成人| 亚洲综合在线一区二区三区| 免费能直接在线观看黄的视频| 亚洲国产日韩在线成人蜜芽 | 亚洲欧洲精品视频在线观看| 日韩免费高清视频网站| 中文字幕看片在线a免费| 亚洲国产精品日韩在线| 2022中文字字幕久亚洲| 四虎精品视频在线永久免费观看| 精品国产日韩亚洲一区91| 亚洲精品免费视频| 亚洲v国产v天堂a无码久久| 中文字幕免费观看| 色屁屁www影院免费观看视频 | 在线精品自拍亚洲第一区| 亚洲AV无码专区在线播放中文| 在线免费观看a级片| 午夜免费福利视频| 免费的黄网站男人的天堂| 亚洲六月丁香六月婷婷蜜芽| 中文字幕亚洲一区| 免费看大黄高清网站视频在线| 男人j进入女人j内部免费网站| 老外毛片免费视频播放| 精品亚洲成A人无码成A在线观看| 亚洲精品蜜桃久久久久久| 日韩一区二区免费视频| 亚洲免费二区三区| 91视频免费观看| 一区二区三区视频免费| 亚洲依依成人亚洲社区| 亚洲第一页在线播放| 亚洲AV无码精品色午夜在线观看| 亚洲AV无码之日韩精品| 午夜免费福利影院| 成人免费视频69| 久久国产精品成人片免费| 在线观看免费播放av片| 精品国产福利尤物免费| 欧亚一级毛片免费看|