在一个11.2.0.2 for Linux X86-64环境中,运行csscan工具报错。
错误信息为:
[oracle@dbserver2 ~]$ cd $ORACLE_HOME/bin
[oracle@dbserver2 bin]$ csscan help=y
csscan: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory
检查metalink,在文档ID 742070.1中提到,导致这个问题的原因是没有正确的设置LD_LIBRARY_PATH环境变量,将$ORACLE_HOME/lib添加到这个环境变量中可以避免错误的产生:
[oracle@dbserver2 bin]$ env grep LD_LIB
LD_LIBRARY_PATH=/etc/emc/rsa/cst/lib
[oracle@dbserver2 bin]$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
[oracle@dbserver2 bin]$ csscan help=y
Character Set Scanner v2.2 : Release 11.2.0.2.0 - Production on Mon Jun 6 17:46:04 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. 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 AS SYSDBA"
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 AS SYSDBA" 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.
采用这个方法确实解决了问题。不过奇怪的问题是,另外一台服务器采用相同方式安装的数据库,并不存在这个问题,而且这台服务器上的LD_LIBRARY_PATH的设置与出现问题的服务器完全一致:
[oracle@dbserver1 ~]$ cd $ORACLE_HOME/bin
[oracle@dbserver1 bin]$ csscan help=y
Character Set Scanner v2.2 : Release 11.2.0.2.0 - Production on Mon Sep 5 17:47:18 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. 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 AS SYSDBA"
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 AS SYSDBA" 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.
[oracle@dbserver1 bin]$ env grep LD_LIB
LD_LIBRARY_PATH=/etc/emc/rsa/cst/lib
虽然metalink给出的解决方法确实有效,但是导致这个问题的原因和可能是多个方面的,至少文档没有给出为什么同样配置同样版本的两个数据库,在一个上没有问题,而另一个上运行就出现错误。