Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (日本語) » SQL Anywhere サーバ - データベース管理 » データベースの管理 » データベース管理ユーティリティ » 管理ユーティリティの概要 » 設定ファイルの使用

 

設定ファイルでの条件付き解析の使用

設定ファイルで条件付き解析を使用することによって、そのファイルを使用できるユーティリティを指定できます。条件ディレクティブを使用すると、設定ファイルを使用するユーティリティに応じてコマンド・パラメータを適用したり除外したりすることができます。設定ファイルで条件付き解析を使用する場合でも、ファイル難読化ユーティリティ (dbfhide) を使用して、設定ファイルの内容を非表示にすることができます。

構文
configuration-file= text...
text : comment | conditional | command-line-option
comment : line starting with # that is not a conditional
conditional :
#if  condition
text
   [ #elif  condition
text
   ] ...
   [ #else
   text
 ] ...
#endif
condition : { tool=utility-name[,utility-name]... | utility-name }

utility-name では、次の値がサポートされています。

dbbackup dbinfo dbltm dbstop dbxtract
dbdsn dbinit dbmlsync dbsupport mlsrv
dbeng dblic dbping dbsvc mluser
dberase dblocate dbremote dbunload qaagent
dbfhide dblog dbspawn dbupgrad rteng
dbhist dblsn dbsrv dbvalid
使用法

ディレクティブと認識されるようにするには、1 つの行で空白以外の最初の文字を # とします。#if または #elif ディレクティブ内にユーティリティが含まれている場合、そのディレクティブから次の条件付きディレクティブまでの行が処理の対象となります。#else ディレクティブは、それより前のブロックにユーティリティがない場合に実行する処理を示します。条件付きディレクティブ構造は、#endif ディレクティブで終了します。

tool= で指定するツール名のリスト内に空白を入れることはできません。条件付きディレクティブはネストすることができます。設定ファイルの解析中にエラーが発生すると、ユーティリティは設定ファイルを開くことができない旨をレポートします。

次の設定ファイルを使用できるユーティリティは、dbping、dbstop、dbvalid です。

#if tool=dbping,dbstop,dbvalid
   #always make tools quiet
   -q
   -c "UID=DBA;PWD=sql;ENG=myserver;DBN=mydb"
   #if dbping
      #make a database connection
      -d
   #elif tool=dbstop
      #don't ask
      -y
   #else
      #must be dbvalid
      #use WITH EXPRESS CHECK
      -fx
   #endif
#endif