Creating a new table, to replace an old one

Hi experts;
I'm looking for an advice about what I'm going to do.
This is the situation;
I got a production table with more than 1,000,000,000 of records.
the queries to this table are too slow, and I decided to create a new table, to replace this one.
But my doubts are:
How can I create a new table including the same structure as the old one, and with some data.
I got this query:
Create new_table as select * from old_table
where trans_year = '2012';
I know with this I got the structure, but what about indexes?
My other doubt is, to replace the old one, just I drop it, and rename the new one?
This table belong to an oracle 9i DB.
Thanks for your comments.
Al

>
How can I create a new table including the same structure as the old one, and with some data.
I got this query:
Create new_table as select * from old_table
where trans_year = '2012';
I know with this I got the structure, but what about indexes?
My other doubt is, to replace the old one, just I drop it, and rename the new one?
This table belong to an oracle 9i DB.
>
You could export the table metadata and then import it as a renamed table. That would keep the indexes, triggers, constraints.
But for one table it may be easier to just recreate the indexes and other objects.
For the query you may want to disable logging of the INSERT.
Create table new_table NOLOGGING as select * from old_table where trans_year = '2012';
-- set the table back to logging mode
ALTER table new_table LOGGING;Then you can drop the old table (if you already have a backup of it) and rename the new one to the old name.
The create will perform much better with NOLOGGING but because it is not logged you will not be able to recover the data from the log files.
So you should take a backup afterward.

Similar Messages

  • How to create a new table based out of old data rows

    Hi All,
    How to create a new table based out of old data rows. Also how can we find out the DBF for different users in a database?
    Saqib

    Not very clear what you need. I'll try to interpret...
    How to create a new table based out of old data rowsIf this means how to create a table from an existing one, then you can do :
    SQL> create table <new table> as select * from <old table>;
    if you need a subset of rows you can add a where clause.
    how can we find out the DBF for different users in a database?Here I need some more clarification. What do you mean exactly ?

  • HT5858 I can't update apps on my iphone 5. theirs an old apple ID. That I don't have the pass word. I've created a new apple ID. but the old one keeps popping up. I have it on the Itunes on the phone but the old one keeps comming up and asking for a pass

    I can't update apps on my iphone 5. theirs an old apple ID. That I don't have the pass word. I've created a new apple ID. but the old one keeps popping up. I have it on the Itunes on the phone but the old one keeps comming up and asking for a pass word. 

    Apps are permanently tied to the Apple ID used to purchase them. You will have to delete the apps from the phone and re-purchase them using your Apple ID.

  • I have Photoshop Elements 9 on an iMac with OS 10.6.8. I bought a new printer/scanner and the program will not import the new scanner to replace the old one. How do I do this?

    I have Photoshop Elements 9 on an iMac with OS 10.6.8. I bought a new printer/scanner and the program will not import the new scanner to replace the old one. How do I do this?

    Thank you for your suggestions. I downloaded a more recent version of Twain, but this didn't help. I also tried closing and opening Photo Shop and restarting my computer without success. Reinstalling Photo Shop sounds like a very promising solution, but I'm  not sure I will do it. In the meantime I can scan items using a printer program. These scans open in Photo Shop. It is an extra step.

  • Creating a new table next to an existing one

    I have attached the table I created...(I'm a
    beginner....forgive me for being simplistic in design). I want to
    create a separate table for "Friday" right next to the existing
    table. How do i get the new table to align to the right of the
    existing table? I tried just extending the table- that is, adding
    rows/columns so that I could then arrange it to look like a
    separate table, but couldn't get it to work....lost in "format
    hell."
    I know it must be easy....
    Also....why can't i seem to add or delete cells from this
    table?! There is some formatting error I'm making that I can't
    understand.
    thanks!

    To select a whole table, click in it in Design view. Then
    look at the Tag
    Selector bar. Click on the right-most <table>. You've
    just selected an
    entire table. Cut it from the page with Ctrl-X. Then click in
    the outer
    table's left cell, and paste the cut table in with Ctrl-V.
    Like that.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "bj nick" <[email protected]> wrote in
    message
    news:[email protected]...
    > Thanks for your response.
    >
    > When I try this, the entire table is "cut." I've tried
    it several ways to
    > no
    > avail. Also, when I select cells to delete, they will
    not delete. I will
    > select
    > a row of unused cells, and can't delete them. I don't
    get it.
    >
    > Here is the code:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    > "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="
    http://www.w3.org/1999/xhtml">
    > <head>
    > <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    > <title>Untitled Document</title>
    > <style type="text/css">
    > <!--
    > .style10 { font-size: 18px;
    > font-weight: bold;
    > }
    > .style12 {font-size: 18px}
    > .style15 {color: 18; font-size: 18px; }
    > .style16 {font-size: 18}
    > .style3 {color: 18}
    > -->
    > </style>
    > </head>
    >
    > <body>
    > <table width="674" border="0">
    > <tr>
    > <td width="615"><table width="578"
    border="2">
    > <tr>
    > <td width="130" bgcolor="#66FF00"
    class="style3"><div
    > align="center"
    > class="style10">Monday </div></td>
    > <td width="127" bgcolor="#66FF00"
    class="style3"><div
    > align="center"
    > class="style10">Tuesday</div></td>
    > <td width="137" bgcolor="#66FF00"
    class="style3"><div
    > align="center"
    > class="style10">Wednesday</div></td>
    > <td colspan="2" bgcolor="#66FF00"
    class="style3"><div
    > align="center"
    > class="style10">Thursday</div>
    > <div align="center"
    class="style10"></div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"
    class="style15"><div
    > align="center">First Bell </div>
    > <div align="center"></div>
    > <div align="center"></div>
    > <div align="center"></div>
    > <div align="center"></div></td>
    > </tr>
    > <tr>
    > <td bgcolor="#FFCC00" class="style3"><div
    align="center"
    > class="style12">Attendance
    / </div></td>
    > <td bgcolor="#FFCC00" class="style3"><div
    align="center"
    > class="style12">Homework check-in /
    </div></td>
    > <td colspan="3" bgcolor="#FFCC00"
    class="style3"><div align="left"
    > class="style12">Class business / Journals
    </div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"
    class="style3"><div
    > align="center"
    > class="style12">Five - a - Day
    </div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"
    class="style3"><div
    > align="center"
    > class="style12">Reading</div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"
    class="style3"><div
    > align="center"
    > class="style12">Math</div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"><div
    align="center"
    > class="style12">Recess</div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"><div
    align="center"
    > class="style12">Language Arts </div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"><div
    align="center"
    > class="style12">ELD (English Language
    Development)</div></td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"><div
    align="center"
    > class="style12">Lunch</div></td>
    > </tr>
    > <tr>
    > <td bgcolor="#FFCC00">Science/Soc. Studies
    </td>
    > <td bgcolor="#FFCC00">Science/Soc.
    Studies</td>
    > <td bgcolor="#FFCC00">Science/Soc.
    Studies</td>
    > <td width="147" bgcolor="#FFCC00">Science/Soc.
    Studies</td>
    > <td width="1"
    bgcolor="#FFCC00"> </td>
    > </tr>
    > <tr>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > </tr>
    > <tr>
    > <td colspan="5" bgcolor="#FFCC00"><div
    align="center"><span
    >
    class="style16">Dismissal</span></div></td>
    > </tr>
    > <tr>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > </tr>
    > <tr>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > </tr>
    > <tr>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > <td bgcolor="#FFCC00"> </td>
    > </tr>
    > <tr>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > </tr>
    > <tr>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > </tr>
    > <tr>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > </tr>
    > <tr>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > <td> </td>
    > </tr>
    > </table></td>
    > <td width="49"> </td>
    > </tr>
    > <tr>
    > <td> </td>
    > <td> </td>
    > </tr>
    > </table>
    > <p> </p>
    > <p> </p>
    > </body>
    > </html>
    >
    >

  • Creating a new table similar to an existing one

    Hi,
    I need to implement a stored procedure with the follwing signature (simplified)
    CREATE_TABLE_AS(p_NewTableName , p_OrigTableName , p_Col1, p_Col2, p_Col3)
    It should do the following:
    Creating a new, empty table with name p_newTableName. The new table has three columns, which names are passed as parameter p_Col1, p_Col2, p_Col3
    The columns must be of the same type as the columns p_Col1, p_Col2, p_Col3 of the Table p_OrigTableName
    How is this achieved?
    I could read the column type information from the catalog sys.user_tab_columns, but I wonder if there is another solution
    Marco

    Hi Rob,
    Hi,
    Thank you, it works fine.
    I actually need rows from two Original tables. I came up with the following query by adapting your query:
    CREATE TABLE TEST_TABLE AS SELECT * FROM
    (SELECT NAME FROM T1 WHERE ROWNUM = 0) t1,
    (SELECT AGE FROM T2 WHERE ROWNUM = 0) t2;
    I chose ROWNUM = 0 instead of 1=0. Doesn't this make a performance difference when the original tables contain a large number of rows?

  • New style keyboard replace by old one

    I bought the new 3gs and when I put it to iTunes to sync the info from my old phone it changed the new style of keyboard back to the old one! I want the new one back, anyone know how and still be able to keep my music and contacts?

    confused? its a new iPhone, what did you have before? what "style" of keyboard did you have before?

  • Creating a new web site -- updating an old one

    Hi all,
    I have a web site that I haven't updated in maybe five years. I didn't have the Mac then. I created it with Microsoft FrontPage.
    How would I go about updating this site from my Mac?
    I might just want to start completely over with a new design and content. What tool/program do you recommend? Is there a way to see what I can do with it before buying anything? Is there a free program that I can get started with?
    Thanks!
    Message was edited by: Bruce Delaplain1

    Hi Bruce,
    Yes, you can keep your domain name to use with iWeb. After completing it, publish your completed site to a folder instead of .Mac and then use an ftp program to load to your personal domain. Obviously you would need to remove the original folders that you created in FrontPage. You do loose some of the functions of iWeb by doing it this way though.
    You can also go to your .Mac account and add your personal domain and then use a CNAME alias to point iWeb to your personal domain. This might be the easier way to do it.
    I don't think iWeb and iLife 08 are compatible with OS 10.3. You would have to upgrade to at least OS 10.4. I had an old iMac with 10.3 and I never had iLife on it. I did however have a MacBook with 10.4 and that had iLife 06 on it. I now have iLife 08 which is even better.
    Good luck. I am also in the process of updating a website of mine that I originally created with FrontPage on a PC with iWeb. I have two websites and decided to do this for the sake of uniformity but with different colours. I think you will be pleased with the result. My new iWeb site looks fresher in comparison to my now dull and boring FrontPage site. iWeb certainly looks more professional than FrontPage.

  • Firefox 4 on Win7 uses 100% CPU for Favicon Animation. Allready reinstalled it, created a new Profile and deleted the old one. Firefox still gets very slow over time. Any more suggestions?

    OS is Win7 64Bit

    You will find appropriate Consumer-specific support by beginning your own, new thread in this forum =>
    http://answers.microsoft.com/en-us/protect/forum/protect_scanning
    ~Robear Dyer (PA Bear) MS MVP-Windows Client since 2002 Disclaimer: MS MVPs neither represent nor work for Microsoft

  • I got a new computer to replace my old one, when I try to sync my ipad to my laptop it wants me to restore to factory default then sync with the things I have in itunes, the problem is i dont have all of the things in my itunes that I have on my ipad.

    So if I do this will I loose my music and some of my audiobooks that I do not have in itunes? I have tried to go to the store and download them again but they want me to buy them again. PLEASE HELP!!!

    See Recover your iTunes library from your iPod or iOS device.
    tt2

  • I have a new laptop to replace my old one and need to install my itunes library on there, so that all the stuff on my phone, including music is transfered to my new computer

    please advise

    The "missing file" error happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, one of its parent folders, or the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place. In the case of a library moved from one system to another there are also potential permissions issues. See Repair security permissions for iTunes for Windows.
    Select a track with an exclamation mark, use Ctrl-I to Get Info, then click No when asked to try to locate the track. (Due to a bug in iTunes 12 you currently have to say No twice!) Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, a folder renamed, or a drive letter has changed, it should be possible to reverse the actions. If the difference between the two paths is an additional Music folder in one path then this is a layout issue. I can explain further if that is the case.
    In some cases iTunes may be able to repair itself if you go through the same steps with Get Info but this time click Locate and browse to the lost track. It may then offer to attempt to automatically fix other broken links.
    If another application like Windows Media Player has moved/renamed the files then the chances are that subtle differences in naming strategies will make it hard to restore the media to the precise path that iTunes is expecting. In such cases, as long as the missing files can be found somewhere, you should be able to use my FindTracks script to reconnect them to iTunes. See this post for an explanation of how it works.
    See also Recover your iTunes library from your iPod or iOS device.
    tt2

  • Why won't the iTunes Store take a new credit to replace an old one.

    I get a message saying there is a problem with a previous purchase. Please update your payment method. no matter what i do i get this over and over even tho both are active credit cards it just wont accept it and because of this i cant update any of my apps on iphone or ipad

    Sometimes when you get that message it is because you did not enter your 3 digit security number found on the back of the card by the signature line, or your address as entered into the iTunes database does not match exactly the address on the billing statement of the credit card.

  • Hard drive dead with iweb site inside.  new iweb site replaced my old site!

    Is the old site a gonner? I had published the site with a personal domain, hosted with mobile me. When adding a new site, iweb replaced my old one. the old one was my business portfolio. the new one is just a single property advertisement.
    why dont I see my old site on mobile me? (even before I published this new one)

    I don't believe so. Not unless the new site had the same name as the old/business site. Mount your iDisk and check inside the Web/Sites folder for your personal and business site folders.
    What type of domain name forwarding are you using? If your business site is in a different domain file than the personal site the last published site will have the minimal URL for your MMe account: http://web.me.com/yourMMe_AccountName/.
    You may have to change your domain name forwarding to include the business site name in the URL: http://web.me.com/yourMMe_Account_Name/Business_SiteName/.
    OT

  • How can i start a new user profile service in ordre to replace an old one ?

    hi
    i create a new user profile service in ordre to replace an old one 
    when i use : Get-SPServiceApplication i can see that hi is created but
    when i use Get-SPServiceInstance i can see it i can see only the old one 

    Hi,
    The Get-SPServiceInstance returns the services instance for a specific server or the entire farm. The service instance GUID is unique to every farm and cannot be changed.
    For starting a fresh with the User Profile Service configuration, you can unprovision and re-provision the User Profile Service:
    http://sharepoint.stackexchange.com/questions/16146/deleted-service-application-service-instances-remain
    http://www.harbar.net/articles/sp2010ups2.aspx#ups14
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • I have just purchased a new ipad2 to replace my old ipad. How do i sync all the data in my apps I am worried about losing my data?

    I have just purchased a new ipad2 to replace my old ipad. How do i sync all the data in my apps I am worried about losing my data?

    iPad settings and data created and stored by a 3rd party party app along with app settings are included with the iPad's backup along with other data.
    If you are syncing your iPad direct with iTunes on your computer via USB, the iPad's backup is updated as the first step during the iTunes sync process.
    The first time you connect a new iPad or iOS device to iTunes that is used to sync with another iOS device, you are prompted to transfer the backup for the other iOS device to the new device. This is followed by a sync to transfer the same content from your computer that is on the old iPad to the new iPad such as music, movies, tv shows, 3rd party apps, photos, audio and print books, etc.

Maybe you are looking for

  • Duplicating Photos in iPhoto '08 is rough - any solutions?

    Two problems: One is that duplicating photos in iPhoto doesn't always work. Usually when I highlight a photo and select "Duplicate" I get a new version of the photo. Sometimes it does nothing at all, and other times it take me out of the event that I

  • How to Repair A File Changed into an Alias?

    hello, so i have a really frustrating problem. and here it is: --oct 25 i backed up all my files onto an external hard drive (EHD) --i upgraded my osx from snow leopard to mavericks --attached my EHD to laptop to retrieve files --discovered that seve

  • Material Staging for Production Order

    Hi, I am doing Material Staging against production Order using T Code MF60. We don't have WM setup in the enterprise structure so the Staging is done via IM Mvmt. Type 311. My problem is that the material document created using MF60 does not have a r

  • R12 SLA drilldown security:How to restrict drilldown based on source/AppI

    Hi All, We are on R12 and SLA is configured and working fine. However we have a special requirement while performing drilldown from GL- SLA Navigation GL Super user -->Inquiry--> Journal -->Review Journal--> Line Drilldown Currently we can drilldown

  • G5 Dual 1.8Ghz with 2.5GB of RAM...logic studio!!!

    Would Logic 8 run smoothly with these specs?