Export script in unix

I am new to oracle and I i am also learning unix. Does any one has unix korn script for oracle export which also checks if export is successful. Like I want to check something like this.
Perform Export
check if export is successful
then
ftp the export.dmp file
if if ftp is successful
then mail the user that the export/ftp is successful
else email not successful export/ftp
else
emial export is not succesfful
Thanks.
else

Hi,
Oracle Version : 10.1.3.0.0
OS System : Linux Ver 3
Export_bkp_scheduling on linux server.
shell script for backup.
oracle@oracle]$vi expbkp.sh
#press i or a ( for insert mode)
#!/bin/bash
ORACLE_HOME= /db/app/oracle/orahome #put_oracle_home_path
export ORACLE_HOME
export PATH=$ORACLE_HOME/bin:$PATH
#for system date with dmp file.
value= ` date '%d%m%y'`
exp userid/pwd file=file_name$value.dmp log=log_name$value.log
#type shift + zz for file closing.
shift+ZZ
oracle@oracle]$cat expbkp.sh # check expbkp.sh file contents.
Schedule ur backup according ur time Eg> every night 10 pm. for scheduling use "CRONTAB" utility.
oracle@oracle]$crontab -e #for create new crontab file.
#press i or a for insert mode
0 20 * * * /db/app/expbkp.sh #give compete path of ur .sh ( bkp script file).
oracle@oracle]$crontab -l ( for check crontab file)
oracle@oracle]$crontab -r ( for delete crontab file entry )@Legatti
after you suggestion and help i was create above script.
regards
Taj
Message was edited by:
M. Taj

Similar Messages

  • Genralizing the data export script

    hi , i have a data export script which is a busienss rule , now i can genralize the version, year, scenario and everything but the problem is that the export file that is being created has the fixed name , each time i run that rule the data export file will be same , is it possible to somehow genralize that export file name as well.

    hi here is some java which i have used earlier try to modify ...it saves with current date and time and even i used SED all this in UNIX
    JAVA
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileFilter;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileWriter;
    import java.io.InputStreamReader;
    import java.io.Writer;
    import java.util.Calendar;
    import java.util.StringTokenizer;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    * @author KVC
    public class MigratorUtil {
         public static File getLatestFile(String dir){
              File directory = new File(dir);
              File choice = null;
              if(directory.isDirectory()){
                   File[] files = directory.listFiles(new FileFilter() {
                        public boolean accept(File file) {
                             return file.isFile();
                   long lastMod = Long.MIN_VALUE;
                   int fileSize = files.length;
                   for(int i=0;i<fileSize;i++){
                        File file = files;
                        if(file.lastModified() >lastMod){
                             choice = file;
                             lastMod = file.lastModified();
              }else{
                   System.out.println(dir+" is not a directory");
              return choice;
         public static boolean processFile(File latestFile) throws FileNotFoundException,Exception{
              FileInputStream fileStream = new FileInputStream(latestFile);
              DataInputStream in = new DataInputStream(fileStream);
              BufferedReader br = new BufferedReader(new InputStreamReader(in));
              String strLine;
              int lineCount = 0;
              StringBuffer contents = new StringBuffer();
              while((strLine = br.readLine())!=null){
                   if(lineCount == 0){ //first line
                        String header = System.getProperty("header");
                        if(header == null){
                             header = "HEADERHYPERION";
                        contents.append(header).append(getPreviousBusinessDate()).append(getDateFormat()).append("\n");
                   }else{
                        contents.append(strLine).append("\n");
                   lineCount++;
              //footer
              if(lineCount != 0){ //last line
                   String footer = System.getProperty("header");
                   if(footer == null){
                        footer = "TRAILER";
                   contents.append(footer).append(lineCount-1); // linecount - 1 to remove the first line count
              // wtite the file
              String fileName = latestFile.getAbsoluteFile().toString();
              String outputFile = fileName.substring(0,fileName.indexOf("."))+".out";
              System.out.println(" output file is ..."+outputFile);
              File output = new File(outputFile);
              Writer oWriter = new BufferedWriter(new FileWriter(output));
              try{
                   oWriter.write(contents.toString());
    //               oWriter.write(getProcessedLine(contents.toString()));
              }finally{
                   oWriter.close();
              return true;
         public static String getDateFormat(){
              Calendar calendar = Calendar.getInstance();
              int currentMonth = calendar.get(Calendar.MONTH);
              return calendar.get(Calendar.YEAR)+"-"+(currentMonth>9?""+currentMonth:"0"+currentMonth)+"-01";
         public static String getPreviousBusinessDate(){
              Calendar calendar = Calendar.getInstance();
              int currentMonth = calendar.get(Calendar.MONTH);
              calendar.set(Calendar.MONTH, currentMonth-1);
              int lastDate = calendar.getActualMaximum(Calendar.DATE);
              calendar.set(Calendar.DATE, lastDate);
              int lastDay = calendar.get(Calendar.DAY_OF_WEEK);
              if(lastDay == 1 ){
                   lastDate = lastDate - 2; // for sunday
              }else if(lastDay == 7){
                   lastDate = lastDate - 1; // for saturday
              return calendar.get(Calendar.YEAR)+"-"+(currentMonth>9?""+currentMonth:"0"+currentMonth)+"-"+lastDate;
         private static String getProcessedLine(String line){
              String seperator = System.getProperty("inputseperator");
              String out_seperator = System.getProperty("outputseperator");
              if(seperator == null){
                   seperator = "!";
              if(out_seperator == null){
                   out_seperator = "|";
              StringTokenizer tokenizer = new StringTokenizer(line,seperator);
              StringBuffer descContent = new StringBuffer();
              StringBuffer content = new StringBuffer();
              while(tokenizer.hasMoreTokens()){
                   String element = tokenizer.nextToken();
                   if(matchPattern(element)){
                        System.out.println("Criteria matched..."+element+ "So eat the next elemet");
                        descContent.append(tokenizer.nextElement()).append(out_seperator);
                   }else{
                        content.append(element).append(out_seperator);
              content.append(descContent);
              String output = content.toString();
              return output.substring(0, output.length()-1);
         private static boolean matchPattern(String line){
              String regex = "\\d{1,2}.\\d{1,2}.\\d{1,2}";
              Pattern pattern = Pattern.compile(regex);
              Matcher m = pattern.matcher(line);
              return (m.matches());
         public static void main(String a[]){
              System.out.println(getPreviousBusinessDate());
    SED
    for file to
    #!/bin/bash
    #Replace tab with pipe
    cat $1 | sed 's/\t/|/g' > /tmp/test.out
    line_cnt=`wc -l $1 | awk '{print expr $1-2}'`
    if [ `uname -s` = 'SunOS' ]; then
    set -A months 0 1 2 3 4 5 6 7 8 9 10 11 12
    else
    months=(0 1 2 3 4 5 6 7 8 9 10 11 12)
    fi
    here it takes last month date similarly u can change up to ur requirements
    YEAR="`date +%Y`"
    MONTH="${months[`date +%m-1`]}"
    TODAY_STR="`date +%Y`-${months[`date +%m`]}-01"
    DAY="`cal $MONTH $YEAR | awk '{ if(NF>1) a=$NF ; if (NF==7) a=$6}END{print a}'`"
    LAST_MNTH="`date +%Y`-${months[`date +%m-1`]}-$DAY"
    cat /tmp/test.out | sed -e "s/HEADERHYPERION/HEADERHYPERION${LAST_MNTH}${TODAY_STR}/" > /tmp/test_tmp.out
    cat /tmp/test_tmp.out | sed -e "s/TRAILER/TRAILER${line_cnt}/" > $2

  • Sql script in UNIX

    When I run a sql script in unix using sqlplus command, the process halts at some point. No matter how long I wait, it does not finish (it does not bring the command prompt back). There are no problems in SQL*PLUS. This process usually takes about 30 mins when I run from SQL * PLUS. Any ideas why it hangs in UNIX?
    sqlplus -s userid @script
    Thanks

    Are you specifying a password ?
    Have you set the ORACLE_SID ?

  • Export scripts

    I would like to know how to develop export scripts with suitable buffer size to preserve important tables before and after batch process (for bill processing ) using export utility / import utility

    Depends on what OS you are using. Google is your friend. Google tuning oracle exp or something to that effect.

  • How to run script file ( unix script file like ksh or sh file) using Java

    How to run script file ( unix script file like ksh or sh file) using Java Program?.
    I am using the following code snippet to run the simple commands like top or ls ,etc....
    Runtime runtime = Runtime.getRuntime();
    Process proc = runtime.exec("top");
    Thanks In Adavance
    -Siva

    String [] { "ksh" , "-c" , "script", "arg 1", "arg 2", "arg 3"}

  • Editing an export script - please help!

    Hello Photoshop friends,
    so I have an export script that I downloaded from the web which exports all layers to a file type of your choice - PNG, GIF, etc. This is fine, but the dialog box doesn't support file format options such as matte, dither, transparency and so forth. Is it possible to edit the script to give it literal values for these inaccessible variables instead of the default? I'v been digging around the script, but I'm not really sure what I'm doing.
    Specifically, I want to leave the script intact except the following settings for the PNG8 format:
    Colours 256
    Transparency - YES
    "No transparency dither"
    Matte: "none" (currently it gives me a white matte)
    Please, I would really appreciate if anyone could point me in the right direction please, please!
    Ulerika.

    Hey Michael, thanks for your quick reply. I tried to attach the script, but the forum won't allow me to do so. The script in question is here:
    http://tranberry.com/photoshop/photoshop_scripting/tips/layerstoPNG.html
    There is one big section dealing with PNG8 which I suspect is the place which needs to be changed. An extraction from this section for example reads:
    "var id35 = charIDToTypeID( "Mtt " );
    desc4.putBoolean( id35, true ); //matte
    var id36 = charIDToTypeID( "MttR" ); //matte color"
    Thanks.

  • Export scripts automation windows 2003 server

    i want some automatic export scripts that run a specific time on daily basis
    My platform is windows
    My Database is oracle 10g
    Please help

    1002643 wrote:
    i want some automatic export scripts that run a specific time on daily basis
    My platform is windows
    My Database is oracle 10g
    Please helpcreate *bat file & schedule using AT utility                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Use of Import and Export script

    Hi,
    Can any one tel me what is the use of Import and Export script.
    After moving the pages from / into server what is the need of giving the import / export command.
    export /oracle/apps/ap/setup/webui/customizations/site/0/SetupPG -rootdir <destination path> -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> (port = <port id>)))(connect_data = (sid = <sid>)))".
    Thanks in Advance,
    Jegan

    And Export/Import is also used to move personalizations and substitutions from one system to another system.
    You can also use Functional administrator UI to export and import pages.
    Functional administrator in turn uses export/import internally.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • New tutorials and export script

    Hey All,
    As much as I loves me .Mac account for its ridiculously easy iPhoto publishing, I've reached the point where I want to be able to have fun with server-side scripting (PHP, Ruby, etc.), so I've moved the tutorials and such to a new location:
    http://www.motionsmarts.com
    I've got a couple of new tutorials there, as well as an AE-to-Motion position keyframe export script, for those of you desperate to move that tracking data. It's no-frills, but it seems to work well enough.
    Have fun, and please post if you find any errors or typos. Thanks!

    Amazing, Specialcase!
    Will try the AE position exporter as soon as possible!
    Keep those great things coming
    PS: Do you think it would be too hard for a non programmer like myself to customize the script? I would love to modify it to export Soundkeys or AE's built-in Convert audio to keyframes data to Motion! I mean, I could copy that data to AE's position and then export, but position has two dimensions and the audio level data is unidimensional....
    Thanks again.

  • How to wrap import and export in a Unix shell script?

    Hi all,
    I want to write a simple korn shell Unix script to kick off export and import
    for our Oracle 10g refresh databases. Do any of you have a script to do this?
    The goal would be:
    1. Take export using exp of 10 tables in PROD database on database server1
    for the prod schema user
    2. Use sftp or scp to copy over the export dump file to database server 2
    3. Use a shell script to import the dump file into TEST database server for schema
    test
    4. use nohup to run the export and import in background through cron job
    We are running Oracle 10g Release 2 on Red Hat Linux.
    Thanks,
    Ben Prusinski

    Wouldn't it be easier to have both databases in your tnsnames.ora file. Then you can export and import on the same server without copying the files to another server.
    script:
    exp <username>/<password>@PROD file=<file>.dmp log=<explog>.log owner=prod
    imp <username>/<password>@TEST file=<file>.dmp log=<implog>.log fromuser=prod touser=test
    run this script as: nohup <scriptname> &
    Since you are on oracle10g you can also use datapump (expdp and impdp) for faster exporting and importing, but I do not know the syntax by heart

  • Portal Transport Set(EXPORT) script not running.

    Hi,
    I have created a Instant portal(10 Appli Rel 2) which is on OS
    [SUSE LINUX Enterprise Server 9 (i586) VERSION = 9 ] .
    Now I want to create transport set and want to export that instant portal to another
    SUSE LINUX server.
    But the problem I am facing is that the script that is generating by the EXPORT WIZARD is
    for UNIX which has .CSH extension.
    So i am not able to rum that thing...as Linux use .SH .....can anyone help me to run that thing .......
    Thanx

    DId you run the script to put the trasnport set ready for been include?
    When you create a transport set, automaticaly you can get the dmp from it, but when you import it, you need to run the script that willmake a import in db level so you can import it in the portal, is like making two imports, one at portal, one at command line using the script, and you run it like script.cmd -mode import -s portalschema -c orcl -pu orcladmin -d filename.dmp where -mode indicate that is going to be an import, -c db SID name, -pu Portal User -d File created during export and -s db schema for portal.
    Hope this helps.
    Greetings

  • Set up export script and how to run it. Oracle 10gR2

    Can someone help explain this script to a newbie. I need to write a script to export all data from our Oracle 10gR2 Tru64 Unix to another system. We need to test how long a 200GB tablespace export will take writing directly to nfs mount on SAN.
    1. The only option we have is to use a NFS Mount to the new SAN. ( there is no space on our existing system)
    2. What needs to be declared to describe the environment in both Oracle and/or in the script to make it run?
    3. Do I need to tell Oracle where the export directory is? (NFS Mount).
    4. how is exp run? Do dba run via a XXX.sh script or SQLPLUS XXX.sql script?
    5. how can I check the progress....
    I don't understand the set up of the oracle environment lines, can someone help me?
    Here is a sample script I found on our system....
    1 #!/bin/sh
    2 # /usr/users/oracle/nfsoraexpt_linux.sh
    3 # Export up the specified instance of the db tar it to an nfs mount point and log it
    4
    5 # Set up the oracle instance and environment
    6
    7 ORACLE_SID=pdsprod; export ORACLE_SID
    8
    9 ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1; export ORACLE_HOME
    10 PATH=/usr/bin:/u01/app/oracle/product/10.2.0/db_1/bin:/apg/0800/mercator:/usr/users/oracle/bin:.; export PATH
    11
    12 # Do logging and export the instance
    13 rm /nfs_dir/oraexpt.log
    14 echo `date` >> /nfs_dir/oraexpt.log
    15 exp user/password file='/nfs_dir/pdsprod.exp' log='/nfs_dir/pdsprodexp.log' full=y direct=y feedback=5000000
    16 #exp user/password file='/nfs_dir/pdsprod.exp' log='/nfs_dir/pdsprodexp.log' tablespace='ENC_DS_DATA' direct=y feedback=5000000
    17 cat /nfs_dir/pdsprodexp.log >> /nfs_dir/oraexpt.log; rm /nfs_dir/pdsprodexp.log
    18
    19 echo `date` >> /nfs_dir/oraexpt.log
    20 cd /nfs_dir
    21 # gzip -f pdsprod.exp
    22 ls -al pdsprod.exp >> oraexpt.log
    23 mail -r email email2 < /nfs_dir/oraexpt.log
    24
    Any help for this first time user would be appreciated. Thanks

    First it sets some environment variables in the shell.
    Then it removes a log file.
    Then it uses an obsolete tool to export some data.
    Then it displays the contents of the log file.
    Then it changes the present working directory.
    Then it lists the files in the directory.
    Then, presumably, it emails a copy of the log file somewhere.
    In 10gR2 I would suggest throwing it away and using a proper tool to do the job such as RMAN or DataPump.
    Additionally find someone to teach you how to navigate and perform basic tasks in Linux. This may help.
    http://www.psoug.org/reference/unix_vi.html
    as might Arup Nanda's excellent tutorial here:
    http://www.oracle.com/technology/pub/articles/advanced-linux-commands/part1.html

  • How to Recover from last failed execution by using exported scripts

    I have exported a Data Services batch job to  unix scripts of job_batch.sh. The Enable Recovery option is selected when the job was exported. After I run the scripts (./job_batch.sh) and the job failed, I only can rerun it again using Recover-from-last-failed-execution option at Management Console.
    Is it a way to rerun the job from last failed execution again from the scripts itself, not going through Management Console? Or have to rerun the scripts with any unix option to enable it to run from failed stage?
    Thank you

    In our world a recovery is done manually, hence no automatism there. In fact, there is some code that checks if the last run was unsuccessful and only in that case the Management Consol allows to add the "recover from last failed execution point".
    Having said that, adding the command line property -Cr manually always, does work as Manoy explained.

  • Exchange 2010 GAL Export script working from EMS but not as a scheduled task

    I have been asked to get a script together to export the GAL on an Exchange 2010 server and then email it to a manager. I have been playing it with days, and have pruned it to the very minimum to at least try and get it working before improving it. At the
    moment I have the text as below:
    Del c:\GALexport.csv
    Get-Recipient -ResultSize unlimited | where {$_.HiddenFromAddressListsEnabled -eq $false} | Select DisplayName,PrimarySMTPAddress,sAMAccountName,alias | Export-Csv "c:\GALexport.csv"
    This works just fine in Exchange Management Shell and deletes the previous report before creating a new one. However, when I set it up as a scheulded task, it does nothing.
    The task is set up as follows:
    Action - Start a Program
    Program/ Script C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe
    Add arguments -version 2.0 -NonInteractive -WindowStyle Hidden -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; d:\Scripts\GalExportReport.ps1"
    This is set to run under my administrator account with the highest privileges and I have the logon as batch right.
    Unfortunately, when I run it as a scheduled task, nothing happens. The last run result is (0x0) and in the history it says 'task completed', but no report is produced. Can anyone advise please?

    Does it delete the c:\GALexport.csv file? If not, then its not even executing the ps1 script...
    - Open cmd prompt and run below command to confirm that there isn't any typo or any other small error...
    C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version
    2.0 -NonInteractive -WindowStyle Hidden -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; d:\Scripts\GalExportReport.ps1"
    - If above works then something wrong with task scheduler configuration...
    Blog |
    Get Your Exchange Powershell Tip of the Day from here

  • [JS CS3/4] onEvent Export scripting question

    Hi,
    My client wants to have a PDF on which appears the ICC profile selected in the UI PDF Export dialog box from Indesign.
    I am thinking about using the onEvent feature but not sure it can help. If I choose afterExport, the PDF will be generated but I wont' have placed the info yet. If I choose beforeExport, I won't know the profile the client wants to use on export :-(
    The only safe way I see is to rebuild a full PDF export dialog box. Hence, i can catch the profile info, place it on the doc and finally launche the PDF generation.
    Am I wrong to think so ?
    Thanks for your advices.
    Loic

    Hi and thanks a lot for your input,
    It worked.
    It seems that the script didn't like I ask it to retrace the path to the desktop by itself. But if I convert the path info to a string it's ok.
    This works :
    app.activeDocument.exportFile(ExportFormat.JPG, (new File('~/Desktop/test.jpg')), false)
    This too :
    var myFilePath = String(Folder.desktop + '/test.jpg');
    app.activeDocument.exportFile(ExportFormat.JPG, (new File(myFilePath )), false)
    But that fails
    app.activeDocument.exportFile(ExportFormat.JPG, (new File(Folder.desktop + '/test.jpg')), false)
    Thanks a lot for your answer.
    Loic

Maybe you are looking for

  • Can send but not receive emails

    This is a Go Daddy account set up using IMAP. I have deleted and reinstalled the account and the issue remains the same. The account sets up fine and loads emails thru Tuesday, July 3rd at 1:59pm.Nothing later ever loads. Deleting and reinstalling th

  • Problem when creating CAF Entity Service finder Methods

    Guys, Can any one please suggest me appropriatly to the below problem. I am using NWDS 7.06. I have no problem when creating CAF project, Application Service and Entity Service even. But in the Entity Service: 1. Add a string or longtext attribute. 2

  • How to bypass or modify  WAD initialization with javascript

    Hello WAD Developers I want to understand what happens when you load and re-load a page, because I need to invoke some logic only the first time a page is run and not each time you click someone. I have created some javascript logic which uses a drop

  • User gets Active X Runtime error 429 while running 10.1.3.4.1 Build 130

    Hello all, I have a user running BI Publisher Desktop 10.1.3.4.1 Build 130 as an addon in Word 2010. He has had multiple issues with this program in the past, one of which even forced us to reinstall his machine to resolve. He is on a clean build of

  • IDoc Metadata message

    Hello while creating a new entry in IDoc metadata , in IDX2 , getting following message : "I::000" and nothing happens after hitting continue: please suggest Best regards Krishna