Global Temporary Tables in active data guard.

HI Gurus,
Please help me with below query. Google confusing me a lot.
1) We have an ADG (RAC Setup) 11gr2 with ASM. Is it possible to create global temporary tables in ADG. Because Devlopers are not able to create temp tables. Its giving error as
ORA-16000: database open for read-only access
2) Do we need to create Global Temporary tables in Active node or passive node??
Please help.
Regards,
Nikhil Mehta.

Hi Meser,
thanks for your response.
We are using it for Reporting purpose only.
SQL> select open_mode from v$database;
OPEN_MODE
READ ONLY WITH APPLY
Regards,
Nikhil Mehta.

Similar Messages

  • Creating a Global Temporary Table on non-default TEMP tablespace.

    Hello ,
    I am using Oracle 11g.
    I have a procedure which create global temporary tables for its functionality. As the data which is going in the global temporary table , mean the data which is going in the default TEMP tablesapce is too huge ..... billions of rows..
    So what i want to do is , I want to create the global temporary table in another TEMP2 tablespace ( which is not the default one) so the load of billions of rows of data will be shifted to TEMP2. The default TEMP tablespace will not be affected and it can be used for other transactions.
    Is this possible. Can i shift the global temporary table from TEMP( Default temp tablespace) to TEMP2 ( the non-default temp tablespace) ????
    Please guide me with proper solutions and examples ....
    Thanks in advance ..

    DBA4 wrote:
    Hello ,
    I am using Oracle 11g.
    I have a procedure which create global temporary tables for its functionality. As the data which is going in the global temporary table , mean the data which is going in the default TEMP tablesapce is too huge ..... billions of rows..
    So what i want to do is , I want to create the global temporary table in another TEMP2 tablespace ( which is not the default one) so the load of billions of rows of data will be shifted to TEMP2. The default TEMP tablespace will not be affected and it can be used for other transactions.
    Is this possible. Can i shift the global temporary table from TEMP( Default temp tablespace) to TEMP2 ( the non-default temp tablespace) ????
    Global temporary tables are instantiated in the temporary tablespace of the schema that inserts the data - not into "the default" temporary tablespace.
    Assume Schema1 creates a GTT and grants all on that table to schema2
    Assume schema1 also creates a procedure (authid owner, the default) to insert data into the GTT and grants execute on the procedure to schema2
    If schema2 executes: insert into schema1.gtt, the data will appear in the temporary tablespace of schema2
    If schema2 executes: execute schema1.procedure, the data will appear in the temporary tablespace of schema1
    So if you want to protect the "normal" temporary tablespace, you could just create a special temporary tablespace for the owner of the procedure.
    Regards
    Jonathan Lewis

  • Are global temporary tables in Oracle 10.2 behaving differently?

    My procedure is creating and inserting data into a Global Temporary Table (on commit data is preserved). I am running this procedure in two different environments.
    The first environment is running under Oracle 10.2 and after the procedure runs successfully I can not see any data inserted in the GTT.
    When I run the very same procedure in the second environment which runs under Oracle 9.2, it works fine, runs successfully and I can see all rows inserted in the GTT.
    Can someone explain this? What should I do differently in the Oracle 10.2? Any thoughts?
    Thank you very much.

    Hi,
    The following TEMPORARY table is created with the attribute, ON COMMIT DELETE ROWS. This allows an application to load registration entries into the global temporary table and manipulate that data with SQL statements. The data is deleted upon each commit with the clause ON COMMIT DELETE ROWS.
    CREATE GLOBAL TEMPORARY TABLE student_reg_entries
    student_name VARCHAR2(30),
    reg_entries reg_entry_varray_type
    ) ON COMMIT DELETE ROWS;
    Replace ON COMMIT DELETE ROWS with ON COMMIT PRESERVE ROWS to retain temporary table data throughout the database session, regardless of any commits made during that session.
    The following illustrates a PL/SQL block that populates this temporary table with two classes each for two students. It makes no difference how many other applications are currently using this temporary global table for similar purposes. For the code below, two rows are inserted, then a COMMIT, after which a SELECT shows that the table is empty.
    DECLARE
    classes_to_take reg_entry_varray_type :=
    reg_entry_varray_type();
    BEGIN
    classes_to_take := reg_entry_varray_type(
    reg_entry('CS101', 'C' ),
    reg_entry('HST310', 'C' ));
    INSERT INTO student_reg_entries VALUES
    ('John', classes_to_take);
    classes_to_take := reg_entry_varray_type(
    reg_entry('ENG102', 'C' ),
    reg_entry('BIO201', 'C' ));
    INSERT INTO student_reg_entries VALUES
    ('Mary', classes_to_take);
    END;
    This next SELECT returns two rows:
    SQL> SELECT * FROM student_reg_entries;
    Row 1:
    John
    REG_ENTRY_VARRAY_TYPE
    (REG_ENTRY('CS101','C'), REG_ENTRY('HST310','C'))
    Row 2:
    Mary
    REG_ENTRY_VARRAY_TYPE
    (REG_ENTRY('ENG102','C'), REG_ENTRY('BIO201','C'))
    A COMMIT automatically deletes rows making the table available for the next session transaction.
    SQL> COMMIT;
    SQL> SELECT * from student_reg_entries;
    no rows selected
    The full information about this article is in the link I post before, I'm just showing this extract of the article because some people don't like to read links....
    Cheers,
    Francisco Munoz Alvarez
    http://www.oraclenz.com

  • Global temporary table

    Hi
    how to create global temporary table and push data from forms.
    Thanks
    Shital

    hi
    try something like this.
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT DELETE ROWS;If its Correct/Helpful please Mark it thanks.
    Sarah

  • Scalability issue with global temporary table.

    Hi All,
    Does create global temporary table would lock data disctionary like create table? if yes would not it be a scalable issue with multi user environment?
    Thanks and Regards,
    Rudra

    Billy  Verreynne  wrote:
    acadet wrote:
    am I correct in interpreting your response that we should be using GTT's in favour of bulk operations and collections and in memory operations? No. I said collections cannot scale. This means due to the fact that collections reside in expensive PGA memory, you cannot stuff large data volumes into them. Thus they do not make an ideal storage bin for temporary data (e.g. data loaded from file or a web service). GTTs otoh do not suffer from the same restrictions, can be indexed and offer vastly better scalability and so on.
    Multiple passes are often needed using such a data structure. Or filtering to find specific data. As a GTT is a SQL native, it offers a lot more flexibility and performance in this regard.
    And this makes sense - as where do we put out persistent data? Also in tables, but ones of a persistent and not temporary kind like a GTT.
    Collections are pretty useful - but limited in size and capability.
    Rudra states:
    I want to pull out few metrices from differnt tables and processing itIf this can't be achieved in a SQL statement, unless Rudra is a master of understatement then I would see GTT's as a waste of IO and programming effort. I agree.
    My comments however were about choices for a temporary data storage bin in PL/SQL.I agree with your general comments regarding temporary storage bins in Oracle, but to say that collections don't scale is putting to narrow a definition on scaling. True, collections can be resource intensive in terms of memory and CPU requirements, but their persistence will generally be much shorter than other types of temporary storage. Given the right characteristics, collections will scale and given the wrong characteristics GTT's wont scale.
    As you say it is all about choice. Getting back to the theme of this thread though, the original poster should be made aware that well designed and well coded applications are most likely to scale. Creating tables on the fly is generally considered bad practice and letting the database do what it does best, join tables in queries at the SQL level is considered good practice. The rest lies somewhere in between and knowing when to do which is why we get paid the big bucks (not). ;-)
    Regards
    Andre

  • HELP global temporary table ----URGENT

    HI ALL,
    create global temporary table FLIGHT_SCHEDULE ( STARTDATE DATE, ENDDATE DATE, COST NUMBER ) on commit preserve rows;
    I a not able to get return value in cursor
    but if this table is normal i.e. not temprary then it is returnng cursor
    ORA-24338 statment handel not exucuted error comming
    Please help
    Regards

    The code you posted looks alright.
    Perhaps you did not post the code with the problem?

  • Cannot create Global Temporary Table

    Hi,
    i'm trying to create a Global Temporary Table. However I receive a missing or invalid options specified error.
    This should be one of the most simple ways to create a Global Temporary Table right?
    DECLARE GLOBAL TEMPORARY TABLE SESSION.T_MECHANIC_ALLOCATION
    START_TIME DATE
    ,SYSUR_AUTO_KEY NUMBER
    ,EPP_AUTO_KEY NUMBER
    ,STOP_TIME DATE
    ,WOK_AUTO_KEY NUMBER
    ON COMMIT DELETE ROWS

    No, you create a Global Temporary Table in the same way as any other table: beginning with the CREATE keyword:
    CREATE GLOBAL TEMPORARY TABLE T_MECHANIC_ALLOCATION
    START_TIME DATE
    ,SYSUR_AUTO_KEY NUMBER
    ,EPP_AUTO_KEY NUMBER
    ,STOP_TIME DATE
    ,WOK_AUTO_KEY NUMBER
    ON COMMIT DELETE ROWS

  • DDL time changes on commit of Global temporary table

    Hi,
    I have created a global temporary table with on commit delete rows.
    Whenever I execute commit command the DDL time of the global temporary table changes.
    Just wanted to know whether commit on Global temporary table is DDL. I had expected it to be an DML operation.
    Thanks,
    Pawan

    I do not get that effect:
    orcl112> create global temporary table gtt1(c1 date);
    Table created.
    orcl112> select last_ddl_time from user_objects where object_name='GTT1';
    LAST_DDL_TIME
    2013-07-22 12:44:02
    orcl112> insert into gtt1 values(sysdate);
    1 row created.
    orcl112> commit;
    Commit complete.
    orcl112> select last_ddl_time from user_objects where object_name='GTT1';
    LAST_DDL_TIME
    2013-07-22 12:44:02
    orcl112> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    orcl112>

  • Life time of data in a Global Temporary Table.

    Dear Friends,
    I have a global temporary table in which I insert some values via a backend package, when forms start up and accessing it via the same package when user performs some changes in it - storing the value and during exit saving it in the master table. My problem is the data is not accessible while processing. I'm using Oracle9i Enterprise Edition Release 9.2.0.1.0 database and Forms [32 Bit] Version 6.0.8.8.0. I also give you the script in using which I created the temporary table.
    CREATE GLOBAL TEMPORARY TABLE GTT_PRA
    A1 VARCHAR2(10 BYTE) NOT NULL,
    A2 VARCHAR2(15 BYTE) NOT NULL,
    A3 VARCHAR2(10 BYTE) NOT NULL
    ON COMMIT DELETE ROWS;
    Why is that so? Please help me.
    With Regards,
    Senthil .A. Perumal.

    Dear Arun,
    Thank you for your script. But I'm accessing a large table, so for each and every process, the table get populated and grows very large giving some space problem, that is why I'm deleting rows when commiting. I would appreciate your help.
    Dear Yogesh,
    From the same forms I'm calling the backend package - will that be a different session. Once I'm calling to populate the table and next time I'm calling to store the user modified data and finally calling to store the data to master table. I think all are in the same sessions. Please reply me.
    Thank you dear friends fr your immediate response. I would really appreciate it.
    Regards,
    Senthil .A. Perumal.

  • Datas deletion from Global Temporary table  when clear command is given

    Dear All,
    How to Delete datas from global temporary Table when clear command is given in forms
    Suggest me syntax..
    Pls help..
    Regards,
    Gokul.B

    http://psoug.org/reference/gtt.html
    Francois

  • Auditing data from global temporary table

    Hi I have a process that uses a global temporary table.
    What it does it serve a consolidation point to merge a lot of data.
    Some the former designer decides to use a global temporary table and the row will be gone once it got commit.
    However, the data is corrupted occasionally. And ideally we would like to fix the upstream source data but this is too complicated and not feasible.
    So we decide to audit the data going into the global temporary table. We want to generate a report on the corrupted data.
    However, whenever I commit, the data is gone from the global temporary table and we do not want to set it to commit preserve rows for the global temporary table
    Even with autonomous transaction this is not working out as once it commits the data is gone.
    Any idea how this can be done. Here are the prototype that I build to demo this:
    drop table gt_tst1;
    --this is the table its data needs to get audit
    create global temporary table gt_tst1(id number); --on commit preserve rows;
    drop table not_gt_tst1;
    --this table is used for storign the corrupt data and generate report
    create table not_gt_tst1 as select * from gt_tst1;
    CREATE OR REPLACE PROCEDURE tst_gt_tst1 IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    --if there is a way to do the insert and select once. but it seems it is not working for global temporay table unless change it to on commit preserve rows
      INSERT
      when m2 = 0 THEN
      INTO not_gt_tst1(id)values(object_id)
      when m3 = 0 THEN
      INTO gt_tst1(id) values (object_id)
      select object_id,mod(object_id,2) m2, mod(object_id,3) m3 from dba_objects where rownum < 101;
      COMMIT;
    END tst_gt_tst1;
    select sysdate from dual;
    truncate table gt_tst1;
    truncate table not_gt_tst1;
    select * from gt_tst1;
    select * from not_gt_tst1;
    execute tst_gt_tst1;
    select * from gt_tst1; -- data gone
    select * from not_gt_tst1;
    --commit
    select sysdate from dual;
    spool off

    The data is poor and the code is poor and the dev and QA env is also poor..
    And the business asks us to fix the data..However..we do not have an environment close enough to test it out before it got put into production that is the bottom line.
    Heres the dev and QA env cannot be trust to the extent that I can sign off and say it will give the same behavior as the production env
    So we would like to minimize the risk as there are other process uses these table and we are not sure if changing this would lead to UN-expected behavior.
    We cannot tell some other process rely on the fact that these table got empty out after commit.
    Edited by: vxwo0owxv on Jan 23, 2012 12:18 PM
    Edited by: vxwo0owxv on Jan 23, 2012 12:20 PM

  • Weird issue: Partial data inserted when reading from Global temporary table

    I have a complex sql query that fetches 88k records. This query uses a global temporary table which is the replica of one of our permanent tables. When I do Create table..select... using this query it inserts only fewer records (66k or lesser). But when I make the query point to the permanent table it inserts all 88k records.
    1. I tried running the select query separately using temp and perm table. Both retrieves 88k records.
    2. From debugging I found that this problem occurred when we were trying to perform a left outer join on an inline view.
    However this problem got resolved when I used the /*+ FIRST_ROWS */ hint.
    From my limited oracle knowledge I assume that it is the problem with the query and how it is processed in the memory.
    Can someone clarify what is happening behind the scenes and if there is a better solution?
    Thanks

    user3437160 wrote:
    I have a complex sql query that fetches 88k records. This query uses a global temporary table which is the replica of one of our permanent tables. When I do Create table..select... using this query it inserts only fewer records (66k or lesser). But when I make the query point to the permanent table it inserts all 88k records.
    1. I tried running the select query separately using temp and perm table. Both retrieves 88k records.
    2. From debugging I found that this problem occurred when we were trying to perform a left outer join on an inline view.
    However this problem got resolved when I used the /*+ FIRST_ROWS */ hint.
    From my limited oracle knowledge I assume that it is the problem with the query and how it is processed in the memory.
    Can someone clarify what is happening behind the scenes and if there is a better solution?
    Thanksmight specifics be OS & Oracle version dependent?
    How to ask question
    SQL and PL/SQL FAQ

  • Active data guard standby database

    Hello,
    we have to choose which technology to use for maintain Oracle backup center synchronized with main center. This backup center should be read only, and data generated in main should be replicated into backup. So I would like to use Active Data Guard, but I have a possible issue with reading in backup center, because reading is not just select, but filling(inserting data) some temporary tables (from client side, and from procedures in database). Will Standby database in backup center allow this if Active Data Guard is used. We would go with Oracle 11gR2.
    Also other suggestions on replication technologies (I know there are RAC, ADG, Oracle Streams, Golden Gate), or any document which would help us decide which of these technologies would suit our needs the best.
    Thank You.

    Hi,
    user12121832 wrote:
    we have to choose which technology to use for maintain Oracle backup center synchronized with main center. This backup center should be read only, and data generated in main should be replicated into backup. So I would like to use Active Data Guard, but I have a possible issue with reading in backup center, because reading is not just select, but filling(inserting data) some temporary tables (from client side, and from procedures in database). Will Standby database in backup center allow this if Active Data Guard is used. We would go with Oracle 11gR2. You can use Standby Database to make yours Backup.
    In 11.1 or later you can use feature "Snapshot Standby Databases" if this write on database is temporary (i.e you will not use the new data) and at backup time you not need use Snapshot Standby Database feature.
    A snapshot standby database is a physical standby database that you temporarily convert into an updatable standby database. You can use snapshot standby databases as clones or test databases to validate new functionality and new releases, and when finished you then convert the database back into a physical standby. While running in the snapshot standby database role, it continues to receive and queue redo data so that data protection and the RPO are not sacrificed.
    A snapshot standby database has the following characteristics:
    * A snapshot standby database cannot be the target of a switchover or failover. A snapshot standby database must first be converted back into a physical standby database before performing a role transition to it.
    * A snapshot standby database cannot be the only standby database in a Maximum Protection Data Guard configuration.
    Note:
    Flashback Database is used to convert a snapshot standby database back into a physical standby database. Any operation that cannot be reversed using Flashback Database technology will prevent a snapshot standby from being converted back to a physical standby.
    http://docs.oracle.com/cd/E11882_01/server.112/e17157/unplanned.htm#HAOVW11832
    Also other suggestions on replication technologies (I know there are RAC, ADG, Oracle Streams, Golden Gate), or any document which would help us decide which of these technologies would suit our needs the best.If you need "standby" database opened in read-write all time the best option is to use Golden Gate.
    Regards,
    Levi Pereira

  • Dropping global temporary table

    Hi: I am on 10.2.0.3.
    I have an interesting problem with global temporary tables.
    I created a few and was using them for awhile.
    Now I am trying to drop one (it has a couple indexes as well) and here is what I am getting:
    SQL> drop table sysadm.PS_BPA_RATES_TA011;
    drop table sysadm.PS_BPA_RATES_TA011
    ERROR at line 1:
    ORA-14452: attempt to create, alter or drop an index on temporary table already in use
    Needless to say I checked the active sessions (using v$session) but there is none which locks this table.
    I truncated it (although it had 0 rows but I was trying to free up space), also tried to flush shared_pool & buffer_cache (it's a test DB) - which were successful but did not help - I am getting the same error.
    Someone suggested checking V$TEMPSEG_USAGE where segtype='DATA'. This view shows 3 rows with session# & sql_id but both does not show any session:
    SQL> select * from V$TEMPSEG_USAGE where segtype='DATA';
    USERNAME USER SESSION_ADDR SESSION_NUM SQLADDR SQLHASH SQL_ID
    TABLESPACE CONTENTS SEGTYPE SEGFILE# SEGBLK# EXTENTS BLOCKS SEGRFNO#
    SYSADM SYSADM C00000021C1D2318 123 C0000002DB467ED0 146923226 0ahnqxh4c3rqu
    TEMP TEMPORARY DATA 204 465289 1 128 4
    SYSADM SYSADM C00000021C1CE508 32644 C00000021B6D3F58 2784120300 0c5411akz4mgc
    TEMP TEMPORARY DATA 204 506761 14 1792 4
    SYSADM SYSADM C00000021C1CE508 32644 C00000021B6D3F58 2784120300 0c5411akz4mgc
    TEMP TEMPORARY DATA 204 505993 1 128 4
    SYSADM SYSADM C00000021C1CE508 32644 C00000021B6D3F58 2784120300 0c5411akz4mgc
    TEMP TEMPORARY DATA 204 505865 1 128 4
    SQL> select session_num,sql_id from V$TEMPSEG_USAGE where segtype='DATA';
    SESSION_NUM SQL_ID
    123 0ahnqxh4c3rqu
    32644 0c5411akz4mgc
    32644 0c5411akz4mgc
    32644 0c5411akz4mgc
    SQL> select sid,serial#,process from v$session where sql_id='0ahnqxh4c3rqu';
    no rows selected
    SQL> select sid,serial#,process from v$session where sid=32644;
    no rows selected
    I know that recycling the database should help but I can not do it right now - and I am sure there should be a solution.
    Any help appreciated. TIA,
    GregX

    I found a solution to this.
    You have to use V$TEMPSEG_USAGE where segtype='DATA'.
    Column session_num corresponds to serial#. The job was canceled from the front end but this session was still hanging in there. After I killed it the drop worked.
    Lots of people are saying that truncate should help with this problem. That's not true.

  • Use of global temporary tables in Procedures

    Hi
    I am using global temporary tables in the procedures. Loading data in the same table through many procedures. I am fetching the data from the global temporary table in PRO-C by a cursor. Will this degrade performance?
    Please help me..
    Thanks in Advance...

    Will this degrade performance?That depends... in comparison to what?
    Loading data into temporary tables will generally be more efficient than loading data into permanent tables because Oracle needs to do less to protect this data since it is inherently transient. On the other hand, loading the data into a table in the first place tends to be more expensive than alternatives like using a single SQL statement, a pipelined table function, or an in memory collection.
    Justin

Maybe you are looking for