日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

模拟业务最小测试用例01

發(fā)布時(shí)間:2025/3/21 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 模拟业务最小测试用例01 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

環(huán)境:RHEL6.4 + Oracle 11.2.0.4

  • 1.創(chuàng)建業(yè)務(wù)用戶表空間
  • 2.創(chuàng)建業(yè)務(wù)用戶
  • 3.賦予用戶權(quán)限
  • 4.創(chuàng)建業(yè)務(wù)表
  • 5.創(chuàng)建索引
  • 6.業(yè)務(wù)查詢SQL
  • 7.刪除業(yè)務(wù)用戶及數(shù)據(jù)
  • 8.刪除業(yè)務(wù)表空間

1.創(chuàng)建業(yè)務(wù)用戶表空間

  • 假設(shè)使用了OMF管理,不需要明確指定數(shù)據(jù)目錄(判定是否使用了OMF技術(shù),查看db_create_file_dest參數(shù)配置:show parameter db_create_file_dest)
-- 數(shù)據(jù)表空間 create tablespace dbs_d_jingyu datafile size 30M autoextend off; -- 臨時(shí)表空間 create temporary tablespace temp_jingyu tempfile size 30M autoextend off; -- 索引表空間(可選) create tablespace dbs_i_jingyu datafile size 30M autoextend off;
  • 假設(shè)文件系統(tǒng)管理,且未使用OMF管理,規(guī)劃的數(shù)據(jù)目錄是/oradata1
-- 數(shù)據(jù)表空間 create tablespace dbs_d_jingyu datafile '/oradata1/datafiles/dbs_d_jingyu01.dbf' size 30M autoextend off; -- 臨時(shí)表空間 create temporary tablespace temp_jingyu tempfile '/oradata1/tempfiles/temp_jingyu01.tmp' size 30M autoextend off; -- 索引表空間(可選) create tablespace dbs_i_jingyu datafile '/oradata1/datafiles/dbs_i_jingyu01.dbf' size 30M autoextend off;
  • 假設(shè)ASM磁盤組,指定磁盤組是+DATA,具體路徑OMF管理
-- 數(shù)據(jù)表空間 create tablespace dbs_d_jingyu datafile '+DATA' size 30M autoextend off; -- 臨時(shí)表空間 create temporary tablespace temp_jingyu tempfile '+DATA' size 30M autoextend off; -- 索引表空間(可選) create tablespace dbs_i_jingyu datafile '+DATA' size 30M autoextend off;

2.創(chuàng)建業(yè)務(wù)用戶

-- 假設(shè)創(chuàng)建用戶 jingyu 密碼 jingyu,默認(rèn)臨時(shí)表空間 temp_jingyu, 默認(rèn)數(shù)據(jù)表空間 dbs_d_jingyu。 CREATE USER jingyu IDENTIFIED BY jingyuTEMPORARY TABLESPACE temp_jingyuDEFAULT TABLESPACE dbs_d_jingyuQUOTA UNLIMITED ON dbs_d_jingyu;

3.賦予用戶權(quán)限

-- 賦予普通業(yè)務(wù)用戶權(quán)限 grant resource, connect to jingyu; -- 賦予DBA用戶權(quán)限 grant dba to jingyu;

4.創(chuàng)建業(yè)務(wù)表

新建業(yè)務(wù)用戶登錄,創(chuàng)建T1,T2兩張業(yè)務(wù)表,并插入測試數(shù)據(jù)。

-- 業(yè)務(wù)用戶登錄 conn jingyu/jingyu -- 刪除T1,T2兩張表 drop table t1 cascade constraints purge; drop table t2 cascade constraints purge; -- 創(chuàng)建T1,T2兩張表 create table t1( id number not null, n number, contents varchar2(4000) ) tablespace dbs_d_jingyu; create table t2( id number not null, t1_id number not null, n number, contents varchar2(4000) ) tablespace dbs_d_jingyu; -- 初始化向T1,T2表插入隨機(jī)測試數(shù)據(jù) execute dbms_random.seed(0); set timing on insert into t1 select rownum, rownum, dbms_random.string('a',50) from dual connect by level <= 100 order by dbms_random.random; commit; insert into t2 select rownum, rownum, rownum, dbms_random.string('b',50) from dual connect by level <= 100000 order by dbms_random.random; commit; -- 查詢T1,T2表數(shù)據(jù)量 select count(1) from t1; select count(1) from t2;

5.創(chuàng)建索引

-- 創(chuàng)建T1表字段n的索引idx_t1_n create index idx_t1_n on t1(n) tablespace dbs_i_jingyu; -- 創(chuàng)建T2表字段id的索引idx_t2_t1id create index idx_t2_t1id on t2(t1_id) tablespace dbs_i_jingyu;

6.業(yè)務(wù)查詢SQL

-- 業(yè)務(wù)查詢SQL 1 select * from t1, t2 where t1.id = t2.t1_id and t1.n = 19; -- 業(yè)務(wù)查詢SQL 2 select * from t1, t2 where t1.id = t2.t1_id;

7.刪除業(yè)務(wù)用戶及數(shù)據(jù)

-- 刪除業(yè)務(wù)用戶jingyu drop user jingyu cascade;

8.刪除業(yè)務(wù)表空間

-- 刪除數(shù)據(jù)表空間及其文件 drop tablespace dbs_d_jingyu including contents and datafiles; -- 刪除索引表空間及其文件 drop tablespace dbs_i_jingyu including contents and datafiles; -- 刪除臨時(shí)表空間及其文件 drop tablespace temp_jingyu including contents and datafiles;

總結(jié)

以上是生活随笔為你收集整理的模拟业务最小测试用例01的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。