Displays optimizer statistics or loads updated statistics into system tables.
(UNIX) $SYBASE/$SYBASE_ASE/bin.
(Windows) %SYBASE%\%SYBASE_ASE%\bin, as optidag.exe.
optdiag [binary] [simulate] statistics { -i input_file | database[.owner[.[{table|prs_name}[.column] ] ] ] [-o output_file] } [-U user_name] [-P password] [-T trace_value] [-I interfaces_file] [-S server] [-v] [-h] [-s] [-z language] [-J client_character_set] [-a display_charset]
Display mode – if you do not specify an owner, but do specify a table name, optdiag displays output for all of the owners of a table.
Input mode – optdiag ignores the table owner specified on the command line and uses the value in the input file.
Does not include an owner name or a table name – optdiag displays statistics for all tables in the database.
Includes an owner name, but no table name – optdiag displays all of the tables that belong to the specified owner.
In input mode, optdiag ignores the table name specified on the command line and uses the value from the input file.
In input mode, optdiag ignores the column name on the command line and uses the values from the input file.
1 – do not stop with a warning if the optdiag version of SAP ASE in use does not match the SAP ASE version in the input file.
2 – display status message “Next table is table_name” when in input mode.
4 – skip consistency checking for step numbers while loading histograms in input mode.
6 – display lines of input file during input mode. This flag has no effect in display mode.
7 – do not stop with a warning if the optdiag input file does not include sampling percent information.
If you do not use -I and specify an interfaces file name, optdiag looks for the interfaces file (interfaces in UNIX), in the directory specified by the SYBASE environment variable. In Windows, optdiag looks for a file named sql.ini in the ini subdirectory in the Sybase installation directory (d:\sybase). Then, if SYBASE is not set, optdiag looks for the file in the default $SYBASE directory (%SYBASE% in Windows).
If you use -S without specifying a server name, optdiag looks for a server named SYBASE.
When you do not use -S, optdiag looks for the server that your DSQUERY environment variable specifies.
Add languages to SAP ASE either during or after installation, After SAP ASE installation, use either the langinstall utility or the sp_addlanguage stored procedure to add a language.
By using -J client_charset, you request that the SAP ASE server convert data to and from client_charset, the client’s character set.
By using -J without a character set name, you specify character set conversion as NULL; no conversion takes place. Use this -J alone when the client and server are using the same character set.
By omitting -J, you set the character set to the default set for the platform. A filter converts input between the default set and the SAP ASE character set. Keep in mind that the default may not necessarily be the character set that the client is using.
For more information about character sets and their associated flags, see the System Administration Guide.
In conjunction with -J to specify the character set translation (.xlt) file required for the conversion.
Without -J only if the client character set is the same as the default character set.
unsetenv LANG
setenv LANG C
optdiag -J
optdiag -Jiso-1 (if your server uses iso-1)
optdiag statistics pubs2 -Usa -Ppasswd -o pubs2.opt
optdiag statistics pubs2..titles -Usa -Ppasswd -o titles.opt
optdiag statistics prsdb..prs1 -Usa -Ppass –Sserver Server name: "" Specified database: "prsdb" Specified table owner: not specified Specified table: "prs1" Specified column: not specified Table owner: "dbo" Table name: "prs1" Table type: "precomputed result set" Statistics for table: "prs1" . . . No statistics for remaining columns: "a" (default values used) Optdiag succeeded.
optdiag statistics pubs2..titles -Usa -Ppasswd -o titles.opt -J roman8 -z french
optdiag binary statistics pubs2..titles.price -Usa -Ppasswd -o price.opt
optdiag statistics -i price.opt -Usa -Ppasswd