Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to rename a table ?

Re: How to rename a table ?

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1997/01/03
Message-ID: <32cc80f3.11511212@dcsun4>#1/1

You can use rename to rename a table:

SQL> create table a ( a int );  

Table created.  

SQL> insert into a values ( 1234567890 );  

1 row created.  

SQL> rename a to b;  

Table renamed.  

SQL> select * from b;  

         A



1234567890  

SQL> <quote>

SYNTAX:   RENAME old TO new  

where:  

old

    is the current name of an existing table, view, sequence, or private     synonym.  

new

    is the new name to be given to the existing object.  

PREREQUISITES:
    The object must be in your own schema. </quote>

On Thu, 02 Jan 1997 21:19:09 -0600, Tony DeFelice <tonyd_at_communique.net> wrote:

>Atif Ahmad Khan wrote:
>>
>> I have a table that is serving data to web users around the clock.
>> Its a rather huge table, has a primary key and a couple of indices also.
>>
>> I figured that instead of trying to update 5,000 rows in the main
>> 200,000 rows table, I may be better off doing it all to a temporary
>> table while dropping its indices to improve performance and when I am
>> done, drop the main table and rename the temporary table as the main table.
>>
>> Is this possible ? Also is this a good solution ? I looked up the alter
>> table command in the SQL Reference manual and did not find a way to rename
>> a table.
>>
>> Thanks in advance for any pointers.
>>
>> Atif Khan
>> aak2_at_ra.msstate.edu
>
>There is no way to rename a table in Oracle...
>
>You can however create a new table with the same definition as an
>existing table by using an insert into statement such as:
>
>insert into <newtablename>
>select * from <existingtablename>
>
>In your case, I would look more closely at your indexing, because
>updating 5,000 rows out of 200,000 rows is not that much...
>
>1st try to create an index (or a temporary index) on the entire where
>clause of your update statement.
>
>If this doesn't speed things up enough, you may wish to try inserting
>new rows into a non indexed table, then creatinging indexes on it.

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Fri Jan 03 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US