SHARE
TWEET

Untitled

a guest Sep 4th, 2018 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. internal class Program
  2.     {
  3.         private static void Main()
  4.         {
  5.             var stopwatch = Stopwatch.StartNew();
  6.  
  7.           //  DateTime dt = new DateTime();
  8.             try
  9.             {
  10.                 const string oradb = "Data Source = 192.168.137.70/xe; " +
  11.                                      "User id = useridb; Password = user1234";
  12. #pragma warning disable 618
  13.                var con = new OracleConnection(oradb);
  14. #pragma warning restore 618
  15.                 con.Open();
  16.  
  17.  
  18. #pragma warning disable 618
  19.                 var cmd = new OracleCommand {Connection = con};
  20. #pragma warning restore 618
  21.  
  22.  
  23.  
  24.                 for (var i = 0; i < 1000; i++)
  25.                 {
  26.                     cmd.CommandText = "Insert into test (datetime) values (sysdate)";
  27.                     //cmd.CommandText = "Select max(datetime) from test";
  28.                     var dr = cmd.ExecuteReader();
  29.                     dr.Read();
  30.  
  31.                    // dt = Convert.ToDateTime(dr.GetValue(0));
  32.                     dr.Close();
  33.                    // Thread.Sleep(50);
  34.                 }
  35.  
  36.  
  37.  
  38.                 stopwatch.Stop();
  39.                 var averageTime = new TimeSpan(stopwatch.ElapsedMilliseconds / 1000);
  40.                 Console.WriteLine("Запись успешна {0},  {1}", averageTime, dt);
  41.             }
  42.             catch (Exception e)
  43.             {
  44.                 Console.WriteLine("Error{0}", e.Message);
  45.             }
  46.             Console.ReadKey();
  47.         }
  48.     }
  49.    
  50. EXPLAIN PLAN FOR INSERT INTO TABLE values(10)
  51.    
  52. select name, value from v$parameter where name in ('timed_statistics','user_dump_dest');
  53.    
  54. select s.username, s.status, s.sid, s.serial#, sql_trace, s.program, p.spid
  55. from v$session s join v$process p on s.paddr = p.addr
  56. where s.username = 'SH1';
  57.  
  58. USERNAME      STATUS          SID    SERIAL# SQL_TRAC PROGRAM                        SPID
  59. ------------- -------- ---------- ---------- -------- ------------------------------ ------
  60. SH1           ACTIVE          139         41 DISABLED SQL Developer                  26596
  61. SH1           INACTIVE         15         92 DISABLED sqlplus@mpsrv (TNS V1-V3)      25930
  62.    
  63. exec sys.dbms_monitor.session_trace_enable(session_id=>139, serial_num=>41, waits=>true, binds=>false);
  64. exec sys.dbms_monitor.session_trace_enable(session_id=>15,  serial_num=>92, waits=>true, binds=>false);
  65.    
  66. insert into tab1 (time) values (sysdate);
  67. commit;
  68.    
  69. exec sys.dbms_monitor.session_trace_disable(session_id=>139, serial_num=>41);
  70. exec sys.dbms_monitor.session_trace_disable(session_id=>15,  serial_num=>92);
  71.    
  72. $ ls -1t *26596.trc *25930.trc
  73. myoradb_ora_25930.trc
  74. myoradb_ora_25507.trc
  75.  
  76. tkprof myoradb_ora_25930.trc sqlp_25930.prf explain=sh1/sh1
  77. tkprof myoradb_ora_26596.trc sqld_26596.prf explain=sh1/sh1
  78.    
  79. ********************************************************************************
  80. count    = number of times OCI procedure was executed
  81. cpu      = cpu time in seconds executing
  82. elapsed  = elapsed time in seconds executing
  83. disk     = number of physical reads of buffers from disk
  84. query    = number of buffers gotten for consistent read
  85. current  = number of buffers gotten in current mode (usually for update)
  86. rows     = number of rows processed by the fetch or execute call
  87. ********************************************************************************
  88. SQL ID: f281fbsngrwq0
  89. Plan Hash: 0
  90. insert into tab1 (time)
  91. values
  92.  (sysdate)
  93.  
  94.  
  95. call     count       cpu    elapsed       disk      query    current        rows
  96. ------- ------  -------- ---------- ---------- ---------- ----------  ----------
  97. Parse        1      0.00       0.00          0          0          0           0
  98. Execute      1      0.00       0.00          0          1          5           1
  99. Fetch        0      0.00       0.00          0          0          0           0
  100. ------- ------  -------- ---------- ---------- ---------- ----------  ----------
  101. total        2      0.00       0.00          0          1          5           1
  102.  
  103. Misses in library cache during parse: 1
  104. Optimizer mode: ALL_ROWS
  105. Parsing user id: 151  (SH1)
  106.  
  107. Rows     Row Source Operation
  108. -------  ---------------------------------------------------
  109.       0  LOAD TABLE CONVENTIONAL  (cr=1 pr=0 pw=0 time=0 us)
  110.  
  111.  
  112. Rows     Execution Plan
  113. -------  ---------------------------------------------------
  114.       0  INSERT STATEMENT   MODE: ALL_ROWS
  115.       0   LOAD TABLE CONVENTIONAL OF 'TAB1'
  116.  
  117.  
  118. Elapsed times include waiting on following events:
  119.   Event waited on                             Times   Max. Wait  Total Waited
  120.   ----------------------------------------   Waited  ----------  ------------
  121.   SQL*Net message to client                       1        0.00          0.00
  122.   SQL*Net message from client                     1        0.00          0.00
  123. ********************************************************************************
  124.    
  125. ********************************************************************************
  126. SQL ID: gck3089qg8n7x
  127. Plan Hash: 0
  128. insert into tab1 (time)
  129. values
  130.  (sysdate)
  131.  
  132. ...    
  133. Elapsed times include waiting on following events:
  134.   Event waited on                             Times   Max. Wait  Total Waited
  135.   ----------------------------------------   Waited  ----------  ------------
  136.   Disk file operations I/O                        1        0.00          0.00
  137.   log file sync                                   1        0.01          0.01
  138.   SQL*Net message to client                       1        0.00          0.00
  139.   SQL*Net message from client                     1        4.07          4.07
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top