Import the tables to a different tablespace

    Oracle offers no parameter to specify a different tablespace to import data into. Objects will be re-created in the tablespace they were originally exported from. One can alter this behaviour by following procedure:

    Pre-Create the Tablespace & Owner

    1. Create the new different Tablespace on target DB
      For example:
      1. Source Tablespace: CDB
      2. Target Tablespace: MYTEST_DB
    2. Create the new owner(schema) and set the default tablespace as the new Tablespace above
      For example:
      1. Target Owner: MYTEST
      2. Default Tablespace: MYTEST_DB

    Generate the indexfile with imp

    #> imp system/oracle fromuser=WIN_FDC_CDB touser=MYTEST file=./exp_WIN_FDC_CDB.dmp log=./imp_WIN_FDC_CDB.log indexfile=./idx_WIN_FDC_CDB.sql
    

    Edit the idexfiles against your database

    indexfile: idx_WIN_FDC_CDB.sql

    #> sed -e 's/^REM//g' -e '/rows$/d' -e 's/"CDB"/"MYTEST_DB"/g' idx_WIN_FDC_CDB.sql > idx_WIN_FDC_CDB.sql.ok
    

    Create all tables without any rows by using the indexfile

    #> sqlplus mytest/mypass @idx_WIN_FDC_CDB.sql.ok | tee idx_WIN_FDC_CDB.sql.ok.log 

    TIPs:

    CDB is the source tablespace

    MYTEST_DB is the target tablespace

    Import entire tables

    imp system/oracle fromuser=WIN_FDC_CDB touser=MYTEST file=./exp_WIN_FDC_CDB.dmp log=./imp_WIN_FDC_CDB.log ignore=y
    

    TIPs:

    Add the option ignore=y

    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core