Results 1 to 10 of 10

Thread: Tablespace

  1. #1
    Lieutenant Commander Warbarbie's Avatar
    Join Date
    Nov 2004
    Location
    Rome
    Posts
    16.296

    Default Tablespace

    Qualcuno sa come e se si puo cambiare il nome di una TB via Unix senza rischiare di smerdare il db?


  2. #2
    Warrant Officer Ladro di anime's Avatar
    Join Date
    Apr 2004
    Location
    Trieste
    Posts
    2.802

    Default

    Si ma di cosa , quale database e che versione?

  3. #3
    Lieutenant Commander Warbarbie's Avatar
    Join Date
    Nov 2004
    Location
    Rome
    Posts
    16.296

    Default

    Oracle 9
    Stavo(sto) nel panico e ho postato così


  4. #4
    Warrant Officer Ladro di anime's Avatar
    Join Date
    Apr 2004
    Location
    Trieste
    Posts
    2.802

    Default

    da quello che so si, arrivo a casa e ti dico.

  5. #5
    Lieutenant Commander Warbarbie's Avatar
    Join Date
    Nov 2004
    Location
    Rome
    Posts
    16.296

    Default

    Ho provato con la procedura tramite TOAD, ma non mi fa mettere offline la tablespace per il cambio.
    Randolk me l'ha sempre detto di non toccare un cazzo il venerdi sera pd


  6. #6
    Warrant Officer Ladro di anime's Avatar
    Join Date
    Apr 2004
    Location
    Trieste
    Posts
    2.802

    Default

    Mo ci guardo, ma cmq si fa tramite un comando sql, prima di fare qualsiasi cosa fatti un export del database che devi toccare.

  7. #7
    Warrant Officer Ladro di anime's Avatar
    Join Date
    Apr 2004
    Location
    Trieste
    Posts
    2.802

    Default

    Tablespace Rename Overview

    In Oracle 10g, you can simply rename a tablespace TBS01 to TBS02 by issuing the following command:

    ALTER TABLESPACE tbs01 RENAME TO tbs02;

    However, you must follow the rules when renaming a tablespace:

    You must set compatibility level to at least 10.0.1.
    You cannot rename the SYSTEM or SYSAUX tablespaces.
    You cannot rename an offline tablespace.
    You cannot rename a tablespace that contains offline datafiles.
    Renaming a tablespace does not changes its tablespace identifier.
    Renaming a tablespace does not change the name of its datafiles.
    Tablespace Rename Benefits

    Tablespace rename provides the following benefits:

    It simplifies the process of tablespace migration within a database.
    It simplifies the process of transporting a tablespace between two databases.
    Examples

    Example 1: Rename a tablespace within a database. In Oracle9i or earlier releases, you must take the following steps to rename a tablespace from OLD_TBS to NEW_TBS:

    Create a new tablespace NEW_TBS.
    Copy all objects from OLD_TBS to NEW_TBS.
    Drop tablespace OLD_TBS.
    In Oracle 10g, you can accomplish the same thing in one step:

    Rename tablespace OLD_TBS to NEW_TBS.
    ALTER TABLESPACE RENAME old_tbs to new_tbs;

    Example 2: Transport a tablespace between two databases. In the following example (see figure 3.2), you cannot transport a tablespace TBS01 from database A to database B in the previous release of Oracle server because database B also has a tablespace called TBS01. In Oracle 10g, you can simply rename TBS01 to TBS02 in database B before transporting tablespace TBS01.


    In sintesi dovresti creartene uno nuovo e poi spostare tutto da uno all'altro.

    Quello che ricordavo io è solo per la 10g

  8. #8
    Warrant Officer Ladro di anime's Avatar
    Join Date
    Apr 2004
    Location
    Trieste
    Posts
    2.802

    Default

    Altrimenti puoi passare con l'export/import

    Oracle 9i:

    SQL> CREATE TABLESPACE test1 DATAFILE ‘/u01/app/orsbox/proddata/test1.dbf’ size 500M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

    Tablespace created.

    For Renaming the tablespace, we don’t have a direct command in 9i. For that we need to follow the below steps.

    1) Export all of the objects from the tablespace

    [orsbox@ocvmrh2124 9.2.0]$ exp system/manager FILE=test1.dmp LOG=test1.log TABLESPACES=test1

    Export: Release 9.2.0.3.0 – Production on Thu Jul 12 01:02:37 2007

    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

    Connected to: Oracle9i Enterprise Edition Release 9.2.0.3.0 – Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 – Production
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set

    About to export selected tablespaces …
    For tablespace TEST1 …
    . exporting cluster definitions
    . exporting table definitions
    . exporting referential integrity constraints
    . exporting triggers
    Export terminated successfully without warnings.

    2) Drop the tablespace including contents

    SQL> drop tablespace test1 including contents;

    Tablespace dropped.

    3) Recreate the tablespace

    SQL> CREATE TABLESPACE test2 DATAFILE ‘/u01/app/orsbox/proddata/test1.dbf’ size 500M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

    Tablespace created.

    4) Import the objects

    [orsbox@ocvmrh2124 9.2.0]$ imp system/manager FILE=test1.dmp LOG=test1.log FULL=Y TABLESPACES=test2

    Import: Release 9.2.0.3.0 – Production on Thu Jul 12 01:27:47 2007

    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

    Connected to: Oracle9i Enterprise Edition Release 9.2.0.3.0 – Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 – Production

    Export file created by EXPORT:V09.02.00 via conventional path
    import done in US7ASCII character set and AL16UTF16 NCHAR character set
    . importing SYSTEM’s objects into SYSTEM
    Import terminated successfully without warnings.
    [orsbox@ocvmrh2124 9.2.0]$

    Io sono sempre passato per l'utente, visto che andiamo con 1 tablespace -> 1 utente.

    Per cui facevo l'export dell'utente e lo reimportavo in un altro utente che aveva di conseguenza un'altro tablespace di riferimento.
    Last edited by Ladro di anime; 15th January 2010 at 19:15.

  9. #9
    Tanek's Avatar
    Join Date
    Apr 2004
    Location
    Milano, Midgard
    Posts
    11.225

    Default

    Si ma se è un tablespace peso (con molti dati) ci metti una vita a fare import/export immagino..
    (beh che se dici che hai sbagliato il nome mi sa che l'hai appena creato e quindi è vuoto :P )

    ps: no, non devi toccare un cavolo il venerdì sera

    Tanek™: Game Designer & Algorithm Mastermind, Team Leader & SW Engineer and Dungeon Master!
    "Datte Foco"™ and "Ma KITTESENCULA"™ are registered trademarks of Tanek Entertainment Inc.
    ‎"One of these days, scientists will discover that second X chromosome contains nothing but nonsense and twaddle." - Sheldon Cooper
    Per non dimenticare:
    Spoiler


  10. #10
    Lieutenant Commander San Vegeta's Avatar
    Join Date
    Oct 2003
    Location
    Bologna
    Posts
    12.153

    Default

    dalle 14 di venerdì non si fa niente di anche vagamente importante, ed è buona norma staccare il telefono in ufficio
    I rubinetti a casa di Chuck Norris non perdono, vincono.

    In the beginning there was nothing...then Chuck Norris Roundhouse kicked that nothing in the face and said "Get a job". That is the story of the universe.

    Quote Originally Posted by Wolfo View Post
    Concordo e propongo ban temporanei per chi critica la topa , la topa non si critica , dal trombabile in su non si commenta in modo sgradevole.
    la tua ignoranza in materia e' raccapricciante
    -cit. Estrema, 2022

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
[Output: 76.02 Kb. compressed to 64.54 Kb. by saving 11.49 Kb. (15.11%)]