我在其中一台服务器上通过 sh 运行 ddl 脚本文件但在另一台服务器上执行良好时遇到问题。脚本如下
sqlplus mgr/$1@$2 @export_all_tables_mgr.ddl
if [ $? != 0 ];
then
echo 'ERROR exporting MGR data, Refer to .CSV and .CTL files for detail.' | tee -a MGR_ExtractionLog.log
fi
它使用 sqlplus 来运行 ddl 文件,但其中一台是流氓服务器,它只会连接到 sql plus 并且不会做任何事情。
oracle@dbsdev55z2 $ export_all_tables_mgr.sh password servicename
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jan 24 08:39:18 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, Data Mining and Real Application Testing options
SQL>
这里要提一下,我这里用的是Oracle 10g。export_all_tables_mgr.ddl 文件如下
alter session set nls_date_format = 'DDMMYYYYHH24MISS';
@drop_table_temp_extraction_counts.ddl
@create_table_temp_extraction_counts.ddl
WHENEVER SQLERROR EXIT -1
WHENEVER OSERROR EXIT -1
SET HEADING OFF
SET FEEDBACK OFF
SET VERIFY OFF
SPOOL MGR_ExtractionLog.log
SELECT TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS'), '- Start extract process' FROM dual;
SPOOL OFF
define TableName=TABLE1
@ExportTable
define TableName=TABLE2
@ExportTable
SPOOL MGR_ExtractionLog.log append
SELECT TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS'), '- End extract process' FROM dual;
SPOOL OFF
EXIT 0