Consistent Export – Flashback_SCN

In order to avoid having an inconsistent export, use the flashback_scn parameter in the export.  It guarantees a consistent export up to the given SCN (system change number), per the Oracle Utilities Guide. The script below automatically grabs the SCN number and hands it to the export command (en español):


# oradb@svr1
ORACLE_SID=oradb
ORAENV_ASK=NO
. oraenv

$ORACLE_HOME/bin/sqlplus -s ‘/ as sysdba’ <<EOF
set pages 0 echo off feed off
CREATE or REPLACE DIRECTORY bkp_dir as ‘/backups’;
GRANT READ, WRITE ON DIRECTORY bkp_dir to SYSTEM;
quit;
EOF

#Grab SCN
#escaped the dollar sign in v$database with \\
dbscn=`
$ORACLE_HOME/bin/sqlplus -s ‘/ as sysdba’ <<!
set pages 0 echo off feed off
select to_char(current_scn) from v\\$database;
quit;
!
`

$ORACLE_HOME/bin/expdp system/*** directory=bkp_dir dumpfile=oradb_13_12_01_full_%U.dmp logfile=oradb_13_12_01_full.log flashback_scn=`echo $dbscn`

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s