24. srpna 2015

Zaznamenávání požadavků na Sybase server

Pomocí nenápadného parametru  -zr nebo zavoláním sa_server_option se dají uchovat záznamy o dotazech, které jdou na server. Zájemce o toto chování odkážu na http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.infocenter.dc36584.1260/html/iqerror/BABIAEJJ.htm

Logging server requests


For isolating some types of problems, especially problems with queries, logging server requests is helpful. You can enable request-level logging in two ways:
  • By setting the -zr command-line option when you start the server.
  • By calling the sa_server_option stored procedure, which overrides the current setting of the -zr command-line option.
Server requests are logged in the server log file *.srvlog. The -zr server startup option enables request-level logging of operations and sets the type of requests to log (ALL, NONE, or SQL). The -zo option redirects request-level logging information to a file separate from the regular log file and -zs limits the size of this file.
You can enable and disable request-level logging without restarting the IQ server using the sa_server_option stored procedure. The following commands enable request-level logging of a limited set of requests and redirect the output to the file sqllog.txt:
call sa_server_option('request_level_logging','SQL');
call sa_server_option('request_level_log_file',
                       'sqllog.txt');
The following command disables request-level logging:
call sa_server_option('request_level_log_file','');
To view the current settings for the SQL log file and logging level, execute the following statement:
select property('RequestLogFile'),        property('RequestLogging');

To match .iqmsg log and the -zr SQL log entries using connection information, see “Correlating connection information”.
The following output shows the limited requests that are logged, when the server is started with the -zr SQL option. In this example, the user connects to theasiqdemo database, executes the command
SELECT * FROM customer
then disconnects. In the server log, each line is preceded by a datetime stamp, which has been removed from this sample output.
REQUEST conn: 1182240 CONNECT
DONE    conn: 1182240 CONNECT          Conn=1330880449
REQUEST conn: 1182240 STMT_EXECUTE_IMM  "SET TEMPORARY OPTION CONNECTION_AUTHENTICATION='Company=MyComp;Application=DBTools;Signature=4f13d14f3'"
DONE    conn: 1182240 STMT_EXECUTE_IMM 
REQUEST conn: 1182240 STMT_PREPARE      "SELECT user, db_property('IQStore')  FROM SYS.DUMMY"
DONE    conn: 1182240 STMT_PREPARE     Stmt=65536
REQUEST conn: 1182240 STMT_EXECUTE     Stmt=65536 
DONE    conn: 1182240 STMT_EXECUTE 

Žádné komentáře:

Okomentovat