Move tables (some with LONG datatypes) across tablespaces in Oracle 9i

I have a 14GB tablespace which about 3,000 tables (and only tables) in. Only 2.6GB is used so I would like to resize the tablespace to about 3GB initially.
I moved the tables with "alter table <owner>.<tablename> move tablespace <tablespace>" and this worked for most of the tables but failed on some with this kind of error:
alter table IFSAPP.COMMAND_SYS_BUFFER_TAB move tablespace IFSAPP_DATA_TEMP
ERROR at line 1:
ORA-00997: illegal use of LONG datatypeI then moved the other tables back to the original a little frustrated.
Further reading suggested exporting and importing the tables is the way to go.
I prefer the alter table because Oracle manages the lock whilst it moves. If I export and import, the table could change in between, potentially ending with me importing an old copy, couldn't it? [It seems neigh on impossible to guarantee an available window to do much!]
So I though I could you the alter table move for ALL tables and those that are left, use export/import, to minimise the risk.
How should I proceed?
1) Create TEMP_TABLESPACE as 3GB
2) "alter table ... move tablespace ..." for all tables in ORIGINAL_TABLESPACE to TEMP_TABLESPACE
3) For the remaining tables, individually:
a) lock table (not sure how)
b) export table: exp user/pass tables=tablename file=exp.dmp rows=yes
c) drop table
d) create table in TEMP_TABLESPACE*
e) import table: imp user/pass tables=tablename
* this means I need to know how to re-create the table. It also means views and indexes and packages are going to become invalid.
4) drop tablespace ORIGINAL_TABLESPACE
5) Create ORIGINAL_TABLESPACE as 3GB
6) "alter table ... move tablespace ..." for all tables in TEMP_TABLESPACE to ORIGINAL_TABLESPACE
7) For the remaining tables, individually:
a) lock table (not sure how)
b) export table: exp user/pass tables=tablename file=exp.dmp rows=yes
c) drop table
d) create table in ORIGINAL_TABLESPACE
e) import table: imp user/pass tables=tablename
This seems high risk and messy.
Has anyone advice or tips to make it simpler?
As it stands I am considering leaving alone, the risks worry me!
Thanks

Interesting idea.. so this would create a temporary table in the temporary tablespace.
Rather than set the default tablespace, can I merely add the tablespace clause?
COPY FROM user/password@database CREATE TmpTblName TABLESPACE TmpTablespace USING SELECT
* FROM Table_name;
Either way - can you confirm for each table, I would need to:
COPY FROM user/password@database CREATE TmpTblName TABLESPACE temp_tablespace USING SELECT * FROM Table_name;
At this point all indexes for these will be invalid.
Drop tablespace ORIGINAL_TABLESPACE
Create ORIGINAL_TABLESPACE as 3GB
COPY FROM user/password@database CREATE TblName TABLESPACE original_tablespace USING SELECT * FROM TmpTable_name;
rebuild any indexes which are unusable.
recompile any invalid objects

Similar Messages

  • How to get length of data on column with long datatype

    How to get length of data on column with long datatype without using pl/sql block

    ...another reason not to use LONG datatype for columns.
    Oracle advises to switch to LOB columns instead
    SQL> create table t
      2  (x long)
      3  /
    Table created.
    SQL> insert into t values (rpad ('x', 10000, 'x'))
      2  /
    1 row created.
    SQL> alter table t
      2  modify x clob
      3  /
    Table altered.
    SQL> desc t
    Name                                      Null?    Type
    X                                                  CLOB

  • Exporting a table with Long datatype col. name

    Hello,
    I need help exporting a table, One of the column is long datatype.
    How can I do this without using Export Util?
    Is it possible.
    (If someone has a solution then PLEASE Email
    me)
    URGENT.
    Thanks.
    Pankaj Patel.

    Just wanted to find out, if you already solved this problem. I have a similar issue with long column. I am trying to sql dump a table with long column that will be imported into another database(probably using sql*load), but the spooled file puts the data from the long column in separate lines 80 char long and not on a single line. I have set the long to 64000 and linesize to 32000. Wrap is on too.
    null

  • Using Decode with "Long" datatypes

    Hi,
    I want to use a select statement in a view which uses a decode function involving a "long" datatype. But doing some raises an error "Invalid datatypes". Is there a way around?
    Anupam.

    I'm a bit puzzled as to what it is you are trying to achieve (it has been an afternoon for vague requirements). Normally the sort of data that we would want to store in a LONG is ,er, long and therefore not susceptible to use in a DECODE. But it does not matter, because we can only manipulate LONGs in PL/SQL and that does not parse DECODE statements. We will have to use IF...ELSE constructs instead.
    CREATE OR REPLACE FUNCTION l2v (pl in rowid)  RETURN VARCHAR2
    AS
        ll LONG;
        rv VARCHAR2(20);        
    BEGIN
       SELECT col1
       INTO ll
       FROM   T_LONG
       WHERE  rowid = pl;
       IF ll LIKE '%text%'
       THEN
          rv := 'yes!';
       ELSE
          rv :=  'noooo';
       END IF;
       RETURN rv;
    END;
    SQL> select l2v(rowid) from t_long;
    L2V(ROWID)
    yes!
    yes!
    SQL> You can use this function in a query. Note that it is doing a SELECT in its own right so this will not be a very performant solution if you build the view on a big table.
    Cheers, APC

  • Move Table on Ora 9.2 from tablespace to another (dictionary managed)

    Hello,
    is it possible to move tables with brtools from dictionary managed tablespace to another dictionary managed tablespace on Oracle 9.2 ?

    Hello Axel,
    this is a case where the BRSPACE error is not nice, because you have no easy chance to move this one table to a LMTS tablespace. In this case I would propose you to execute ALTER TABLE MOVE directly on Oracle side:
    ALTER TABLE <table_name> MOVE TABLESPACE <target_tablespace>;
    Afterwards all indexes of the table have to be rebuilt in order to validate them again:
    ALTER INDEX <index_name> REBUILD ONLINE;
    Kind regards
    Martin

  • Selecting From Column with Long Datatypes

    create table temp
    a long
    insert into temp values ('abc');
    commit;
    select * from temp
    where a = 'abc'
    I am getting the following error while am tring to select a = 'abc';
    ora-00997 : illegal use of LONG datatype
    How can i select values from a column with long datatypes

    insert into temp values ('abc');
    cannot (must not) work, when the column is type long (thats a numeric type!!)
    -> here you get an ora- 00911 errorcode
    that the select doesn't work then should be clear.
    mfg f.humer

  • Move Table Column with AppleScript in Microsoft Word

    Microsoft Word has a flaw (in my opinion) with tables in that it aligns the left and right text with the margins rather than aligning the table columns with the margins. This results in sloppy tables, because the left and right borderlines lie outside the margins.
    I would like to fix the word tables by
    calculating the left cell padding and right cell padding in points and setting them to variables {left_pad,right_pad} respectively
    move left column by left_pad to the right
    move right column by right_pad to the left
    The script I was working on does not work, but I will post it to show my thought process as I hone in on my solution.
    tell application "Microsoft Word"
        --595 points is width of A4 paper
        -- Set page margin in points to variables
        set {l_margin, r_margin, t_margin, b_margin} to {(get left margin of page setup of active document), get (right margin of page setup of active document), get (top margin of page setup of active document), get (bottom margin of page setup of active document)}
        get {l_margin, r_margin, t_margin, b_margin}
        -- Set specific Paragraph margins
        -- NOTE: If you select a table thinking you wish to drag just the left margin to the right, or the right margin to the left, this code does not accomplish this because each cell has its own paragraph formatting. This code will set the margin for every single cell, because each cell has its own margins! (separate from padding).
        set para_sel to paragraph format of selection
        set paragraph format left indent of para_sel to (centimeters to points centimeters 0.5)
        -- Aligning left and right columns of table with the margins
        -- NOTE: There is a command to set left row indent, but not right row indent (very stupid of Microsoft)
    end tell

    I have worked up something that seems to work (although I cannot promise it is the best way). Hope it helps anyone else who has this need.
    tell application "Microsoft Word"
    activate
    set findRange to find object of selection
    clear formatting findRange -- clear any previous formatting used in a find operation
    set forward of findRange to true -- find forward
    set style of findRange to "List Bullet" -- the style to look for
    tell findRange
    set gotIt to execute find find text "" -- do the search w/o matching any text
    end tell
    if gotIt is true then -- if a match was found
    copy object selection -- copy it to the clipboard
    set mySelection to (the clipboard) -- then put clipboard into a variable
    set myOffset to ¬
    (get selection information selection information type ¬
    (horizontal position relative to page)) -- now put selection info into a variable
    display dialog mySelection & return & (myOffset as text) -- then display it
    end if
    end tell

  • VERY URGENT: problem in sql query with long datatype in weblogic

    I have a problem while tryind to retrieve a column value with a long datatype using servlet and oci driver and the server is weblogic5.1 .I have used prepared statement the problem comes in the
    preparedStatement.executeQuery().
    The sql Query is simple query and runs well in all cases and fails only when the long datatype column is included in the query.
    The exception that comes on the weblogic server is that :
    AN UNEXPECTED EXCEPTION DETECTED IN THE NATIVE CODE OUTSIDE THE VM.

    Did you try changing the driver then?
    Please use Oracle's thin driver instead of the oci driver.
    There are many advantages of using the type 4 driver. the first and foremost being that it does not require oracle client side software on your machine. Therefore no enteries to be made in tnsnames.ora
    The thin driver is available in a jar called classes112.zip the class which implements the thin driver is oracle.jdbc.driver.OracleDriver
    the connection string is
    jdbc:oracle:thin:@<machine name>:1521:<sid>
    please try out with the thin driver and let me know.
    regards,
    Abhishek.

  • Substr with long datatype

    i try to use the substr function with the long datatype but it gave me error ora-00932 inconsistant datatypes...........

    i had saw u r given link and try that example also but it gave me the same ora-06502
    declare
    text_c1 varchar2(32767);
    sql_cur varchar2(2000);
    begin
    sql_cur := 'select '||'text'||' from
    '||'alpine'||'.'||'letters'||' where letter_id =
    '||chr(39)||7||chr(39);
    dbms_output.put_line (sql_cur);
    execute immediate sql_cur into text_c1;
    text_c1 := substr(text_c1, 1, 4000);
    --RETURN ;                                      
    dbms_output.put_line (TEXT_C1);
    END;

  • Replace operator with long datatypes

    hi. i am trying to run the following replace command, but i have not had experience of using it before.
    update UNI72TEST.SCMAPPING set attributes = trim(replace(attributes,'TLCLIVE','TLCTEST'))
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected NUMBER got LONG
    is there a to_long converter at all? i cant seem to find one

    If your long data is not too big, maybe you could use this workaround ( said that, i should mention, the other advices are correct and you should try to migrate from long to clob instead).
    SQL> create table t_long(c_long long)
      2  /
    Table created.
    SQL> insert into t_long values('Hello, world')
      2  /
    1 row created.
    SQL> select * from t_long
      2  /
    C_LONG
    Hello, world
    SQL> declare
      2  l_long long;
      3  begin
      4  select c_long into l_long from t_long;
      5  l_long := replace(l_long,'world','Oracle');
      6  update t_long set c_long=l_long;
      7  end;
      8  /
    PL/SQL procedure successfully completed.
    SQL> select * from t_long
      2  /
    C_LONG
    Hello, OracleBest regards
    Maxim

  • ORA-06502: error when inserting into table via db link with long datatype

    Folks,
    I am getting the following error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
    This occurs when an insert is done via a database link into a table that has a LONG data type for one of the columns, and the string contains some carriage returns and or line feeds.
    I have checked by removing the db link, and inserting into a local table with identical column data types, where there is no error.
    So this might be another db link bug?
    So I need to remove the carriage returns and/or line feeds
    in my pl/sql block in the page process. I have tried
    l_text := REPLACE(l_text, CHR(10), ' ');
    l_text := REPLACE(l_text, CHR(13), NULL);
    but still getting the ORA-06502. Would really appreciate some advice here, please.
    Cheers
    KIM

    Scott,
    Time to 'fess up':
    My fault sorry, the error was coming from another page process where I had allowed insufficient string length for one of the variables, and my error message did not identify the page process clearly.
    This leads me to make a request for future releases, could the system error messages state which page process caused the problem?
    One other thing I notice, and this might be a feature not a fault, the page processes are numbered: "Page Process:      3 of 5". However process 3 is not the 3rd one to be processed, and probably refers to the order in which they are created. Should the number reflect the process order?
    Cheers
    KIM

  • How to get distinct data if the query contains a column with Long Datatype?

    How can we select distinct records based on a LOng column

    From the Oracle 9i SQL Reference:
    LONG columns cannot appear in certain parts of SQL statements:
    n GROUP BY clauses, ORDER BY clauses, or CONNECT BY clauses or with the
    DISTINCT operator in SELECT statements
    n The UNIQUE operator of a SELECT statement
    n The column list of a CREATE CLUSTER statement
    n The CLUSTER clause of a CREATE MATERIALIZED VIEW statement
    n SQL built-in functions, expressions, or conditions
    n SELECT lists of queries containing GROUP BY clauses
    n SELECT lists of subqueries or queries combined by the UNION, INTERSECT, or
    MINUS set operators
    n SELECT lists of CREATE TABLE ... AS SELECT statements
    n ALTER TABLE ... MOVE statements
    n SELECT lists in subqueries in INSERT statements

  • Using UPPER function with LONG datatype column

    Hi,
    Can anyone tell that how can I use UPPER function on a column which has data type as-- LONG?
    For ex--
    SELECT * FROM TABLE WHERE UPPER(LONG_COL) LIKE 'MYTEXT%';
    thanks,
    Abhijeet
    Edited by: @bhijeet ☻☻☻ on Nov 18, 2009 5:20 AM

    @bhijeet ☻☻☻ wrote:
    Yes I know that that's why I am asking about an alternate solution for it. Could you please let me know if you have any solution to do it?
    Thanks,
    AbhijeetI think you'll have to write a function to do this for you. You can use DBMS_SQL to break a LONG into pieces and work with 32K segments. I am not sure how to put the converted data back into the LOB at that point, though DBMS_SQL might provide a way to do this.

  • Impact of table columns with number datatype but has no precision in Forms

    Hi.
    Currently, I have table columns that have a data type of number but has no precision declared (e.g. AGREEMENT_CODE NUMBER). I would just like to ask if there's anyone out there who knows if this has a negative impact on Oracle's forms and reports...with the way buffer memories are allocated or other things on performance. I am still putting in maximum length values for base table items. I don't know if this will affect buffer memory allocation as well.
    Thank you.

    I don't know this for fact, but I would think that numbers with a large number of significant figures might affect buffer sizes, but I'll bet your example AGREEMENT_CODE values would never have a large number of figures. In fact, whether or not you limit the size of a number in the database or your form probably does not affect the way the actual data values are transmitted or stored.
    If someone is telling you to worry about this, I think they are barking up the wrong tree someplace way out in left field.
    There are so many other things that can seriously affect processing speed and data transfer speed, starting with query plans and index usage. I have never heard this one causing concern anywhere before.

  • Unspecified error (80004005) with LONG datatypes

    Hi,
    I am trying to create a recordset (using ADO/ASP) which has two or more LONG fields returned but an Unspecified error (80004005) is returned by the browser.
    Any help/hints on why this happening and whether this can be worked around.
    Thanks.
    null

    insert into temp values ('abc');
    cannot (must not) work, when the column is type long (thats a numeric type!!)
    -> here you get an ora- 00911 errorcode
    that the select doesn't work then should be clear.
    mfg f.humer

Maybe you are looking for

  • How do I transfer a complete MiniDV to my Mac?

    MacBook Pro, Maverick, iMovie 10 I am not into videos but I promised friends to help them transfer their MiniDV tapes to an external harddrive. I played around a bit only to realize that it was not really obvious (at least to me) how to set up iMovie

  • Mail Font formatting of headers goes crazy, Solution?

    Shame on me for messing with fonts, but here we go. After possibly deleting a "standard" font while installing new fonts, most of my Apple-made apps changed fonts. While most are back to normal, Mail is not. Screenshot: Here's what I've tried: - Wipi

  • Brand new ipod does nothing

    I just got a new ipod--it is 1st generation, but it was unopened. i have a macbook pro. i opened up the nano and immediately connected it to my computer with the same usb connector that i use for my 60gb video ipod. the ipod logo showed up for a liti

  • Mbp keyboard nonresponsive, screen freezes, ideas?

    My MBP keyboard and screen freezes; any ideas on a fix?

  • 1z0-045 - 10g upgrade exam for oracle 8i Ocps

    Hi Guys, Can any body tell me about 1z0-045 exam books or material. Thanks in advance. Ram