Import the schema without all data

    Export to a dump file from source DB

    exp system/manager owner=<owner-name> rows=n file=./schema_WIN_FDC_CDB.dmp log=./schema_WIN_FDC_CDB.log 

    Pre-Create the owner and tablespace

    • Owner: MYTEST
    • Tablespace: <same as the source DB>

    Generate the indexfile

    imp system/oracle fromuser=WIN_FDC_CDB touser=MYTEST file=./schema_WIN_FDC_CDB.dmp indexfile=./create_sch_WIN_FDC_CDB.sql log=./create_sch_WIN_FDC_CDB.sql.log
    

    Edit the indexfile

    sed -e 's/^REM//g' -e '/rows$/d' create_sch_WIN_FDC_CDB.sql > create_sch_WIN_FDC_CDB.sql.ok
    

    Create all tables without any rows by using the indexfile

    sqlplus mytest/mytest @create_sch_WIN_FDC_CDB.sql.ok | tee create_sch_WIN_FDC_CDB.sql.ok.log
    

    TIPs:

    If the target tablepsace is different from source tablespace, add the following syntax

    -e 's/"<source-tablespace>"/"<target-tablespace>"/g'

    Re-import the dump file with ignore=n

    Not sure if this step is necessary.

    imp system/oracle fromuser=WIN_FDC_CDB touser=MYTEST file=./schema_WIN_FDC_CDB.dmp log=./imp-ignore_N_schema_WIN_FDC_CDB.dmp.log ignore=n
    
    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core