今天编写了一个执行备份的脚本,在ue里面编写,让后传递到linux下,结果出现了syntax error near unexpected token ` 错误。网上的解决办法是:
1)vi -b expdp_alibankdw_test.sh
2)在命令编辑行输入:%s/^M//g
注意:上述命令行中的“^M”符,不是“^”再加上“M”,而是由“Ctrl+v+M”键生成的。
a.一些linux版本有 dos2unix 程序,可以用来祛除^M。
b.cat filename1 | tr -d "\r" > newfile 去掉^M生成一个新文件,还有sed命令等,凡是可以替换的命令都是可以用来新生成一个文件的。
oracle@rac1:rac1 /tmp/dump>sh expdp_alibankdw_test.sh
'xpdp_alibankdw_test.sh: line 13: syntax error near unexpected token `
'xpdp_alibankdw_test.sh: line 13: `expdp_alibank()
oracle@rac1:rac1 /tmp/dump> cat expdp_alibankdw_test.sh |tr -d "\r" > test.sh
oracle@rac1:rac1 /tmp/dump>sh test.sh
Begin export alibank's schemas .....
Export: Release 11.2.0.1.0 - Production on Sat Mar 12 19:20:12 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_FULL_01": "/******** AS SYSDBA" estimate_only=y full=y
Estimate in progress using BLOCKS method...
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
. estimated "CIF"."CIF_REF" 1024 KB
. estimated "CIF"."CIF_REF_EDUCATION" 1024 KB
. estimated "CIF"."CIF_REF_MARITAL" 1024 KB
. estimated "CIF"."CIF_REF_REL" 1024 KB
. estimated "CIF"."CIF_REF_SUBJECT" 1024 KB
. estimated "CIF"."CIF_SYNC_LOCK" 1024 KB
. estimated "CIF"."CIF_VALUE" 1024 KB
。。。。。。。。。。。。。。。。。。。
. estimated "SYSMAN"."MGMT_SYSTEM_PERFORMANCE_LOG" 576 KB
. estimated "APEX_030200"."WWV_FLOW_LIST_OF_VALUES_DATA" 512 KB
. estimated "SH"."PROMOTIONS" 512 KB
. estimated "SH"."TIMES" 512 KB
. estimated "SYSMAN"."MGMT_DB_INIT_PARAMS_ECM" 512 KB
. estimated "SYSMAN"."MGMT_ESA_REPORT" 512 KB
. estimated "SYSMAN"."MGMT_HC_OS_COMPONENTS" 512 KB
. estimated "SYSMAN"."MGMT_HC_VENDOR_SW_COMPONENTS" 512 KB
. estimated "SYSMAN"."MGMT_POLICY_ASSOC" 512 KB
. estimated "SYSMAN"."MGMT_POLICY_ASSOC_CFG" 512 KB
. estimated "APEX_030200"."WWV_FLOW_MESSAGES$" 448 KB
. estimated "APEX_030200"."WWV_FLOW_PAGE_PLUG_TEMPLATES" 448 KB
. estimated "APEX_030200"."WWV_FLOW_WORKSHEETS" 448 KB
. estimated "SYSMAN"."MGMT_HC_VENDOR_SW_SUMMARY" 448 KB
. estimated "PM"."TEXTDOCS_NESTEDTAB" 192 KB
. estimated "SH"."COSTS":"COSTS_Q1_1999" 192 KB
. estimated "SH"."COSTS":"COSTS_Q1_2001" 192 KB
. estimated "SH"."COSTS":"COSTS_Q2_2001" 192 KB
. estimated "SH"."COSTS":"COSTS_Q3_2001" 192 KB
1)vi -b expdp_alibankdw_test.sh
2)在命令编辑行输入:%s/^M//g
注意:上述命令行中的“^M”符,不是“^”再加上“M”,而是由“Ctrl+v+M”键生成的。
a.一些linux版本有 dos2unix 程序,可以用来祛除^M。
b.cat filename1 | tr -d "\r" > newfile 去掉^M生成一个新文件,还有sed命令等,凡是可以替换的命令都是可以用来新生成一个文件的。
oracle@rac1:rac1 /tmp/dump>sh expdp_alibankdw_test.sh
'xpdp_alibankdw_test.sh: line 13: syntax error near unexpected token `
'xpdp_alibankdw_test.sh: line 13: `expdp_alibank()
oracle@rac1:rac1 /tmp/dump> cat expdp_alibankdw_test.sh |tr -d "\r" > test.sh
oracle@rac1:rac1 /tmp/dump>sh test.sh
Begin export alibank's schemas .....
Export: Release 11.2.0.1.0 - Production on Sat Mar 12 19:20:12 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_FULL_01": "/******** AS SYSDBA" estimate_only=y full=y
Estimate in progress using BLOCKS method...
Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
. estimated "CIF"."CIF_REF" 1024 KB
. estimated "CIF"."CIF_REF_EDUCATION" 1024 KB
. estimated "CIF"."CIF_REF_MARITAL" 1024 KB
. estimated "CIF"."CIF_REF_REL" 1024 KB
. estimated "CIF"."CIF_REF_SUBJECT" 1024 KB
. estimated "CIF"."CIF_SYNC_LOCK" 1024 KB
. estimated "CIF"."CIF_VALUE" 1024 KB
。。。。。。。。。。。。。。。。。。。
. estimated "SYSMAN"."MGMT_SYSTEM_PERFORMANCE_LOG" 576 KB
. estimated "APEX_030200"."WWV_FLOW_LIST_OF_VALUES_DATA" 512 KB
. estimated "SH"."PROMOTIONS" 512 KB
. estimated "SH"."TIMES" 512 KB
. estimated "SYSMAN"."MGMT_DB_INIT_PARAMS_ECM" 512 KB
. estimated "SYSMAN"."MGMT_ESA_REPORT" 512 KB
. estimated "SYSMAN"."MGMT_HC_OS_COMPONENTS" 512 KB
. estimated "SYSMAN"."MGMT_HC_VENDOR_SW_COMPONENTS" 512 KB
. estimated "SYSMAN"."MGMT_POLICY_ASSOC" 512 KB
. estimated "SYSMAN"."MGMT_POLICY_ASSOC_CFG" 512 KB
. estimated "APEX_030200"."WWV_FLOW_MESSAGES$" 448 KB
. estimated "APEX_030200"."WWV_FLOW_PAGE_PLUG_TEMPLATES" 448 KB
. estimated "APEX_030200"."WWV_FLOW_WORKSHEETS" 448 KB
. estimated "SYSMAN"."MGMT_HC_VENDOR_SW_SUMMARY" 448 KB
. estimated "PM"."TEXTDOCS_NESTEDTAB" 192 KB
. estimated "SH"."COSTS":"COSTS_Q1_1999" 192 KB
. estimated "SH"."COSTS":"COSTS_Q1_2001" 192 KB
. estimated "SH"."COSTS":"COSTS_Q2_2001" 192 KB
. estimated "SH"."COSTS":"COSTS_Q3_2001" 192 KB
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22664653/viewspace-689280/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22664653/viewspace-689280/