I have done some experiments about session_begin(). I just used one otl_connect object and one otl_stream object, and I called session_begin() and session_end() over and over. Then I traced the oracle sessions by PL/SQL Developer tool, and I found for each session_begin() , I got same session id(sid) but different serial# and different logon time.
Now, I'm not very sure if every session_begin() create a new real oracle session. So, anyone can help me? Thanks.
Why do you think the sessions are not "real"? Because of the same SID? Oracle (OCI) has separate "server attach" and "session begin" operations. "Server attach" opens a TCP/IP connection to the database server. "Session begin" opens a logical session within the TCP/IP connection context. If you "end sessions" and "begin sessions" within the same "attachment" to the database server, SID stays the same, but the serial# changes. The same SID doesn't make "sessions" "unreal". Think of this as an "implementation detail". If you want more detail on the implementation, you may want to read the Oracle Call Interface related manuals, or the Oracle architecture related manuals. I may be missing some important question / point in your post. If you have more specific questions, feel free to email me my gmail address (see the OTL Web pages for more detail).
Thanks for explaining it. I misunderstand it just because of the same SID. I just want someone to help me to confirm it. Thank you, Sergei.