---
title: "AIX crontab 不执行 以及 shell连数据库乱码"
author: "andyniu"
date: "2016-09-23T10:12:02Z"
tags: []
categories: ["操作系统"]
slug: "aix-crontab-shell"
draft: false
lastmod: "2016-09-23T10:12:02Z"
id: 2326389
url: "https://andyniu.iteye.com/blog/2326389"
---

1、AIX   单独执行shell正常，放到crontab时不执行

原因：crontab执行时没有环境变量，在shell脚本里 添加当前用户.profile环境变量

 

 

2、 shell连数据库乱码

原因：客户端和oracle服务端编码不一致造成

先查下oracle服务端编码

select userenv('language') from dual;

结果：SIMPLIFIED CHINESE\_CHINA.ZHS16GBK

在AIX shell脚本的sqlplus前面写上编码

export NLS\_LANG=AMERICAN\_AMERICA.ZHS16GBK