Multiple Alter Table Statements in one batch

Hi Team,
We have in one of our upcoming release two columns being added to a table that has over 20 million records and 14 indexes.
We needed to add two columns to the table both not null (bit). Because it was taking a while to add the columns, we thought that putting these two alter statements in one batch would speed up the operation significantly but to my surprise it did not.
Conclusion from my test: individual alter statements or batch alter statements take the same time
Here are me test and results - table Order1 and Order2 are exactly the same structure and data.
Test case 1:
===================
ALTER TABLE Order1
ADD OR_N BIT DEFAULT 0 NOT NULL
go
ALTER TABLE AccountTradeConfirmation_Alter1
ADD OR_S BIT DEFAULT 0 NOT NULL
Go
Elapsed Time: 2 hrs
             Mar 18 2015 5:56PM
(1 row affected)
Non-clustered index (index id = 3) is being rebuilt.
Non-clustered index (index id = 4) is being rebuilt.
Non-clustered index (index id = 5) is being rebuilt.
Non-clustered index (index id = 6) is being rebuilt.
Non-clustered index (index id = 7) is being rebuilt.
Non-clustered index (index id = 8) is being rebuilt.
Non-clustered index (index id = 9) is being rebuilt.
Non-clustered index (index id = 10) is being rebuilt.
Non-clustered index (index id = 11) is being rebuilt.
Non-clustered index (index id = 12) is being rebuilt.
Non-clustered index (index id = 13) is being rebuilt.
Non-clustered index (index id = 14) is being rebuilt.
(21777920 rows affected)
Non-clustered index (index id = 3) is being rebuilt.
Non-clustered index (index id = 4) is being rebuilt.
Non-clustered index (index id = 5) is being rebuilt.
Non-clustered index (index id = 6) is being rebuilt.
Non-clustered index (index id = 7) is being rebuilt.
Non-clustered index (index id = 8) is being rebuilt.
Non-clustered index (index id = 9) is being rebuilt.
Non-clustered index (index id = 10) is being rebuilt.
Non-clustered index (index id = 11) is being rebuilt.
Non-clustered index (index id = 12) is being rebuilt.
Non-clustered index (index id = 13) is being rebuilt.
Non-clustered index (index id = 14) is being rebuilt.
(21777920 rows affected)
             Mar 18 2015 7:52PM
Test case 2:
===================
ALTER TABLE Order2
ADD OR_N BIT DEFAULT 0 NOT NULL, OR_S BIT DEFAULT 0 NOT NULL
go
2 hrs elapsed time
             Mar 20 2015 11:10AM
(1 row affected)
Non-clustered index (index id = 3) is being rebuilt.
Non-clustered index (index id = 4) is being rebuilt.
Non-clustered index (index id = 5) is being rebuilt.
Non-clustered index (index id = 6) is being rebuilt.
Non-clustered index (index id = 7) is being rebuilt.
Non-clustered index (index id = 8) is being rebuilt.
Non-clustered index (index id = 9) is being rebuilt.
Non-clustered index (index id = 10) is being rebuilt.
Non-clustered index (index id = 11) is being rebuilt.
Non-clustered index (index id = 12) is being rebuilt.
Non-clustered index (index id = 13) is being rebuilt.
Non-clustered index (index id = 14) is being rebuilt.
(21777920 rows affected)
             Mar 20 2015 1:12PM

Hi Kiran,
I have read your response a few times and I was not able to understand your angle. I assume based on the results of my test that Sybase does the following in processing the alter statements
ALTER TABLE Order2
ADD OR_N BIT DEFAULT 0 NOT NULL, OR_S BIT DEFAULT 0 NOT NULL
go
process alter ADD OR_N BIT
-- > make copy of table
---> alter original table
--> put data back in
process alterOR_S BIT
-- > make copy of table
---> alter original table
--> put data back in
rebuild index
my expectation was that it would make a copy of the table only once and process the two alter statements. Also when doing the alter separately (test1) it rebuilt the index twice, however using the batch the index was rebuilt once (at least only one message displayed).
Regards.

Similar Messages

  • SAP HANA - How to run alter table statement in HANA procedure?

    I am trying to run alter table statement in a procedure. HANA gives error saying
    SAP DBTech JDBC: [257] (at 1338): sql syntax error: ALTER TABLE is not allowed in SQLScript: line 36 col 8 (at pos 1338)
    How to run alter table statements in procedure?
    Thanks,
    Suren.

    Hi Rich Heilman,
    Thanks for your response.  I have tried with dynamic SQL. I am trying to add partitions to a non portioned table.
    EXECUTE IMMEDIATE 'ALTER TABLE ' || :SCHEMA_NAME || '.TARGET_TABLE PARTITION BY RANGE (TARGET_TYPE_ID) (PARTITION VALUE = 1, PARTITION VALUE = 2, PARTITION VALUE = 3, PARTITION VALUE = 4, PARTITION OTHERS)';
    Execution fails with error
    Could not execute 'CALL PARTITION_TARGET_TABLE('SUREN_TEST')' in 1.160 seconds .
    [129]: transaction rolled back by an internal error:  [129] "SUREN_TEST"."PARTITION_TARGET_TABLE": line 53 col 3 (at pos 2173): [129] (range 3)
    Any reasons for this error?
    Thanks,
    Suren.

  • Performance for ALTER TABLE statements

    Hi,
    I'd like to improve performance for scripts running several ALTER TABLE statements. I have two questions regarding this.
    This is the original code:
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL );
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_INVOICED NUMBER NULL );
    1. Would I gain any performance by making the following changes?
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL,
    QTY_INVOICED NUMBER NULL );
    These columns are later on filled with values and then made NOT NULL.
    2. Would I gain anything by make these columns NOT NULL with a DEFAULT value in the first statement and then later on insert the values?
    /Roland Bali
    null

    1. It wud definitely increase the performance.
    2. You can only have NOT NULL columns added to an existing table if the table is empty.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Roland Bali ([email protected]):
    Hi,
    I'd like to improve performance for scripts running several ALTER TABLE statements. I have two questions regarding this.
    This is the original code:
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL );
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_INVOICED NUMBER NULL );
    1. Would I gain any performance by making the following changes?
    ALTER TABLE CUSTOMER_ORDER_DELIVERY_TAB ADD (
    QTY_TO_INVOICE NUMBER NULL,
    QTY_INVOICED NUMBER NULL );
    These columns are later on filled with values and then made NOT NULL.
    2. Would I gain anything by make these columns NOT NULL with a DEFAULT value in the first statement and then later on insert the values?
    /Roland Bali<HR></BLOCKQUOTE>
    Naveen

  • Alter Table Statements in Designer

    Hi Guys,
    Just wondering if anyone knows if it's possible to store Alter Table statements in Designer 9i?
    Anton

    Hi,
    The designer generate alter statements for you.
    e.g You have a table emp with empno number(8) in designer and in your application database. You cahnged empno to number(12) in designer. Generate ddl pointing to your application database. Designer generate an ALTER table script for you.

  • Multiple Oracle SQL statements in one Add Command

    I am creating a report that needs a bunch of processing(SQL DDL statements) before the final select statement is generated for the report.
    I am connecting to Oracle database however Crystal Report only allows me to give one SQL statement in one Add Command.
    Is there a way to give multiple statements in one "Add Command" for the report ?
    Thanks.

    you can add more than one "Add Command" in the same report, and you can also treat them as views or table, so you can link them to each others and so on
    good luck

  • Difference between alter table statements to add primary keys

    Hi,
    Can someone explain what the difference between these 2 statements are and if & when one should be used over the other?
    Also, are the brackets around the column name necessary?
    Thanks!
    ALTER TABLE xyz ADD CONSTRAINT id_pk PRIMARY KEY (id);
    ALTER TABLE xyz ADD PRIMARY KEY (id);

    Hi,
    As every one has explained that there is no difference in the actual functioning of the two constraints except that the first statement will create Primary Key constraint with user defined name as id_pk whereas in the second statement Primary key will be created with system generated name like SYS....
    Normally name for the constraints are needed when you are working on constraints like need to enable or disable the constraints or need to drop the constraints.
    We can say that names for primary key are least required when it comes to the usage except better recognization.
    Because we can drop primary key, disable primary key,enable primary key without giving the name for the primary key as there can only be one primary key in the table. So not much an issue with the name.
    But as earlier post say its better than nothing,, i will add to it that its almost same as that with names constrained in case of Primary Keys taking into account the usage of the named primary key.
    Regards

  • Commit after alter table statement or not?

    Hi,
    Is it necessary to put the a commit after the following statement or is it automatically committed:
    Alter table tab_name drop column col_name;
    Thanks

    Khurram,
    Isnt Eric you are , i mean isnt yours synonym :)Erm...simple answer. No. We are not the same person. I just know that Eric, like yourself, makes good contributions to these threads and then someone like that is coming on the forums and trying to make himself look better and put down the regular contributors which isn't really on is it, I think you'll agree.
    CREATE PUBLIC SYNONYM Eric FOR Blushadow;
    hehe.

  • Multiple select, update statements in one script

    Hi All,
    I wrote a script that has multiple select, update statements. When I ran the script in the sqlplus, I got error on second update statement:
    ORA-00936: missing expression
    Have any idea what was the problem?
    Thanks
    OF

    the following are my codes:
    set termout off
    set showmode off
    set timing off
    --set echo off
    set echo on
    set heading off
    set verify off
    set pagesize 0
    -- Parameters
    -- Transaction Date
    -- Show dates this format by default
    ALTER SESSION SET nls_date_format='DD-MON-YYYY';
    -- Define bind variables to hold report parameters
    var v_date varchar2(13)
    var v__run_date varchar2(13)
    begin
    -- Get job sumission variable for Transaction Date
    select gjbprun_value into :v_date
    from general.gjbprun
    where gjbprun_job = '&&1'
    and gjbprun_one_up_no = &&2
    AND gjbprun_number = '01' ;
    End;
    spool fwuodoc_&&2
    select FABINVH_CODE, FABINVH_POHD_CODE,
    FABINVH_INVOICE_DATE, FABINVH_PMT_DUE_DATE, FABINVH_TRANS_DATE,
    fabinvh_complete_ind
    from fabinvh
    where fabinvh_complete_ind='R'
    and trunc(FABINVH_TRANS_DATE) < trunc(to_date('&&dd_mon_yyyy','dd-mon-yyyy'))
    update fabinvh set
    fabinvh_trans_date=to_date('&&dd_mon_yyyy','dd-mon-yyyy')
    where fabinvh_complete_ind='R'
    and trunc(FABINVH_TRANS_DATE) < trunc(to_date('&&dd_mon_yyyy','dd-mon-yyyy'))
    update fpbreqh set
    fpbreqh_trans_date=to_date('&&dd_mon_yyyy','dd-mon-yyyy')
    where fpbreqh_complete_ind='Y'
    and nvl(fpbreqh_appr_ind,'x')<>'Y'
    spool off
    exit

  • Table compression and alter table statement

    Friends
    I am trying to add columns to a table which is compressed. Since Oracle treats compressed tables as Object tables, I cannot add columns directly so I tried to uncompress table first and then add columns. This doesnt seems to work.
    What could be issue.
    Thanks
    Vishal V.
    Script to test is here and results are below.
    -- Test1 => add columns to uncompressed table -> Success
    DROP TABLE TAB_COMP;
    CREATE TABLE TAB_COMP(ID NUMBER) NOCOMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    -- Test2 =. try adding columns to compressed tables, uncompress it and then try again -> Fails
    DROP TABLE TAB_COMP;
    CREATE TABLE TAB_COMP(ID NUMBER) COMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP move NOCOMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    SQL> -- Test1 => add columns to uncompressed table -> Success
    SQL> DROP TABLE TAB_COMP;
    Table dropped.
    SQL> CREATE TABLE TAB_COMP(ID NUMBER) NOCOMPRESS;
    Table created.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    Table altered.
    SQL>
    SQL> -- Test2 =. try adding columns to compressed tables, uncompress it and then try again -> Fails
    SQL> DROP TABLE TAB_COMP;
    Table dropped.
    SQL> CREATE TABLE TAB_COMP(ID NUMBER) COMPRESS;
    Table created.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10))
    ERROR at line 1:
    ORA-22856: cannot add columns to object tables
    SQL> ALTER TABLE TAB_COMP move NOCOMPRESS;
    Table altered.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10))
    ERROR at line 1:
    ORA-22856: cannot add columns to object tables

    Which version of oracle you are using?
    1* create table test1234(a number) compress
    SQL> /
    Table created.
    Elapsed: 00:00:00.02
    SQL> alter table test1234 add(b varchar2(200));
    Table altered.
    Elapsed: 00:00:00.02

  • Object Modelling Question: How do I create multiple nested table columns in one table

    Hi there,
    I have a XML doc which is as follows:
    <PERSON>
    <ADDRESSLIST>
    <ADDRESS>111, Hamilton Ave </ADDRESS>
    <ADDRESS>222, Cambell Ave </ADDRESS>
    </ADDRESSLIST>
    <PHONELIST>
    <PHONENO>4085551212 </PHONENO>
    <PHONENO>6505551212</PHONENO>
    </PHONELIST>
    </PERSON>
    I need a table that looks as follows:
    Create table person
    (addresslist address_table,
    phonelist phone_table
    I would like to create a table called person with columns addresslist and phonelist. Each defined as object type table of address and table of phones.
    Can anybody please tell me how can I do this.
    I have seen that there can only be one nested table per table. If so, how do we do this.
    Thanks so much
    Pramod

    pelle.k wrote:
    peets wrote:Hehe because it's less typing!
    Good one!
    Also, it's by far the more dynamic method.
    If you want to get pedantic, it's also far less efficient in terms of execution time: each iteration of the loop forks a new process, whereas using a single mkdir command forks only once.  The "best" way is the curly-braces method demonstrated above by chimeric.

  • Will alter table table_name move statement change the storage parammeter

    Hi there,
    I have a question about table reorgnization. Will alter table
    table_name move SQL statment change the table's storage parameter
    or keep the same as the original one? If I want to use alter
    table statement to do table defragmentation and change the
    initial and next storage parameter, how will I write this SQL
    statement?
    Thanks in advance.

    Thanks. My table has 5000 extents each of which is 64k, so I
    think I need to do table defragmentation to improve performance.
    If I use alter table table_name move without storage parameter
    and tablespace name, I will relocate this table in current
    tablespace and adopt the current tablespace's storage parameter
    as my table's new storage paramater which is still 64k. After
    that, if I issue alter
    table table_name storage (initial 50M next=50M) command, will it
    change this table's storage parameter and decrease the totoal
    extents number? I ask this question because I use OEM2.2 tuning
    pack reorg wizard to generate the job script to do table
    defragmentation, but in the job script there is no new storage
    parameter. It only generate alter table table_name move
    statement, so I wonder if I don't need to modify this job scripts
    and after it executes this job script, I issue alter table
    table_name storage parameter command manaully. Will this solve
    my problem or I must modify the job script and add new storage
    parameter in the job script?

  • Problem with alter table in execute immediate

    We have PL/SQL scripts which modify the data structure, add data etc to en existing database. These scripts basically ensure that the db is compatible with what the software expects.
    The reason for doing it in PL/SQL rather than SQL script is A) The scripts are launched using GUI so that they are more user friendly. sqlplus is launched as a background process which executes these scripts. All the scripts have EXIT FAILURE WHENEVER SQLERROR as first line to ensure that the control does not hang in the sqlplus background process.
    Going from one version to other, we have added a few tables to the database and also modified a few tables. since (i think) DDL is not allowed in PL/SQL block, we had to resort to putting them in EXECUTE IMMEDIATE enclosures.
    Now for the real question,
    If I create a table using EXECUTE IMMEDIATE clause, I can immediately have insert as a next statement to insert data in this table. but, if I alter the table and add a column to the existing table, I cannot immediately add data to that column, it throws an error saying 'invalid identifier'
    At code level, the following is allowed :
    EXECUTE IMMEDIATE 'CREATE TABLE SP_TEST_TABLE
                             ID     NUMBER,
                             NAME     Varchar2(40)
    INSERT INTO SP_TEST_TABLE(ID, NAME) Values(1, 'SP');
    but I get error for the following :
    EXECUTE IMMEDIATE 'ALTER TABLE SP_TEST_TWO ADD
                        ANOTHER_COLUMN     number
    UPDATE     SP_TEST_TWO SET          ANOTHER_COLUMN = 1;
    In this case, it says ANOTHER_COLUMN invalid identifier
    Does anybody know why?
    any workaround will be greatly appreciated.
    --SP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Friends,
    Thanks to all of you for your help. The spelling mistakes might have occurred becuase i changed the actual script to something 'short and complete' to show the problem.
    I could solve the problem by having more than one PL/SQL block within my file. something like :
    BEGIN
    --alter table statements here
    END;
    BEGIN
    --insert the values in column here.
    END;
    I am still not sure why the error is presented only on alter table statement and not for create table statement. Probably somebody with the knowledge of oracle internals will be able to throw more light on it. I am trying to get the naswers, if I get the answer, I'll surely post it here.
    Regards,
    --Saurabh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • ALTER TABLE in Hypersonic SQL

    As we all know, Hypersonic SQL does not support the ALTER TABLE statement
    yet, so the cool schema update feature of the schematool does not work.
    However, it seems like it would be possible to achieve the same effect
    with the following sequence of SQL statements (yes, I know it would be
    really slow!):
    1. Create a new temp table with all the columns of the original table plus
    the new column(s).
    2. SELECT INTO from the original table into the temp table.
    3. Drop the original table.
    4. Create a new table with the same name as the original table with all
    the desired columns.
    5. SELECT INTO from the temp table to the new table.
    6. Drop the temp table.
    Is there any way in a HSQLDictionary subclass to alter the generation of
    the ALTER TABLE statements?
    Thanks,
    David A. King

    Thanks for your help on this.
    I just tried the following set of SQL statements to simulate an ALTER
    TABLE:
    // This is the original table
    CREATE TABLE T1 (A VARCHAR PRIMARY KEY, B VARCHAR, C VARCHAR)
    // Here are the statements to do an ALTER TABLE
    SELECT * INTO T2 FROM T1
    DROP TABLE T1
    CREATE TABLE T1 (A VARCHAR PRIMARY KEY, B VARCHAR, C VARCHAR, D VARCHAR)
    INSERT INTO T1 (A, B, C) SELECT A, B, C FROM T2
    DROP TABLE T2
    These statements work. What is needed to produce them is the original set
    of column names (and definitions), in this example (A VARCHAR PRIMARY KEY,
    B VARCHAR, C VARCHAR); and the new column definition, in this example (D
    VARCHAR).
    Thanks,
    David
    Marc Prud'hommeaux wrote:
    David-
    A quick test shows that this isn't going to be quite so easy: 'SELECT
    INTO' requires that the table name be a new table, not an already
    existing one. And 'INSERT INTO TABLE_A SELECT * FROM TABLE_B' will fail
    if there are a different number of columns. Thus, the API would require
    some additional metadata (about how many columns exist in the current
    table) in order to be able to do this.
    I have made a note of it in the RFE that I made for this.
    Marc Prud'hommeaux <[email protected]> wrote:
    David-
    Interesting idea: we will look into doing that for the future. It would
    be very nice if we could support schema migration on Hypersonic, since
    it is very lightweight and flexible. I have made an enhancement request
    at:
    https://bugzilla.solarmetric.com/show_bug.cgi?id=160
    If you want to give it a shot yourself, you can extends the
    com.solarmetric.kodo.impl.jdbc.schema.dict.HSQLDictionary class and
    override:
    public String[] getAddColumnSQL (Column column)
    and
    public String[] getDropColumnSQL (Column column)
    The methods should return an array of SQL statements that should be
    executed to perform the add or drop.
    David A. King <[email protected]> wrote:
    As we all know, Hypersonic SQL does not support the ALTER TABLE statement
    yet, so the cool schema update feature of the schematool does not work.
    However, it seems like it would be possible to achieve the same effect
    with the following sequence of SQL statements (yes, I know it would be
    really slow!):
    1. Create a new temp table with all the columns of the original table plus
    the new column(s).
    2. SELECT INTO from the original table into the temp table.
    3. Drop the original table.
    4. Create a new table with the same name as the original table with all
    the desired columns.
    5. SELECT INTO from the temp table to the new table.
    6. Drop the temp table.
    Is there any way in a HSQLDictionary subclass to alter the generation of
    the ALTER TABLE statements?
    Thanks,
    David A. King
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code

  • Alter table move in 8.1.7

    I did a alter table move on one of the tables in 8.1.7 database
    before alter table move..
    TABLE_NAME ACTUAL_SIZE_MB CUR_SIZE_MB FRAGMENTATION PROJECTED_SAVINGS_MB
    UDA_ITEM_FF 36.07 328 89 291.93
    after the alter table move..
    TABLE_NAME ACTUAL_SIZE_MB CUR_SIZE_MB FRAGMENTATION PROJECTED_SAVINGS_MB
    UDA_ITEM_FF 57
    why after the alter table move, I am only able to see the current size and not the actual size?
    any inputs welcome

    Handle:  dee
    Status Level:  Newbie (5)
    Registered:  Jun 14, 2010
    Total Posts:  61
    Total Questions:  30 (30 unresolved)
    If its working , Please mark thread as answered why you leave your thread in Open Status

  • Question on Exporting Table Stats to another database

    I have a question exporting Table Stats from one schema in database A to another schema in another database B.
    Currently running Oracle 9.0.2.6 for unix in both prod and dev.
    Currently table stats are gathered using the ANALYZE TABLE command. We currently don't use the DBMS_STATS package to gather table statistics.
    Question:
    If I execute DBMS_STATS.EXPORT_TABLE_STATS in database A can I import them to database B if I'm only using the ANALYZE TABLE to gather table stats? Do I need to execute the DBMS_STATS.GATHER_TABLE_STATS package in database A prior to excuting DBMS_STATS.EXPORT_TABLE_STATS ?
    The overall goal is to take table stats from Production in its current state and import them into a Development environment to be used for testing data / processes.
    Yes we will be upgrading to Oracle 10 / 11g in near future.
    Yes we will be changing our method of gathering table stats by using the DBMS_STATS package.
    Thanks,
    Russ D

    Hi,
    If I execute DBMS_STATS.EXPORT_TABLE_STATS in database A can I import them to database B if I'm only using the ANALYZE TABLE to gather table stats? You need using the DBMS_STAT package for get and export statistics process if you want migrate the stats to other database.
    Do I need to execute the DBMS_STATS.GATHER_TABLE_STATS package in database A prior to excuting DBMS_STATS.EXPORT_TABLE_STATS ?Yes, you need executing first DBMS_STATS.GATHER_TABLE_STATS.
    Good luck.
    Regards.

Maybe you are looking for