Export backup with date and time

Export backup in Oracle database the Dump file name will include date and time

For Single user

exp scott/tiger file= scott_bk_`date +%b_%d_%y_%H_%M_%S.`dmp log= scott_bk_`date +%b_%d_%y_%H_%M_%S.`log statistics=none compress=y

For full database backup

exp system/passwd file= full_domdb_bk_`date +%b_%d_%y_%H_%M_%S.`dmp log= full_domdb_bk_`date +%b_%d_%y_%H_%M_%S.`log statistics=none full=y compress=y

See example for single user scott

[oracle@dom backup]$ exp scott/tiger file= scott_bk_`date +%b_%d_%y_%H_%M_%S.`dmp log= scott_bk_`date +%b_%d_%y_%H_%M_%S.`log statistics=none
Export: Release - Production on Mon Oct 1 21:46:16 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table DEPT 4 rows exported
. . exporting table EMP 14 rows exported
. . exporting table EMP_MV 6 rows exported
. . exporting table REPLICA 3 rows exported
. . exporting table SALGRADE 5 rows exported
. . exporting table V_USERS 6 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
[oracle@dom backup]$ ls -rlt
-rw-r--r-- 1 oracle oinstall 1718 Oct 1 21:46 scott_bk_Oct_01_12_21_46_16.log
-rw-r--r-- 1 oracle oinstall 24576 Oct 1 21:46 scott_bk_Oct_01_12_21_46_16.dmp

Oracle 12c

 expdp hr/hr directory=backup dumpfile=dbbkpfull_"%date:~7,2%%date:~4,2%%date:~10,4%".dmp logfile=dbbkpfull_"%date:~7,2%%date:~4,2%%date:~10,4%".log

file names are 

About Sher khan

Senior Oracle DBA, Oracle 10g , Oracle 11g OCE ,Oracle 12C and Oracle 11g OPN certified Specialist, OCP Certified in Oracle 9i,10g , 11g and 12C. I am working in Oracle technology since 2004. Currently working in U.A.E Email: sher487@hotmail.com
This entry was posted in Oracle backup & recovery. Bookmark the permalink.

2 Responses to Export backup with date and time

  1. steven b says:

    didnt work, i tried both and it just runs but doesnt produce the dump file, i am trying it on oracle 12c.

    • Sher khan says:

      Hi Steven,

      you Welcome,

      I have done the same test in my system, its working for 12c with different script.

      Oracle 12c

       expdp hr/hr directory=backup dumpfile=dbbkpfull_”%date:~7,2%%date:~4,2%%date:~10,4%”.dmp logfile=dbbkpfull_”%date:~7,2%%date:~4,2%%date:~10,4%”.log
      Note: copy the link from the site.

      file names are

      for details, have a look of the image file.

      Best Regards,
      expdp Backupfile including date

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