Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选

首页 / 数据库 / MySQL / Oracle数据库实验应用

授权:
  1. create user tempUser identified by sa   
  2. default tablespace users  
  3.  temporary tablespace temp quota unlimited on users;  
  4.   
  5. create profile tempprofile LIMIT  
  6. SESSIONS_PER_USER 3  
  7. CPU_PER_CALL 2000  
  8. IDLE_TIME 15  
  9. LOGICAL_READS_PER_CALL 200  
  10. FAILED_LOGIN_ATTEMPTS 2;  
  11.   
  12. --为用户指定配置文件   
  13.   
  14. alter user tempUser profile tempprofile;  
  15.   
  16. --为用户授的权限   
  17.   
  18. grant create session to tempUser;  
  19.   
  20. grant select on student to tempUser;  
  21.   
  22. connect tempUser/sa;  
  23.   
  24.   
  25. --撤销用户权限   
  26. revoke select on system.student from tempUser;  
  27.   
  28. revoke create session from tempUser;  
  29.   
  30.    
  31.    
视图:
  1. create or replace view Student_Math as   
  2. select * from student   
  3. where sclass in (  
  4. select c.name from class c ,department d   
  5. where c.department=d.did  
  6. and d.DNAME="数学系")  
  7. with check opition;  
  8. )  
  9.   
  10.   
  11. create or replace view department_Class as select d.dnam,c,cname  
  12. from class c,department d  
  13. where c.department=d.did;  
  14.   
  15. select text from user_views where view_name=UPPER"Student_Math");  
序列:
  1. drop table sequence_table ;  
  2. create table sequence_table(  
  3. id number,  
  4. op varchar2(20)  
  5. )  
  6. /  
  7.   
  8. drop sequence Incr_id;  
  9. create sequence Incr_id  
  10. start with 100  
  11. increment by 1  
  12. nomaxvalue  
  13. nocycle  
  14. order;  
  15. /  
  16.   
  17.  create or replace trigger Incr_trigger  
  18. before insert on sequence_table  
  19. for each row  
  20. declare   
  21. next_no number;  
  22. begin   
  23. select Incr_id.nextval  
  24. into next_no  
  25. from dual;  
  26. :NEW.ID :=next_no ;  
  27. end;  
  28. /  
  29.   
  30. --test   
  31.   
  32. insert into sequence_table(op) values"INSERT");  
  33.   
  34. select * from sequence_table;  
  35.   
  36. --查看序列状态   
  37.   
  38. select * from user_sequences where sequence_name=UPPER"Incr_id");  
事物:
  1. --事物的隔离级别为 read committed   
  2. set transaction isolation level read committed;  
  3.   
  4. select sname from student;  
  5. --要是不提交就会报上一个事物还没有处理   
  6. commit;  
  7.   
  8. --Serializable   
  9. set transaction isolation level serializable;  
  10.   
  11. select sname,age from student;  
  12.   
  13. update student set age=23  
  14. where sname="李小龙";  
  15. --rollback;   
  16. rollback;  
  17. select sname,age from student;  
  18.   
  19. --savepoint section 存储点  
  • 1
  • 2
  • 下一页
Oracle 中的自动增长字段Oracle 9i以上的闪存相关资讯      oracle数据库教程 
  • Oracle raw数据类型介绍  (01/29/2013 10:05:53)
  • 监听器注册与ORA-12514 错误分析  (11/13/2012 14:30:08)
  • Oracle SQL的cursor理解  (11/13/2012 14:16:17)
  • Oracle 如何强制刷新Buffer Cache  (01/29/2013 10:02:46)
  • dblink致Oracle库的SCN变成两库的  (11/13/2012 14:24:41)
  • Linux操作系统下完全删除Oracle数  (11/13/2012 08:25:52)
本文评论 查看全部评论 (0)
表情: 姓名: 字数