unix系统环境变量的设置

一 问题描述

看metalink文档 "ORA-01401 / ORA-12899 While Importing Data In An AL32UTF8 / UTF8 (Unicode) Or Other Multibyte NLS_CHARACTERSET Database. [ID 1297961.1] " 中有提到用csscan检查源数据库.于是想自己实验做一下.结果在自己的实验机上执行csscan命令时报错
$ csscan
csscan: error while loading shared libraries: libclntsh.so.10.1: cannot open shared object file: No such file or directory

 二 环境

OS

$ cat /etc/redhat-release
CentOS release 5.3 (Final)

oracle DB

$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Oct 8 15:36:55 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

oracle 环境变量

$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions

export ORACLE_SID=drugsync
export ORACLE_BASE=/home/oracle10
export ORACLE_HOME=$ORACLE_BASE/database/10.2.0/db_1
export PATH=$ORACLE_HOME/bin/:$PATH
export NLS_LANG=american_america.zhs16gbk

三 操作步骤

$ csscan
csscan: error while loading shared libraries: libclntsh.so.10.1: cannot open shared object file: No such file or directory

看提示由于找不到库文件libclntsh.so.10.1的原因.于是google,找到这个链接 http://www.orafaq.com/forum/t/68299/2/
由此文档中查到了原来系统中是有 libclntsh.so.10.1 这个库文件的,在$ORACLE_HOME/lib 目录下.自己装oracle的时候并没有设置库文件的环境变量,但又不知道设置什么库文件的环境变量.由于又google找到 http://www.itpub.net/thread-560216-1-1.html 这个链接中给出了一些环境变量的设置

export ORACLE_BASE=/oracle
export ORACLE_HOME=/home/oracle/OraHome1
export PATH=${ORACLE_HOME}/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:$PATH
export ORACLE_SID=shyxzx
export TNS_ADMIN=$ORACLE_HOME/network/admin

export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib
export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$ORACLE_HOME/ctx/lib
export ORA_DB=$ORACLE_HOME/dbs
export CLASSPATH=$ORACLE_HOME/JRE/lib:$ORACLE_HOME/JRE/lib/rt.jar:$ORACLE_HOME/j
lib:$ORACLE_HOME/rdbms/jlib

最开始向自己的实验环境里添加了LIBPATH 这个环境变量,发现不起作用.再添加LD_LIBRARY_PATH时才发现起作用了.好奇心驱使下找到了官方文档 http://download.oracle.com/docs/cd/B19306_01/server.102/b15658/admin_ora.htm#UNXAR130  贴出里面的部分内容

1.2.2 UNIX Environment Variables

Table 1-2 describes UNIX environment variables used with Oracle Database.

Table 1-2 Environment Variables Used with Oracle Database

Variable Detail Definition

ADA_PATH (AIX only)

Function

Specifies the directory containing the Ada compiler.sm

 

Syntax

directory_path

 

Example

/usr/lpp/powerada

CLASSPATH

Function

Used with Java applications. The required setting for this variable depends on the Java application. Refer to the product documentation for your Java application for more information.

 

Syntax

Colon-separated list of directories or files: directory1:directory2:file1:file2

 

Example

There is no default setting. CLASSPATH must include the following directories:

$ORACLE_HOME/JRE/lib:$ORACLE_HOME/jlib

DISPLAY

Function

Used by X-based tools. Specifies the display device used for input and output. Refer to the X Window System documentation for information.

 

Syntax

hostname:server[.screen]

where hostname is the system name (either IP address or alias), server is the sequential code number for the server, and screen is the sequential code number for the screen. If you use a single monitor, then use the value 0 for both server and screen (0.0).

Note: If you use a single monitor, then screen is optional.

 

Example

135.287.222.12:0.0
bambi:0

DYLD_LIBRARY_PATH (Mac OS X only)

Function

Specifies the list of directories that the shared library loader searches to locate shared object libraries at run time. See the dyld man page for information about this environment variable.

 

Syntax

Colon-separated list of directories: directory1:directory2:directory3

 

Example

/usr/lib:$ORACLE_HOME/lib

HOME

Function

The home directory of the user.

 

Syntax

directory_path

 

Example

/home/oracle

LANG or LANGUAGE

Function

Specifies the language and character set used by the operating system for messages and other output. Refer to the operating system documentation for more information.

Note: This environment variable is not used on Mac OS X.

LD_OPTIONS

Function

Specifies the default linker options. Refer to the ld man page for more information about this environment variable.

LPDEST (Solaris only)

Function

Specifies the name of the default printer.

 

Syntax

string

 

Example

docprinter

LD_LIBRARY_PATH (All platforms except AIX and Mac OS X.)

Function

Specifies the list of directories that the shared library loader searches to locate shared object libraries at run time. Refer to the ld man page for information about this environment variable.

On HP-UX, specifies the path for 64-bit shared libraries.

 

Syntax

Colon-separated list of directories: directory1:directory2:directory3

 

Example

/usr/dt/lib:$ORACLE_HOME/lib

LD_LIBRARY_PATH_64 (SPARC systems only)

Function

Specifies the list of directories that the shared library loader searches to locate specific 64-bit shared object libraries at run time. Refer to the ld man page for information about this environment variable.

 

Syntax

Colon separated list of directories: directory1:directory2:directory3

 

Example

/usr/dt/lib:$ORACLE_HOME/lib64

LIBPATH (AIX only)

Function

Specifies the list of directories that the shared library loader searches to locate shared object libraries at run time. Refer to the ld man page for information about this environment variable.

 

Syntax

Colon-separated list of directories: directory1:directory2:directory3

 

Example

/usr/dt/lib:$ORACLE_HOME/lib

PATH

Function

Used by the shell to locate executable programs; must include the $ORACLE_HOME/bin directory.

 

Syntax

Colon-separated list of directories: directory1:directory2:directory3

 

Example

/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:$ORACLE_HOME/bin: $HOME/bin:.

Note: The period adds the current working directory to the search path.

PRINTER

Function

Specifies the name of the default printer.

 

Syntax

string

 

Example

docprinter

SHLIB_PATH (HP-UX 32-bit libraries only)

Function

Specifies the list of directories that the shared library loader searches to locate shared object libraries at run time. Refer to the ld man page for information about this environment variable.

 

Syntax

Colon-separated list of directories: directory1: directory2: directory3

 

Example

/usr/dt/lib:$ORACLE_HOME/lib32

TEMP, TMP, and TMPDIR

Function

Specifies the default directories for temporary files; if set, tools that create temporary files create them in one of these directories.

 

Syntax

directory_path

 

Example

/u02/oracle/tmp

XENVIRONMENT

Function

Specifies a file containing X Window System resource definitions. Refer to the X Window System documentation for more information.



原来LD_LIBRARY_PATH 是除了AIX与MAC OS X 给其他平台使用的,LIBPATH是只给AIX使用的. DYLD_LIBRARY_PATH 是只能MAC OS X 用的.

至此向oracle用户环境变量文件.bashrc中添加
export LD_LIBRARY_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib

$ csscan help=y


Character Set Scanner v2.1 : Release 10.2.0.3.0 - Production on Sat Oct 8 16:40:50 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


You can let Scanner prompt you for parameters by entering the CSSCAN       
command followed by your username/password:                                
                                                                           
  Example: CSSCAN SYSTEM/MANAGER                                           
                                                                           
Or, you can control how Scanner runs by entering the CSSCAN command        
followed by various parameters. To specify parameters, you use keywords:   
                                                                           
  Example: CSSCAN SYSTEM/MANAGER FULL=y TOCHAR=utf8 ARRAY=1024000 PROCESS=3 
                                                                           
Keyword    Default Prompt Description                                      
---------- ------- ------ -------------------------------------------------
USERID             yes    username/password                                
FULL       N       yes    scan entire database                             
USER               yes    owner of tables to be scanned                    
TABLE              yes    list of tables to scan                           
COLUMN             yes    list of columns to scan                           
EXCLUDE                   list of tables to exclude from scan              
TOCHAR             yes    new database character set name                  
FROMCHAR                  current database character set name              
TONCHAR                   new national character set name                  
FROMNCHAR                 current national character set name              
ARRAY      1024000 yes    size of array fetch buffer                       
PROCESS    1       yes    number of concurrent scan process                
MAXBLOCKS                 split table if block size exceed MAXBLOCKS       
CAPTURE    N              capture convertible data                         
SUPPRESS                  maximum number of exceptions logged for each table
FEEDBACK                  report progress every N rows                     
BOUNDARIES                list of column size boundaries for summary report
LASTRPT    N              generate report of the last database scan        
LOG        scan           base file name of report files                   
PARFILE                   parameter file name                              
PRESERVE   N              preserve existing scan results                   
LCSD       N       no     enable language and character set detection      
LCSDDATA   LOSSY   no     define the scope of the detection                
HELP       N              show help screen (this screen)                   
QUERY      N              select clause to scan subset of tables or columns
---------- ------- ------ -------------------------------------------------
Scanner terminated successfully.


请使用浏览器的分享功能分享到微信等