I am struggling to find how to access the server console on Windows Server 2008, and was hoping someone might be able to help?

By this I am referring to the message window accessed by clicking on the lightning strike which appears in the start menu by the clock. In this case it is a network server which I have launched by using an auto-starting service created in Sybase Central.

Is this message window accessible from anywhere else, as it is very useful to point a client at to check the database service has started up correctly.

I'm running SQLAnywhere 11.0.1.2427.

Thanks

asked 23 Nov '10, 17:35

Adam%20King's gravatar image

Adam King
2255513
accept rate: 0%

edited 24 Nov '10, 08:53

Volker%20Barth's gravatar image

Volker Barth
31.3k312458674


Have a look at DBCONSOLE (->Sybase DCX). This utility displays the messages that would be shown in the info window of the database engine (if MS hadn't decided services should not interact with the desktop anymore). Minor drawback: you'll have to establish a connection to a database started by the engine.
Alternative method: start Sybase Central, connect to a database running on the server, and select View -> Server Messages from the menu (or press Alt+1).

permanent link

answered 23 Nov '10, 18:28

Reimer%20Pods's gravatar image

Reimer Pods
4.2k344583
accept rate: 11%

edited 24 Nov '10, 15:40

2

For the record, Vista and later OSs do not allow services to interact with the desktop so there will be no lightning bolt icon in the systray and there is no way to see the server's application window because, well, there isn't one.

(23 Nov '10, 21:39) John Smirnios

A further (and very common) approach is to let the database engine write the server messages to a log file (which is a plain text file, not to be mistaken with the transaction log).

You can use the -o engine command option for this (and its variants like -oe for startup errors and the like).

Then for trouble-shooting, you (or your customer) just have to open the file. It's particular helpful when diagnosing problems with server startup or shutdown (where the DBCONSOLE is less helpful for obvious reasons...) and often asked for by technical support.

permanent link

answered 24 Nov '10, 08:41

Volker%20Barth's gravatar image

Volker Barth
31.3k312458674
accept rate: 33%

edited 24 Nov '10, 08:50

We use this and it's a great option. But keep an eye on the size of the file. Whenever we have cause to stop the server, we make sure we move the existing file into an archive and let it start over.

(30 Nov '10, 20:57) carolstone
Comment Text Removed

@Carol: I agree:) Then I would recommend to use option -os MaxSize (i.e. automatically renaming the log file when is reaches the maximum size and creating a new one), or option -on MaxSize (which works similarily but keeps just one old log file).

(30 Nov '10, 21:40) Volker Barth

If you are willing to use web services and can start the server with the "-xs http" server switch to start the SQL Anywhere built-in HTTP server, then you could do the following to view the console messages in a browser:

1) Create a web service in your database that accepts requests:

create service console_messages
       type 'raw'
       authorization off
       user "dba"
       url off
       as call "dba".sp_console_messages();

2) Define the sp_console_messages() procedure:

create or replace procedure sp_console_messages()
result (rawdoc long varchar)
begin
    declare @result long varchar;

select list( '<tr><td>'||line_num
               ||'</td><td>'||message_time
               ||'</td><td>'||html_encode(message_text)
               ||'</td></tr>\n', '' order by line_num desc )
          into @result
      from sa_get_server_messages(0);

set @result = '<html>\n'
        ||    '<head><title>Console Messages - '
        ||    html_encode( property('name') )
        ||    '</title></head>\n'
        ||    '<body>\n'
        ||    '<table border=0>\n'
        ||    ' <tr><th>Line</th><th>Time</th><th>Message</th></tr>\n'
        ||    @result
        ||    '</table>\n'
        ||    '</body>\n'
        ||    '</html>\n'
        ;
    call sa_set_http_option( 'AcceptCharset', '+,utf-8,*' );
    call sa_set_http_header( 'Content-Type', 'text/html' );
    select @result;
end;

3) Add "-xs http" to your server start line (if you haven't done this already). E.g.

dbsrv12 test.db -xs http

4) Use your browser to view the console log by browsing to:

http://yourhost.yourdomain.com/console_messages

Note that the messages come out in reverse order - this is due to the "desc" in the order by clause of the list() expression in the sp_console_messages procedure. I did this so the most recent message would be displayed at the top (so you don't have to scroll down all the time to see what has recently happened). If you don't like this, simply replace "desc" with "asc" (or remove "desc" completely).

You can do lots of interesting things using similar methods. E.g. get a list of server properties (call sa_eng_properties), connection properties (call sa_conn_properties), etc.

To be secure, you can either add "AUTHORIZATION ON" to your service definition to require that the dba username/password is specified in order to get the console messages, or add "SECURE ON" (and add appropriate certificates to the "-xs https" server command line) to require that a secure connection is used, or BOTH (which I would recommend!).

permanent link

answered 23 Nov '10, 21:43

Mark%20Culp's gravatar image

Mark Culp
23.3k9132275
accept rate: 40%

edited 23 Nov '10, 21:50

As a variant of Mark's webservice approach, you also can use the server properties "Messages", "MaxMessage" and the like to list the messages in a usual SQL result set or display them in DBISQL.

Here's the source of a small helper procedure we do use to display such messages in DBISQL's status area:

-----------------------------------------------------------------------------
-- procedure to show the nCount last messages in DBISQL's status window
-----------------------------------------------------------------------------

create procedure "DBA".STP_ShowLastLogMessages(nCount int default 20)
no result set
begin
   declare nMaxMsg bigint;
   declare n int;
   declare strMsg varchar(1000);
   set nMaxMsg = (select property('MaxMessage'));
   set n = isnull(nCount, 20);
   message 'Last ' || n || ' messages:' type status to client;
   while n > 0 loop
      set strMsg = (select property('Message', nMaxMsg - n + 1));
      message strMsg type status to client;
      set n = n - 1;
   end loop;
   message 'Messages ended.' type status to client;
end;

If applicable, you can grant even non-DBA users the right to execute this procedure to llok for server messages.

permanent link

answered 24 Nov '10, 08:50

Volker%20Barth's gravatar image

Volker Barth
31.3k312458674
accept rate: 33%

Thanks everyone - it's good to know why the console doesn't appear any more, and I had never seen the View Server Messages and Executed SQL which is probably good enough for my purposes.

The other answers could all be useful in the future, so thanks again!

permanent link

answered 24 Nov '10, 11:28

Adam%20King's gravatar image

Adam King
2255513
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×35
×12
×10
×5

question asked: 23 Nov '10, 17:35

question was seen: 1,723 times

last updated: 24 Nov '10, 15:40