2017-10-12 14 views
0

を使用してクエリのO/Pを取得でき、プロセス・テストを回復します問題?は、私のようにシェルスクリプトを書いたシェルスクリプト

+0

問題を詳しく説明してください。期待される結果は何ですか? 「取得できません」とはどういう意味ですか?遭遇したエラーは何ですか? – tambre

+0

最初の部分、EOFからEOFまでの作業ですが、2番目の部分_EOF1_、 –

+0

を実行中にエラーが発生しました。 -f-file( '_EOF1_ 'が必要)はsqlplusの部分を実行しませんが、rman部分はあるスクリプトで記述され、同じsqlplus部分は他のスクリプトで記述され、rmanスクリプトからsqlplusスクリプトを呼び出すと正常に動作します。 –

答えて

0

あなたのコードに何が問題なのか分かりません。それは動作するはずです。私はそれをテストした:

$ sqlplus '/as sysdba' <<_EOF1_ >sql.log 
     spool '/home/oracle/test1.log' 
     select * from dual; 
     spool off; 
exit; 
_EOF1_ 

出力

$ cat sql.log 

SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 6 15:18:42 2017 

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


Connected to: 
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production 
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, 
Data Mining and Real Application Testing options 

SQL> SQL> 
D 
- 
X 

SQL> SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production 
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, 
Data Mining and Real Application Testing options 

出力2

$ cat /home/oracle/test1.log 
SQL>   select * from dual; 

D                    
-                    
X                    

SQL>   spool off; 

あなたの目標をacomplishに2つのオプションがあります。あなたは両方で1つを使用します。その理由は何ですか?

オプション1

$ sqlplus/as sysdba <<EOF> /dev/null 
spool test.out 
select * from dual; 
spool off 
EOF 

出力

$ cat test.out 
SQL> select * from dual; 

D                    
-                    
X                    

SQL> spool off 

オプション2

$ sqlplus/as sysdba <<EOF> test.out 
> select * from dual; 
> EOF 

出力

$ cat test.out 

SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 6 15:12:05 2017 

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


Connected to: 
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production 
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, 
Data Mining and Real Application Testing options 

SQL> 
D 
- 
X 

SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production 
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, 
Data Mining and Real Application Testing options 
関連する問題