- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Cron not executing Oracle Spool Script Correctly.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2007 09:18 AM
04-13-2007 09:18 AM
I currently have an Oracle table which contains Dutch characters, among others, such as é, à, ø, õ and æ. When I run a .sql spool script via the sql> command prompt, everything seems to get spooled out correctly. However, when I set this script to run via cron, all the special characters i listed above appear as ? (question marks). When I run the spool via command line, the special characters appear exactly as they are in the table. I know I need to setup my cron environment variable in the same manner as when I login to sqlplus, by setting the PATHs, etc, but I am still having a problem with it and can't seem to make it work.
I have created a env.sh script in which i am currently exporting the ORACLE_HOME, ORACLE_SID. BASH_ENV.
In my main run_spool.sh script that the cron is running, i am first calling the env.sh script with a
. env.sh
and then below this script i am running my .sql script, such as this:
$ORACLE_HOME/bin/sqlplus -s username/password@sid @/location/of/script/spool.sh
So my final spool.sh script looks like this:
#!/bin/bash
. /location/of/script/env.sh
$ORACLE_HOME/bin/sqlplus -s username/password@sid @/location/of/scripts/spool.sh
Can anyone please help me out with this. Much help would be appreciated.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2007 09:51 AM
04-13-2007 09:51 AM
SolutionI would issue an "env > /tmp/myenv" under a shell that "correctly" executes your SQL and then put a very similar command, "env > /tmp/cronenv", in your croned script after your sourced env.sh. Diff those two files and you might find that you need a few more environment variables than you thought you did.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2007 12:20 PM
04-13-2007 12:20 PM
Re: Cron not executing Oracle Spool Script Correctly.
Now when you run teh script directly, do you connect directly perhaps (BEQ?) or also through SQL*net/TNSNAMES as per cron setup?
You might need WE8DEC but have US7ASCII?
To Oracle doc has of course a bunch on NLS, but here is a quick overview from the web:
http://www.dbazine.com/oracle/or-articles/hordila7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2007 05:53 PM
04-13-2007 05:53 PM
Re: Cron not executing Oracle Spool Script Correctly.
can you try the following:
$ORACLE_HOME/bin/sqlplus << EOF
connect username/password@sid
--run your script
@/location/of/scripts/spool.sql
--
EOF
Concerning your NLS settings, the NLS_LANG variable looks like this:
NLS_LANG=FIELD1_FIELD2.FIELD3
Field 1 corresponds to NLS_LANGUAGE and specifies things like the language for Oracle messages, language for day and months names, writing direction etc.
Field 2 corresponds to NLS_TERRITORY and specifies things like date format, decimal and group separator symbols, the week start day etc.
Field 3 corresponds to the characterset of the OS environment of this machine. This field must be set to the equivalent value of the OS environment characterset.
Please adjust accordingly and let us know if OK.
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2007 06:47 AM
04-17-2007 06:47 AM