Alter table in timesten

Hi,
I need some suggestion on changing the column's data type for an existing table, i understand "The format of TimesTen columns cannot be altered. It is possible to add or remove columns but not to change column definitions. To add or remove columns, use the ALTER TABLE statement. To change column definitions, an application must first drop the table and then recreate it with the new definitions."
the schema for the table looks below,
CREATE TABLE CHQ_DICT_INT (
     CHQINTID          TT_SMALLINT NOT NULL PRIMARY KEY,
     CHQINTTEXT          VARCHAR2(256) NOT NULL,
     TT_AUTOTIMESTAMP     BINARY(8)
now we are in a situation wherein the column type of SPC_CHQINTID needs to be changed to TT_INTEGER from TT_SMALLINT, and its being primary key and non null column, is there way to still alter the column at the runtime? the idea is not to stop the application accessing the table.
and also is it possible to modify the column definition if its not a primary key and not a null like,
CREATE TABLE CACHE (
     MDN TT_BIGINT NOT NULL PRIMARY KEY,
     CHQINTID TT_SMALLINT,
     ROLE CHAR(1),
     TT_AUTOTIMESTAMP BINARY(8)
);

I'm afraid that for both cases, the only way to do this currently in TimesTen is to:
1. Unload the table's data to an external file using ttBulkCp.
2. Drop the table and re-create it with the correct column definitions.
3. Reload the table's data using ttBulkCp.
Of course this requires application downtime, stopping and dropping (and then re-creating/redeploying) replication etc.
Chris

Similar Messages

  • Error in Timesten While Alter table in oracle

    Hello DB experts,
    I am getting below error while my application statrtup.
    "Exception while caching Rating System Parameter Details.[TimesTen][TimesTen 11.2.2.2.0 ODBC Driver][TimesTen]TT0871: Column VALUE cannot be set to null "
    We have perfomed  below activities.
    1) Not null constraint is created on one table which is in oracle.
    2)  My applicaiton is up with timesten
    3) Not null constraint is removed from oracle.
    4) null data are inserted in that column ,
    Please not that  the table on which constraint is created/removed  was not cached in timesten . its oracle table only.
    Now my question is we wanted to know how timesten will work in above situation.

    The DSN definition from sys.odbc.ini file
    [ocsdev]
    Driver=/u02/app/TimesTen/tt1122/lib/libtten.so
    DataStore=/u031/odbcqa/ttTest
    PermSize=1000
    TempSize=400
    PLSQL=1
    DatabaseCharacterSet=WE8MSWIN1252
    OracleNetServiceName=orcl
    Passthrough=1
    UID=crestelxxxdevg5
    PWD=crestelxxxdevg5
    OracleId=crestelxxxevg5
    OraclePwd=crestelxxxdevg5
    2.    Details of any cache groups you do have defined in TimesTen.
    CREATE asynchronous writethrough CACHE GROUP CUST_PACKAGE
    FROM  TBLCUSTOMERPACKAGE
    CUSTOMERPACKAGEID  NUMBER ,
    VALIDFROMDATE    DATE,
    VALIDTODATE   DATE,
    CUSTOMERID    NUMBER,
    SERVICEID    NUMBER,
    PRIORITY    NUMBER,
    PACKAGEID    NUMBER,
    PRIMARY KEY ("CUSTOMERPACKAGEID"))
       UNIQUE HASH ON (CUSTOMERPACKAGEID) PAGES = 4000 ;
    3 ) Details of the Oracle table that was altered (table name, column for which the NULL/NOT NULL constraint was changed, any primary/foreign key relationship between this table/column and any cached table/column).
    CREATE TABLE "TBLMRATINGCONFIG"
        "RATINGCONFID"         CHAR(7 BYTE) CONSTRAINT "NN_RATINGCONFIG_RATINGCONFID" NOT NULL ENABLE,
        "NAME"                 VARCHAR2(50 BYTE) CONSTRAINT "NN_RATINGCONFIG_NAME" NOT NULL ENABLE,
        "ALIAS"                VARCHAR2(50 BYTE) CONSTRAINT "NN_RATINGCONFIG_ALIAS" NOT NULL ENABLE,
        "DESCRIPTION"          VARCHAR2(2000 BYTE),
        "VALUE"                VARCHAR2(100 BYTE) CONSTRAINT "NN_RATINGCONFIG_VALUE" NOT NULL ENABLE,
        "PARAMETERTYPEID"      CHAR(5 BYTE) CONSTRAINT "NN_RATINGCONFIG_ID" NOT NULL ENABLE,
        "PARAMETERVALUESOURCE" VARCHAR2(255 BYTE),
        "COMMONSTATUSID"       CHAR(5 BYTE) CONSTRAINT "NN_RATINGCONFIG_COMMONSTATUSID" NOT NULL ENABLE,
        "SYSTEMGENERATED"      CHAR(1 BYTE) CONSTRAINT "NN_RATINGCONFIG_SYSGEN" NOT NULL ENABLE,
        "CREATEDATE" DATE CONSTRAINT "NN_RATINGCONFIG_CREATEDATE" NOT NULL ENABLE,
        "LASTMODIFIEDDATE" DATE CONSTRAINT "NN_RATINGCONFIG_LASTMODIFIEDT" NOT NULL ENABLE,
        "CREATEDBYSTAFFID"      CHAR(7 BYTE) CONSTRAINT "NN_RATINGCONFIG_CRSTAFF" NOT NULL ENABLE,
        "LASTMODIFIEDBYSTAFFID" CHAR(7 BYTE) CONSTRAINT "NN_RATINGCONFIG_MODIFIEDSTAFF" NOT NULL ENABLE,
        "STATUSCHANGEDATE" DATE,
        "SERVICEID"            CHAR(8 BYTE) CONSTRAINT "NN_RATINGCONFIG_SERVICEID" NOT NULL ENABLE,
        "JAVASCRIPTREGEX"      VARCHAR2(255 BYTE),
        "SYSTEMPARAMETERGROUP" NUMBER,
        "DISPLAYORDER"         NUMBER(3,0),
        "ALERTMSG"             VARCHAR2(200 BYTE),
        CONSTRAINT "PK_RATINGCONFIG" PRIMARY KEY ("RATINGCONFID")
    In above script i am removing constraint on "value" column which is having  not null constraint.
    4) column "value" having such data like 'null'
    5) Error
    "Exception while caching Rating System Parameter Details.[TimesTen][TimesTen 11.2.2.2.0 ODBC Driver][TimesTen]TT0871: Column VALUE cannot be set to null "

  • How to alter table in sql server2008

    Hi Friends, I have import one table and want to alter table. How do i do this

    Hi ,
    YOu need Alter Command for the same. but you have to specify what you want to Alter.
    For Reference
    To add a column in a table, use the following syntax:
    ALTER TABLE table_name
    ADD column_name datatype
    To delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column):
    ALTER TABLE table_name
    DROP COLUMN column_name
    To change the data type of a column in a table, use the following syntax:
    ALTER TABLE table_name
    ALTER COLUMN column_name datatype
    http://www.techonthenet.com/sql/tables/alter_table.php
    http://www.tutorialspoint.com/sql/sql-alter-command.htm
    Thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem.

  • Altering table degrade performance - Help needed?

    Hi,
    I have a table called test_case which has 60 million records.
    I got a requirement to add new column with not null constraint and default value as 0.
    When I try to add new column with the above said constraints the schema modification taking 40 minutes.
    Alter table test_case add tax number(5) not null default 0
    Is there any workaround to modiy the schema with less minutes?
    I would appreciate if anybody help on this.
    Regards
    SP

    You wanted a faster approach that’s why I suggested this approach.  To my understanding there isn't any other method faster than CTAS method.
    Something like this you need to do  ( If you are in a position to apply the changes ) –
    1.     Create a Tables using CTAS method I mentioned
    CREATE TABLE New_Table ( col1,
                                            Col2,
                                             tax number(5)  Not Null
    As Select col1
                    ,col2
                    ,0
    From  Original_Table;
    2.     Disable the constraints ( Original Table )
    3.     Rename the Original_Table to Original_Table_Bak
    4.     Rename the  New_Table  to the Original_Table
    5.     Enable back the constraints
    6.     Drop the Original_Table_Bak

  • Alter Table Add column not null default value

    I want to add two columns to a table with not null and default as 0 for both columns
    Can i write the whole in one statement or do i have to split statement
    I tried this, but didn't work
    alter table DWSODS01.DWT00301_ORD_DTL_OMS add (
    COMB_ORD_FLG NUMBER(5,0) default 0 not null,
    COMB_ORD_NO NUMBER(12,0)
    default 0 not null);
    How can i modify the code?

    user10390682 wrote:
    I tried this, but didn't workSince you are specifying default values, it should work (regardless if table DWSODS01.DWT00301_ORD_DTL_OMS is empty or not):
    SQL> select count(*) from emp1
      2  /
      COUNT(*)
            14
    SQL> alter table emp1 add (
      2  COMB_ORD_FLG NUMBER(5,0) default 0 not null,
      3  COMB_ORD_NO NUMBER(12,0)
      4  default 0 not null);
    Table altered.
    SQL> desc emp1
    Name                                      Null?    Type
    EMPNO                                              NUMBER(4)
    ENAME                                              VARCHAR2(10)
    JOB                                                VARCHAR2(9)
    MGR                                                NUMBER(4)
    HIREDATE                                           DATE
    SAL                                                NUMBER(7,2)
    COMM                                               NUMBER(7,2)
    DEPTNO                                             NUMBER(2)
    COMB_ORD_FLG                              NOT NULL NUMBER(5)
    COMB_ORD_NO                               NOT NULL NUMBER(12)
    SQL> What error are you getting?
    SY.

  • How to change default value in a table using ALTER TABLE

    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    Any help will be needful for me
    Thanks and Regards

    user598986 wrote:
    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    ALTER TABLE  test
    MODIFY (indicator DEFAULT 'I'); 
    Incidentally, INDICATOR is a keyword in Oracle, so you may have problems using it as a column name. If so, you'll have to enclose the column name in double-quotes, and be careful to use capital letters inside the quotes.
    Edited by: Frank Kulash on Aug 26, 2009 11:42 AM

  • Deadlocks with ALTER TABLE DISABLE CONSTRAINT

    Hello,
    We're deleting millions of redundant rows from a particular table in our live 10g database. This is being done online because the downtime would be unacceptable. The table in question has 30 child tables, so for speed I am disabling the foreign keys using ALTER TABLE DISABLE CONSTRAINT before the deletion (we haven't had any constraint violations for ages). Without this, deletion takes about 1 second per row i.e. a very long time.
    However, we're finding that ALTER TABLE DISABLE CONSTRAINT often reports ORA-00060: deadlock detected. This is causing problems with the live system. Can anyone think of the reason why a deadlock might occur in this situation and what we could do to prevent it happening? Note that any solution has to be doable without downtime unless it takes less than 30 minutes.
    Thanks a lot
    Ed
    Edited by: edwiles on Feb 4, 2009 6:02 AM

    look suggestions in the similar thread:
    Re: Deadlock when deleting a not linked data record in a parent table

  • Alter table tablename drop column col

    I tried to drop a column from a table created by sys user. Being a sys user I am unable to drop the column. Please explain.
    SQL> alter table test move tablespace users;
    Table altered.
    SQL> alter table test drop column two;
    alter table test drop column two
    ERROR at line 1:
    ORA-12988: cannot drop column from table owned by SYS
    Here two is the column name.
    Regards
    Vijay Kumar

    Hello Gasparotto
    It is amazing to me. Being a sys user I created a table and then I tried to alter the table by dropping a column but it is giving me error as I have already stated. Please explain over this issue.
    Regards
    Vijay Kumar

  • Alter table then Update in PL/SQL block

    I am trying to alter the table then update it :
    declare
    colCount number;*
    begin*
    select count(*) into colCount from all_tab_cols where table_name = 'TEST' and owner = 'TEST_OWNER';*
    dbms_output.put_line('No of Columns in the table : ' || colCount);*
    if colCount = 2  then*
    dbms_output.put_line('Table needs upgrade');*
    execute immediate('ALTER TABLE TEST ADD COL1 VARCHAR2(100) NULL');*
    UPDATE TEST SET COL1 = '123';*
    commit;*
    else*
    dbms_output.put_line('No Changes Required');*
    end if;*
    end;*
    Oracle complains that "COL1" is an invalid identifier.
    I also tried substitute the UPDATE statement with
    **     execute immediate('UPDATE TEST SET VCHCHARSET_OUT='UTF8' WHERE VCHCHARSETNAME='UTF8'');**
    and there is something wrong with the construction of an Update statement in the parenthesis.
    Am I taking the right approach and just need to figuire out the syntax of single quotes or something else is wrong?
    thanks in advance.

    Yes, you are absolutely right, I shouldn't alter the table and then update the values.
    The reason I need to do it relates to the migration process we utilize in our company. Initially I had a set of SQL commands which I executed migrating from one environment to another and eventually to Production. I had an error in the last SQL command which caused migration process to produce "Failure", however the table was already altered and all the rows except the last one were updated. Since I can't successfully migrate to Production with the failed process I have to generate a PL/SQL block which will take in consideration that in one environment the table has already been modified and in the other one is still needs to be changed.

  • Using dbms_metadata.get_ddl to capture the alter table

    Hi there,
    I know you can capture table ddl using dbms_metadata.get_ddl. However, I want to capture all the changes after the table got created. If you created a table then add one or more columns. I just want to capture the change as the new columns added.
    Here's an example.
    Create table test (id number, name varchar2(20);
    then
    alter table test add (type varchar2(40);
    I want to capture the syntax "alter table test add (type varchar(40)". Is this possible?
    Thanks

    I dont belive you could easily use dbma_metadata to do this... but you can use a database or schema level trigger e.g. :
    create or replace trigger test.test_trigger
    AFTER ALTER
    ON DATABASE
    DECLARE
    sql_text ora_name_list_t;
    v_stmt VARCHAR2(2000);
    n number;
    BEGIN
    n := ora_sql_txt(sql_text);
    FOR i IN 1..n
    LOOP
    v_stmt := v_stmt || sql_text(i);
    END LOOP;
    INSERT INTO test.test_table2
    VALUES
    (v_stmt);
    END;
    This will capture all alter commands fired at the database... so you would then need to filter them using the System-Defined Event Attributes see
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm#i1006211

  • 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

  • How can i make a CHECK in an ALTER table, to compare 2 Variables of TWO different tab

    I have 3 tables:
    EVALUATION (No_expert, No_article)
    EXPERT (No_expert, origine, name)
    AUTHOR_ARTICLE (No_Article, Code_author)
    AUTHOR (Code_author, Name, Original)
    and my question is: How can i make a check to refuse each time an EXPERT ADDED to the EVALUATION table. If this one is an AUTHOR, in other words, the EVALUATION.No_expert must <> than AUTHOR.Code_author.
    This is what i did but it doesn't work:
    ALTER TABLE EVALUATION ADD CONSTRAINT No_expert
    CHECK (EVALUATION.No_expert <> AUTHOR_ARTICLE.Code_author);
    thank a lot
    luong.

    See Disabling (graying-out) Form Fields by Thom Parker. It covers both Acrobat and LiveCycle forms.

  • What is the version of grant alter table, drop table to user in Oracle 10g?

    Hi,
    Oracle support "grant alter table and drop table" before, but I get the "invalid privilege" error in Oracle 10g. Oracle 10g have the "DROP ANY TABLE" and "Alter any table". Is these two means can drop and alter tables belonging to other users? How do I grant the total control (CRUD) of tables in the owner's schema to the owner in Oracle10g?
    Thanks,
    Jiang

    CREATE TABLE privilege grants complete control on owner's tables :
    SYS@db102 SQL> create user test01 identified by test01;
    User created.
    SYS@db102 SQL> grant create session, create table to test01;
    Grant succeeded.
    SYS@db102 SQL> alter user test01 quota unlimited on users;
    User altered.
    SYS@db102 SQL> conn test01/test01
    Connected.
    TEST01@db102 SQL> create table test(a number);
    Table created.
    TEST01@db102 SQL> alter table test add(b varchar2(100));
    Table altered.
    TEST01@db102 SQL> drop table test purge;
    Table dropped.
    TEST01@db102 SQL>                                                      

  • 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.

  • Alter table query taking more time

    Hi,
    My table T1 contains lots of data and when I am trying to run the below query its taking around 1 hour to update and some times its hanging.
    "ALTER TABLE T1 ADD COLUMN C1 INTEGER DEFAULT 1 NOT NULL;"
    How we can resolve this? Any help
    Thanks,
    Sankar

    My table T1 contains lots of data and when I am
    trying to run the below query its taking around 1
    hour to updateYes, it's normal, if it's a big table.Oracle has to update every record in your table.
    and some times its hanging.How Do you know that it hangs?

Maybe you are looking for

  • ASIO for 5.1 external SB live 24-

    I was hoping that someone could provide me with an ASIO driver for an external SB li've 24-bit. I have been trying to dub 5. surround and have had no sucess due to lack of appropraite drivers. Thanks in advance for your help.

  • Is SATA/600 good for MBP 13" i5 ?

    hey fellas, i plan on upgrading the HD that came with my new MBP 13 i5 and was wondering if a WD SATA/600 will be supported ? the plan is to upgrade to one of the following WD's WD1003FBYX WD10EALX please let me know if the second SATA/600 will work

  • Error Code 24 when making bluray iso

    I get the Error: "invalid time", Code: "24", Note: "presentation composition time may not overlap" when I try to make a Bluray iso. I have tried almost everything, mpeg-2, H264, rerender in different bitrates using Adobe media encoder, I have rebuilt

  • I keep getting logged out

    every time i try to open my ichat it keeps logging in and out until i can't login any more. why is it doing this?

  • Forms runtime key mappings

    I'm running a form that was compiled in unix and created with forms 6.0 for win NT. When I run the form in unix, the enter key does not work. When I do CTRL+K for the mappings the "RETURN---RETURN" is not there. Where and how can I modify the keyboar