国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > Oracle > 正文

八個學習點幫助你全面認識Oracle數據庫

2024-08-29 13:33:18
字體:
來源:轉載
供稿:網友
TableSpace     表空間: 一個表空間對應多個數據文件(物理的dbf文件) 用語法方式創建tablespace,用sysdba登陸: --創建表空間mytabs,大小為10MB:
create tablespace mytabs datafile 'C:/Oracle/oradata/mydb/mytabs1.dbf' size 10M;alter user zgl default tablespace mytabs;--把tabs做為zgl的默認表空間。grant unlimited tablespace to zgl; --將操作表空間的權限給zgl。
Exception 示例:
create or replace PRocedurepro_test_exception(vid in varchar2) isuserName varchar2(30);beginselect name into userName from t_user where id=vid;dbms_output.put_line(userName);exceptionwhen no_data_found thendbms_output.put_line('沒有查到數據!');when too_many_rows thendbms_output.put_line('返回了多行數據!'); end pro_test_exception;
安全治理     以下語句以sysdba登陸: 用戶授權: alter user zgl account lock;--鎖定帳號。 alter user zgl identified by zgl11;--修改用戶密碼。 alter user zgl account unlock;--解除帳號鎖定。 alter user zgl default tablespace tt;--修改用戶zgl的默認表空間為tt。 create user QQq identified by qqq123 default tablespace tt;--創建用戶。 grant connect to qqq;--給qqq授予connect權限。 grant execute on zgl.proc01 to test;--將過程zgl.proc01授予用戶test。 grant create user to zgl;--給zgl授予創建用戶的權限。 revoke create user from zgl;--解除zgl創建用戶的權限。 角色授權: create role myrole;--創建角色myrole grant connect to myrole;--給myrole授予connect權限 grant select on zgl.t_user to myrole;--把查詢zgl.t_user的權限授予myrole grant myrole to test;--把角色myrole授予test用戶 概要文件(配置文件): 全局設置,可以在概要文件中設置登陸次數,如超過這次數就鎖定用戶。  Synonym 創建同義詞示例:
create public synonym xxx for myuser.t_usercreate synonym t_user for myuser.t_user select * from dba_synonyms where table_name='T_USER'
跨數據庫查詢
create database link dblinkzgl connect to myuser identified by a using 'mydb' Select * From t_user@dblinkzgl
course示例 示例1:
create or replace procedure pro_test_cursor isuserRow t_user%rowtype;cursor userRows isselect * from t_user;beginfor userRow in userRows loopdbms_output.put_line(userRow.Id','userRow.Name','userRows%rowcount);end loop; end pro_test_cursor;
示例2:

create or replace procedure pro_test_cursor_oNerow(vid in number) isuserRow t_user%rowtype;cursor userCur isselect * from t_user where id=vid;beginopen userCur;fetch userCur into userRow;if userCur%FOUND thendbms_output.put_line(userRow.id','userRow.Name);end if;close userCur; end pro_test_cursor_oneRow;
record示例
create or replace procedure pro_test_record(vid in varchar2) istype userRow is record(id t_user.id%type,name t_user.name%type);realRow userRow;beginselect id,name into realRow from t_user where id=vid;dbms_output.put_line(realRow.id','realRow.name); end pro_test_record;
rowtype示例
create or replace procedure pro_test_rowType(vid in varchar2) isuserRow t_user%Rowtype;beginselect * into userRow from t_user where id=vid;dbms_output.put_line(userRow.id','userRow.name); end pro_test_rowType;


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 延川县| 中西区| 鄢陵县| 富裕县| 深水埗区| 乌海市| 汉沽区| 龙州县| 仁寿县| 蒙阴县| 睢宁县| 鹤庆县| 江口县| 深圳市| 青海省| 平阳县| 清徐县| 东阳市| 翁源县| 泗水县| 枝江市| 万盛区| 巴中市| 新野县| 原阳县| 岳阳县| 将乐县| 锡林郭勒盟| 长治县| 渝中区| 大理市| 进贤县| 浑源县| 永定县| 织金县| 克拉玛依市| 盖州市| 莫力| 遂溪县| 福建省| 通辽市|