Load data in a Global Temporary Table
I have two different Oracle sessions ("session A" and "session B") on the same Oracle user.
A Global Temporary Table is开发者_StackOverflow populated, in "session A", with about 320,000 records.
How can I quickly insert the same 320,000 records in the global temporary table of the "session B"?
Thank you in advance for your kind suggestions!
EDIT: I have forgotten to specify that I am allowed to create ONLY GLOBAL TEMPORARY TABLES.
EDIT: I have forgotten to specify that I am not allowed to create database links
The data within a temporary table is only ever visible to the current session, so I don't think there's a way to do what you want to do without another approach.
DBMS_PIPE is the 'classic' mechanism for pushing information from one session to another. Session A would have to push data into the pipe and session B would have to pull it.
But generally the idea of databases is that sessions are independent and any commonality is in the preserved data. Going against this suggests you are using the wrong tool.
The data in a global temporary table is only visible to the session that inserted it. So you would have to run the same process that populated the table in session B.
Of course, the fact that you appear to want to access the same 320,000 rows in two different sessions would seem to imply that a global temporary table is not the appropriate data structure to be using. Perhaps you want to load that data into a permanent table (possibly along with some sort of identifier if you will have multiple SessionA/ SessionB pairs). Or perhaps whatever logic Session B is running ought to be run by Session A.
And just taking a step back, since Oracle implements multi-version read consistency such that readers don't block writers and writers don't block readers, it would be very unusual to need to have a 320,000 row temporary table in the first place.
精彩评论