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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle基本笔记整理及案例分析1

發布時間:2023/12/3 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle基本笔记整理及案例分析1 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/* Oracle數據庫的應用 */--創建一個自動增長的表空間worktbs create tablespace worktbs datafile 'E:\E盤\worktbs01.dbf' size 10M autoextend on;--刪除表空間 --drop tablespace worktbs;--在表空間里面創建一個新用戶 create user martin --用戶名 identified by martin --密碼 default tablespace worktbs --默認表空間 temporary tablespace temp --臨時表空間 grant all privileges to martin; --修改martin用戶的密碼為mpwd --alter user martin identified by mpwd;--刪除用戶martin --drop user martin cascade;--給用戶授權權限 grant connect,resource to martin; --給用戶撤銷角色 revoke connect,resource from martin; --允許用戶查看emp中的表 grant select on scott.emp to martin; --允許用戶更新emp中的表 grant update on scott.emp to martin;/* 序列 */ --創建序列 create sequence seql --序列名字 start with 1 --從1開始 increment by 1 --每次加1 maxvalue 2000 --最大為2000 nocycle --不循環,循環的話是cycle cache 30 --緩沖30個序列號 select sys_guid() from dual; /* 訪問序列 nextval 每次返回下一個值 序列名.nextval (seql.nextcval) currval 每次返回當前的值 序列名.currval (swql.currval) */--更改序列(注:不能修改序列中的參數 strat with) /*alter sequence seql increment by 2 --每次增長2 maxvalue 30000 --最大值是30000 minvalue 20 --最小值是20 cycle --重復 */--刪除序列 --drop sequence seql--使用sys_guid來生成32位唯一編碼的數字 select sys_guid() from dual;/* 同義詞 */ --私有同義詞 --獲得訪問scott模式下的emp表(創建同義詞) create synonym sy_emp for scott.dept; --訪問同義詞 select * from sy_emp; --公有同義詞 --在test模式下對員工表employee創建公有的同義詞(public_sy_emp) --目的是使用某個用戶直接訪問該表 create public synonym public_sy_emp for test.employee; --訪問該公有同義詞 select * from public_sy_emp;--刪除同義詞 --drop [public] synonym 同義詞名字 /* 索引 */ --創建索引 --create [unique(是否為唯一索引)] index_name on table_name (列名) [表空間]--在employee里面為員工編號empno列創建反向索引 --create index index_reverse_empno on employee(empno) reverse;--位圖索引 --在employee里面,為job列創建位圖索引 --create bitmap index index_bit_job --索引名 --on employee(job);--其他索引 --在employee表中,為員工名稱ename列創建大寫函數索引 --create index index_ename on employee (upper(ename));/* ===========================================================================================分割線 =========================================================================================== */ --創建表空間 create tablespace tablespaces datafile 'E:\E盤\第三期\Y2內容\1.oracle內容\第一本書使用Hibernate開發租房系統\第二章oracle數據庫應用\tablespaces.dbf' size 4M; autoextend on; --或者on可不可以自動擴充--擴展表空間,前提是已經存在了此空間 --1.更改數據庫 alter database datafile 'E:\E盤\tablespaces.dbf' resize=8M;--2.增加一個可擴展的數據庫文件 alter database add datafile 'E:\E盤\tablespace2.dbf' autoextend on;--刪除表空間(包括和他相關的全部刪掉) --drop tablespace tablespaces include contents ;--創建用戶 create user username identified by 123 default tablespace tablespaces --指定表空間--刪除表空間 drop user username;--權限 grant connect,resouce to martin; grant create public synonym to username; --給用戶一個創建公有同義詞的權限/*1.system授權grant create public synonym to username; 2.在username里面創建同義詞 3.在username給目標用戶授權(select)*/ --創建同義詞 create or replace public synonym public_toys for scott.emp;

總結

以上是生活随笔為你收集整理的oracle基本笔记整理及案例分析1的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。