ALL,
It looks like it is not possible to find what version f SQL Anywhere is running and t which I connected. Because it is everywhere listed as "Get the SQL Anywhere server version the DATABASE was made".
Not interested. I want to now the current running server version of SQL Anywhere.
Is it possible?
I tried sp_version
and SELECT @@version
, but the are for the big Sybase
and not for SQL Anywhere
and so produce an error as no such procedure/column
.
TIA!!
To get the version of the SQLAnywhere software (not the version of the database file) there are a few options:
If you're logged into a database:
1> select @@version
2> go
@@version
---------------
17.0.9.4899
1> select property('ProductVersion')
2> go
property('ProductVersion')
------------------------------
17.0.9.4899
NOTE: if these generate an error then it may be a case of your SQLAnywhere software being extremely old or you're not actually connected to a SQLAnywhere database
From the command line, and assuming you have access to the dbsrv##
binary, you can use the dbversion
binary to display the version string of various SQLAnywhere binaries (eg, dbsrv##
, dbeng##
):
$ type -a dbversion dbsrv17
dbversion is /opt/sap/ASA17/bin/dbversion
dbsrv17 is /opt/sap/ASA17/bin/dbsrv17
$ dbversion /opt/sap/ASA17/bin/dbsrv17
SQL Anywhere Version Diagnostic Utility Version 17.0.9.4899
/opt/sap/ASA17/bin/dbsrv17: dbsrv17 GA 17 0 9 4899 linux 2018/11/07 21:52:49 posix 64 production
^^^^^^^^^^^
NOTES:
dbversion /opt/sap/ASA17/bin/dbsrv17
call ...dbversion
binarydbsrv17
binary with the version displayed as space delimited numbers (17 0 9 4899
in this case)If your dbversion
call gives you an error (eg, dbversion
not found, or not able to find a .so
file) then make sure your PATH
and LD_LIBRARY_PATH
environment variables have been updated accordingly. In my case SQLAnywhere is used as a embedded component of another software package so I had to first issue the following:
$ LD_LIBRARY_PATH="/opt/sap/ASA17/lib:${LD_LIBRARY_PATH}"
$ PATH="/opt/sap/ASA17/bin:${PATH}"
If you're looking for the version of software the database file was created under (and last upgraded to) you can get a history of software versions from the SYSHISTORY view, eg:
1> select operation, version, last_time
2> from SYSHISTORY
3> order by last_time
4> go
operation version last_time
------------ ------------- --------------------------------
INIT 17.0.9.4899 Jul 29 2022 12:26:47.000000PM
LAST_BACKUP 17.0.9.4899 Jul 29 2022 12:26:51.000000PM
START 17.0.9.4899 May 12 2023 10:51:45.000000AM
START 17.0.9.4899 May 2 2024 10:54:08.000000AM
START 17.0.9.4899 May 2 2024 10:54:08.000000AM
LAST_START 17.0.9.4899 May 2 2024 10:54:08.000000AM
If you're unable to log into the database you may be able to ascertain the version of the database file by running strings
against the database file while looking for the version string next to a 'Copyright' message. Keep in mind this may generate a lot of output.
$ strings db_name.db | grep -i copyright
... snip ...
Copyright (c)2015 17.0.9.4899 SAP SE, Copyright (c)2015 17.0.9.4899 SAP SE, Copyright ...
^^^^^^^^^^^ ^^^^^^^^^^^
... snip ...
Since the SYSHISTORY
data is in the db file another twist on the strings
approach consists of running a grep
for the various operations
values, eg:
$ strings db_name.db | grep -E -A1 'START$|INIT$|BACKUP$'
START
17.0.9.48992Linux 5.15.0-105-generic #115~20.04.1-Ubuntu SMP Mz&L
^^^^^^^^^^^
START
17.0.9.48992Linux 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu
^^^^^^^^^^^
LAST_BACKUP
17.0.9.48992Linux 5.8.0-41-generic #46~20.04.1-Ubuntu SMP Mon
^^^^^^^^^^^
--
START
17.0.9.48992Linux 5.8.0-41-generic #46~20.04.1-Ubuntu SMP Mon
^^^^^^^^^^^
LAST_START
17.0.9.48992Linux 5.15.0-105-generic #115~20.04.1-Ubuntu SMP Mz&L
^^^^^^^^^^^
INIT
17.0.9.48992Linux 5.8.0-41-generic #46~20.04.1-Ubuntu SMP Mon
^^^^^^^^^^^
--
CATALOGATSTART
CATALOGATSTART
select 1