Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

  • Translate

  • It’s Me






  • My Certificates

  • Links

    My Acclaim Certification : Credly Profile
    My Oracle ACE Pro Profile

  • Achievements

    Awarded Top 100 Oracle Blogs from Worldwide - #RANK 39
  • VISITORS COUNT

  • Verified International Academic Qualification from World Education Service (WES)

    Verified International Academic Qualification from World Education Service (WES)

  • Jobs

DB dumpfile backup using NAS Storage

Posted by Mir Sayeed Hassan on April 30th, 2018

Login with Oracle user & create the mnt directory

[oracle@testdb ~]$ pwd
/home/oracle
[oracle@testdb ~]$ mkdir mnt
[oracle@testdb mnt]$ pwd
/home/oracle/mnt

Login as the root & create the mount_nas.sh file

[root@testdb scripts]# cd /home/oracle/scripts/
[root@testdb scripts]# pwd
/home/oracle/scripts

Create the Directory in NAS Storage & Grant the require privileges

[root@testdb ~]# cd /home/oracle/mnt
[root@testdb mnt]# pwd
/home/oracle/mnt
[root@testdb mnt]# mkdir owh_dbdump
[root@testdb mnt]# su - oracle
[oracle@testdb mnt]$ !sq
sys@TESTDB> create directory owh_dbdump as '/home/oracle/mnt/owh_dbdump/';
Directory created.
sys@TESTDB> grant read,write on directory owh_dbdump to system;
Grant succeeded.
sys@TESTDB> grant exp_full_database to system;
Grant succeeded.
Create the script file
[root@testdb scripts]# vi mount_nas.sh

#!/bin/bash

mount -t cifs //10.21.10.155/'DB BACKUP'/Qazvin/test -o username=admin,password=nasEtick,workgroup=workgroup,file_mode=0777,dir_mode=0777 /home/oracle/mnt
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=testdb
export PATH=$PATH:$ORACLE_HOME/bin
/bin/su - oracle -c "expdp system/*****@testdb dumpfile=expdp-`date '+%d%m%Y_%H%M%S_mir'`.dmp directory=owh_dbdump logfile=expdp-`date '+%d%m%Y_%H%M%S_mir'`.log schemas=mir"
umount /home/oracle/mnt

Crontab setup:

[root@testdb ~]# crontab -l

##################################################
#Script to mount the NAS Storage for OWH_DB Backup
##################################################
40 12 * * * /home/oracle/scripts/mount_nas.sh prim > /dev/null
##################################################

Verify the dumpfile placed in NAS Storage:

[root@testdb owh_dbdump]# df -h

Filesystem Size Used Avail Use% Mounted on

——-

//10.21.10.155/DB BACKUP/Qazvin/test 3.7T 1.9T 1.8T 51% /home/oracle/mnt

[root@testdb mnt]# cd owh_dbdump/ – This directory was created inside the NAS Storage
[root@testdb owh_dbdump]# ls
expdp-30042018_124001_mir.dmp expdp-30042018_124001_mir.log
(The above dumpfile are placed in NAS Storage)
[root@testdb owh_dbdump]# cat expdp-30042018_124001_mir.log

Export: Release 11.2.0.4.0 - Production on Mon Apr 30 12:40:01 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/********@testdb dumpfile=expdp-30042018_124001_mir.dmp directory=owh_dbdump logfile=expdp-30042018_124001_mir.log schemas=mir
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/AUDIT_OBJ
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "MIR"."TEST1" 5.062 KB 2 rows
Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/mnt/owh_dbdump/expdp-30042018_124001_mir.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Mon Apr 30 12:40:05 2018 elapsed 0 00:00:03

==========Hence tested & Verified=============