<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)  編輯  收藏

    主站蜘蛛池模板: 两个人www免费高清视频| 国产成人无码免费看片软件| av免费不卡国产观看| 久久精品视频亚洲| 国产情侣久久久久aⅴ免费| 亚洲爆乳精品无码一区二区三区 | 国产亚洲一区二区手机在线观看| 一级毛片在线免费视频| 亚洲国产主播精品极品网红| 一级毛片不卡免费看老司机| 亚洲一区爱区精品无码| 中文字幕久精品免费视频| 亚洲一区二区成人| 啦啦啦高清视频在线观看免费 | 91视频免费观看| 亚洲精品无码精品mV在线观看| 国产猛男猛女超爽免费视频| 亚洲精品自产拍在线观看动漫| 久久不见久久见免费视频7| 国产成人精品日本亚洲网址| 日本免费人成黄页在线观看视频| 免费看美女午夜大片| 亚洲av永久无码精品国产精品| 18禁无遮挡无码国产免费网站| 亚洲熟伦熟女专区hd高清| 国产男女猛烈无遮档免费视频网站| 一区免费在线观看| 亚洲五月六月丁香激情| 女人张开腿给人桶免费视频| yellow视频免费看| 亚洲视频在线观看网址| 成年女人毛片免费播放视频m| 一级**爱片免费视频| 亚洲视频2020| 波多野结衣免费视频观看 | 日韩精品福利片午夜免费观着| 爱情岛亚洲论坛在线观看 | 免费国产a国产片高清| 久久精品乱子伦免费| 国产亚洲精aa在线看| 久久久久亚洲AV无码专区桃色|