FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.26k stars 216 forks source link

Add -se switch to gstat tool #8282

Open sim1984 opened 4 weeks ago

sim1984 commented 4 weeks ago

Windows 10. Firebird 3.0, 4.0, 5.0.

The following command works successfully.

gstat localhost/3055:horses -u SYSDBA -p masterkey -h

However, if you replace the connection string with a URL, this syntax will throw an error.

gstat inet://localhost:3055/horses -u SYSDBA -p masterkey -h
Network name not found.

Funny thing is, it doesn't work with remote host at all.

c:\Firebird\5.0>gstat server/3055:horses -u SYSDBA -p masterkey -h

Database "d:\fbdata\5.0\horses.fdb"
Gstat execution time Mon Oct 14 11:21:54 2024

Database header page information:
        Flags                   0
        Generation              1454
        System Change Number    0
        Page size               16384
        ODS version             13.1
        Oldest transaction      1460
        Oldest active           1461
        Oldest snapshot         1461
        Next transaction        1461
        Sequence number         0
        Next attachment ID      130
        Implementation          HW=AMD/Intel/x64 little-endian OS=Windows CC=MSVC
        Shadow count            0
        Page buffers            0
        Next header page        0
        Database dialect        3
        Creation date           Aug 5, 2024 9:12:46
        Attributes              force write

    Variable header data:
        Database GUID:  {0315AF2A-5312-4B52-95FA-5C39731062D6}
        Sweep interval:         20000
        *END*
Gstat completion time Mon Oct 14 11:21:54 2024

This is information from a database configured on a localhost. It would be better if it honestly said that it is not allowed to do this. In this case, the result is misleading.

The best solution would be to add a -se switch, like gbak. Then you could work via gstat with a remote host. I know that you can do this via the universal fbsvcmgr, but the commands for it are longer and this tool is poorly documented.

basid-irk commented 3 weeks ago
set/export ISC_PASSWORD=SECRET
fbsvcmgr host:port/service_mgr user LOGIN action_db_stats sts_hdr_pages dbname DB

xnet://service_mgr work too (and for Firebird 2.1+ with some exemption).

P.S. Yes, verbose :)

sim1984 commented 3 weeks ago

I wrote what I know about fbsvcmgr and how to use it. However, I think that: