DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: cron

  1. #1
    Join Date
    Mar 2001
    Posts
    65
    i want to create a cron job for export.
    the command runs properly when executed on shell prompt.
    but cron gives exp:0056 and ora:12154 error( tns)
    "could not resolve service name"

    why should it need tns for local access?

    i even created a tns entry just to check but still didn't work.

    ajay

  2. #2
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    what does your cron do ???

    if you do not do something like :
    sqlplus login/password@instance << EOF
    ...
    EOF

    then it will try to connect using SQL*Net ...

  3. #3
    Join Date
    Mar 2001
    Posts
    65
    my cron calls a batch file that sets
    some vaiable like sid,oracle_home
    then uses export cmd

    exp parfile=<> file=<>

    parfile is in my backup directory.
    with userid=name/pwd

    the same batchfile executes properly from cmd line.



  4. #4
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    ok, ok, ok ... so here are some ideas :
    1st and most important) CHECK YOUR ENV !!
    be VERY careful because when using cron, you rarely have the environment you think you have. if you're using root crontab, what I usually do is, in the crontab, call a shell like :

    10 12,14 * * 1-6 /home/dir1/dir2/launch my_script.sql >/dev/null 2>&1

    that way you call a script called launch, which just does :

    -----
    FILE=$1
    export ORACLE_HOME; ORACLE_HOME=...
    su oracle -c "$ORACLE_HOME/bin/sqlplus -s user/pwd @$FILE"
    -----

    that way I am sure that my env is correct.
    I guess you can do exactly the same using exp instead of sqlplus, the idea is just to be sure that the env is correct

    2) check you have enough space left on device to create dump file
    3) check that listener.ora file does not contain GLOBAL_DBNAME parameter

  5. #5
    Join Date
    Mar 2001
    Posts
    65
    thanks pipo!

    when i added oracle_owner env to my batch file it worked out.
    earlier i was using only oracle_home and oracle_sid
    i also added shlib_path

    ajay



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width