Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. spo load.log
  2. prompt '**** load data ****'
  3. set termout off
  4. @@inserts.sql
  5. commit;
  6. set termout on
  7. prompt '**** done ****'
  8. spo off
  9. exit;
  10.  
  11. set serveroutput on
  12. variable n number
  13. exec :n := dbms_utility.get_time
  14.  
  15. exec :n := (dbms_utility.get_time - :n)/100
  16. exec dbms_output.put_line(:n)
  17.  
  18. timing start timing_name
  19.  
  20. timing stop
  21.  
  22. SQL> set timing on
  23. SQL> select 1 from dual;
  24.  
  25. 1
  26. ----------
  27. 1
  28.  
  29. 1 row selected.
  30.  
  31. Elapsed: 00:00:00.00
  32. SQL>
  33.  
  34. time sqlplus @inserts.sql
  35.  
  36. real 0m9.34s
  37. user 0m2.03s
  38. sys 0m1.02s
  39.  
  40. --Beginning of all SQL scripts:
  41. set serveroutput on feedback on echo on verify on sqlblanklines on timing on define on
  42. col time new_v v_time
  43. col name new_v v_name
  44. col user new_v v_user
  45.  
  46. select name, USER, to_char(sysdate, 'YYYYMMDD-HH24MISS') time from v$database;
  47.  
  48. --Creates a new log file every time the script is run, and it's immediately
  49. --obvious when it was run, which environment it ran in, and who ran it.
  50. spool &v_time._&v_name._&v_user..log
  51.  
  52. --Run the select again so it appears in the log file itself
  53. select name, USER, to_char(sysdate, 'YYYYMMDD-HH24MISS') time  from v$database;
  54.  
  55. --End of all SQL scripts:
  56. select name, USER, to_char(sysdate, 'YYYYMMDD-HH24MISS') time from v$database;
  57. spool off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement