Oracle Database lab Application

Source: Internet
Author: User

Authorization:

  1. Create UserTempUser identifiedBySa
  2. DefaultTablespace users
  3.  TemporaryTablespaceTempQuota unlimitedOnUsers;
  4. CreateProfile tempprofile LIMIT
  5. SESSIONS_PER_USER 3
  6. CPU _ per_call 2000
  7. IDLE_TIME 15
  8. LOGICAL_READS_PER_CALL 200
  9. FAILED_LOGIN_ATTEMPTS 2;
  10. -- Specify the configuration file for the user
  11. Alter UserTempUser profile tempprofile;
  12. -- Permissions granted to users
  13. Grant CreateSessionToTempUser;
  14. Grant Select OnStudentToTempUser;
  15. ConnectTempUser/sa;
  16. -- Revoke User Permissions
  17. Revoke Select OnSystem. studentFromTempUser;
  18. Revoke CreateSessionFromTempUser;

View:

  1. Create Or Replace ViewStudent_MathAs
  2. Select*FromStudent
  3. WhereSclassIn(
  4. SelectC.Name FromClass c, department d
  5. WhereC. department = d. did
  6. AndD. DNAME ='Department of mathematics')
  7. With CheckOpition;
  8. )
  9. Create Or Replace ViewDepartment_ClassAs SelectD. dna m, c, cname
  10. FromClass c, department d
  11. WhereC. department = d. did;
  12. SelectTextFromUser_viewsWhereView_name =UPPER('Student _ math');

Sequence:

  1. Drop TableSequence_table;
  2. Create TableSequence_table (
  3. Id number,
  4. Op varchar2 (20)
  5. )
  6. /
  7. Drop SequenceIncr_id;
  8. Create SequenceIncr_id
  9. StartWith100
  10. IncrementBy1
  11. Nomaxvalue
  12. Nocycle
  13. Order;
  14. /
  15.  Create Or Replace TriggerIncr_trigger
  16. BeforeInsert OnSequence_table
  17. ForEach row
  18. Declare
  19. Next_no number;
  20. Begin
  21. SelectIncr_id.nextval
  22. IntoNext_no
  23. FromDual;
  24. : NEW. ID: = next_no;
  25. End;
  26. /
  27. -- Test
  28. Insert IntoSequence_table (op)Values('Insert');
  29. Select*FromSequence_table;
  30. -- View the sequence status
  31. Select*FromUser_sequencesWhereSequence_name =UPPER('Incr _ id');
Things:
  1. -- The isolation level of a transaction is read committed.
  2. Set Transaction Isolation Level Read Committed;
  3. SelectSnameFromStudent;
  4. -- If it is not submitted, the previous transaction is not processed.
  5. Commit;
  6. -- Serializable
  7. Set Transaction Isolation Level Serializable;
  8. SelectSname, ageFromStudent;
  9. UpdateStudentSetAge = 23
  10. WhereSname ='Bruce Lee';
  11. -- Rollback;
  12. Rollback;
  13. SelectSname, ageFromStudent;
  14. -- Savepoint section storage point
  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.