Saturday, January 22, 2011

Backup - Import-Export



  • Import/export to gzip through a pipe


  • Example parameter file


  • Example nohup script


  • Resumable import parameters

  • Import/export to gzip through a pipe
    to export to gzip...
    mknod andypipe p
    gzip < andypipe > filename.dmp.gz &
    exp ... file=andypipe ...
    

    and to import...
    mknod andypipe p
    gunzip -c filename.dmp.gz > andypipe &
    imp ... file=andypipe ...
    

    Example parameter file

    userid=/
    file=/u03/scr9/oradata/expimp/exppipe
    log=/u03/scr9/oradata/expimp/imp_scr9.log
    rows=y
    constraints=n
    ignore=y
    indexes=n
    grants=n
    full=n
    feedback=10000
    direct=y
    fromuser=andy,user2
    touser=andy,user2
    
    to use the file...
    exp parfile=<file>
    imp parfile=<file>


    Example nohup script

    #!/usr/bin/ksh
    export ORAENV_ASK=NO
    export ORACLE_SID=scr10
    . /usr/local/bin/oraenv
    rm andypipe 2>/dev/null
    mknod andypipe p
    gzip < andypipe > full_scr10.dmp.gz &
    exp / full=y indexes=N grants=N statistics=none file=andypipe log=full_scr10.log
    rm andypipe 2>/dev/null
    
    to use the script...
    chmod 700 <file>
    nohup ./<file> &
    

    Resumable import parameters

    resumable=y
    resumable_name=<name to apear in dba_resumable>
    resumable_timeout=<timeout in seconds>
    
    Note. If you are importing using a user other than sys or system, it will need the system priv 'resumable' granting to it:
    grant resumable to <user>;
    
    Note. If a resumable job hits a problem which causes it to be suspended, you will not necessarily see a message indicating that on the screen. You need to constantly monitor either the alert log or the dba_resumable view.
    set lines 100 pages 999
    col name format a20
    select name
    , start_time
    , suspend_time
    , status
    from dba_resumable
    /

    If the job gets suspended, you can see the reason why with the next query
    set lines 100 pages 999
    select error_msg
    from dba_resumable
    where name like '&resumable_name'
    /
    

    No comments:

    Post a Comment