{"id":299,"date":"2021-12-10T23:20:49","date_gmt":"2021-12-10T23:20:49","guid":{"rendered":"http:\/\/basicwebsitesolutions.com\/blog\/?p=299"},"modified":"2021-12-10T23:20:51","modified_gmt":"2021-12-10T23:20:51","slug":"gfix-firebird-administration","status":"publish","type":"post","link":"https:\/\/basicwebsitesolutions.com\/blog\/2021\/12\/10\/gfix-firebird-administration\/","title":{"rendered":"GFIX \u2014 Firebird Administration"},"content":{"rendered":"\n<p>GFIX is Firebird&#8217;s command line tool for administration issues like data repair, sweeping, etc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">General Syntax<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix [options] -user &lt;username&gt; -password &lt;password&gt; &lt;database&gt; [options]<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">&nbsp;<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>-user &lt;username&gt;<\/td><td>Database user name<\/td><\/tr><tr><td>-pas[sword] &lt;password&gt;<\/td><td>Database password<\/td><\/tr><tr><td>-fet[ch_password] &lt;filename&gt;<\/td><td>Instead of -password: Fetch password from the file so it is not visible in the command line. When &lt;filename&gt; is stdin, the user will be prompted for the password. [Firebird&nbsp;2.5]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Database Shutdown<\/h2>\n\n\n\n<p>When a database has been shut down, only SYSDBA and the database owner are able to connect to the database in order to perform administrative tasks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Options<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>-at[tach] &lt;seconds&gt;<\/td><td>Used with the -shut option. Waits &lt;seconds&gt; seconds for all current connections to end. If after &lt;seconds&gt; seconds there are still connections open, the shutdown will be cancelled and return an error.<\/td><\/tr><tr><td>-f[orce] &lt;seconds&gt;<\/td><td>Used with the -shut option. Waits &lt;seconds&gt; seconds for all connections and transactions to end. After this time, all connections and transactions are cancelled and the database is shut down. Use with caution.<\/td><\/tr><tr><td>-o[nline]<\/td><td>If a -shut operation is pending, it is cancelled. Otherwise, takes a database back online<\/td><\/tr><tr><td>-sh[ut]<\/td><td>Shut down database. Must be used together with -attach, -force or -tran<\/td><\/tr><tr><td>-shut {normal | multi | single | full}-online {normal | multi | single | full}&nbsp;<\/td><td>Firebird 2.0 and later: New shutdown modes:NORMAL: Database is active and online<br>MULTI: Only connection from SYSDBA and the Database Owner will be allowed (compatible mode with Firebird 1.0\/1.5)<br>SINGLE: Only one SYSDBA or Database Owner connection will be allowed<br>FULL: Exclusive shutdown: Database is completely offline, no connections will be allowed (it is now possible to access the database file safely on a file basis, e.g. for backups)Use -shut to &#8220;go down&#8221; the scale of shutting down and -online to &#8220;go up&#8221; that scale.<\/td><\/tr><tr><td>-tr[an] &lt;seconds&gt;<\/td><td>Used with the -shut option. Waits &lt;seconds&gt; seconds for all running transactions to end. If after &lt;seconds&gt; seconds there are still running transactions, the shutdown will be cancelled.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Examples<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Shut down database, wait 60 seconds until all connections are closed<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password \"masterkey\" dbserver:\/db\/mydb.fdb <strong>-shut -attach 60<\/strong><\/pre>\n\n\n\n<p>Note that GFIX will terminate with an error if there are still connections open after 60 seconds.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Shut down database, force shutdown after 60 seconds<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-shut -force 60<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Shut down database, force shutdown NOW<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-shut -force 0<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Put database online again<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-online<\/strong><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Examples for Firebird 2.0<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Shut down database to single user mode<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-shut single -force 60<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Put database online again<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-online normal<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Shut down database, force shutdown NOW, allow no subsequent connections, even from SYSDBA or Owner<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-shut <em>full<\/em> -force 0<\/strong><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Database Repair, Sweeping<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Options<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>-f[ull]<\/td><td>Use with the -v option. Checks all records and pages and releases unassigned record fragments<\/td><\/tr><tr><td>-h[ousekeeping] 0<\/td><td>Switch off automatic sweeping<\/td><\/tr><tr><td>-h[ousekeeping] &lt;n&gt;<\/td><td>Set Sweep Interval to &lt;n&gt; transactions (default is 20000)<\/td><\/tr><tr><td>-i[gnore]<\/td><td>Ignores checksum errors during a validate or sweep<\/td><\/tr><tr><td>-m[end]<\/td><td>Marks corrupt records as unavailable so they are skipped on a subsequent backup<\/td><\/tr><tr><td>-n[o_update]<\/td><td>Use with the -v option. Checks all records and pages and reports errors but does not repair them<\/td><\/tr><tr><td>-sweep<\/td><td>Forces an immediate sweep<\/td><\/tr><tr><td>-v[alidate]<\/td><td>Check database for validity. At the same time, errors are reported and repaired<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Examples<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Validate Database<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-v -f<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Sweep Database now<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-sweep<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Set Sweep Interval to 50000 transactions<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-h 50000<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Switch off Automatic Sweeping<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-h 0<\/strong><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Misc<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Options<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>-a[ctivate]<\/td><td>Activate Shadow file for database usage<\/td><\/tr><tr><td>-b[uffers] &lt;pages&gt;<\/td><td>Default cache buffers for the database will be set to &lt;pages&gt; pages<\/td><\/tr><tr><td>-c[ommit] &lt;id&gt;<\/td><td>Commits limbo transaction specified by the given &lt;id&gt;<\/td><\/tr><tr><td>-c[ommit] all<\/td><td>Commits all limbo transactions<\/td><\/tr><tr><td>-l[ist]<\/td><td>Display IDs of all limbo transactions and what would happen to each transaction if you would use -t on it<\/td><\/tr><tr><td>-mo[de] read_write<\/td><td>Set mode of database to read\/write (default). Requires exclusive access to database (shutdown)<\/td><\/tr><tr><td>-mo[de] read_only<\/td><td>Set mode of database to read-only. Requires exclusive access to database (shutdown)<\/td><\/tr><tr><td>-pa[ssword] &lt;password&gt;<\/td><td>Database password<\/td><\/tr><tr><td>-p[rompt]<\/td><td>Use with -l. Prompts for action.<\/td><\/tr><tr><td>-r[ollback] &lt;id&gt;<\/td><td>Rolls back limbo transaction specified by the given &lt;id&gt;<\/td><\/tr><tr><td>-r[ollback] all<\/td><td>Rolls back all limbo transactions<\/td><\/tr><tr><td>-s[ql_dialect] 1<\/td><td>Sets SQL dialect 1 for the database<\/td><\/tr><tr><td>-s[ql_dialect] 3<\/td><td>Sets SQL dialect 3 for the database<\/td><\/tr><tr><td>-t[wo_phase] &lt;id&gt;<\/td><td>Performs automated two-phase recovery for limbo transaction with the given &lt;id&gt;<\/td><\/tr><tr><td>-t[wo_phase] all<\/td><td>Performs automated two-phase recovery for all limbo transactions<\/td><\/tr><tr><td>-user &lt;name&gt;<\/td><td>Database username<\/td><\/tr><tr><td>-w[rite] sync<\/td><td>Enables Forced Writes<\/td><\/tr><tr><td>-w[rite] async<\/td><td>Disabled Forced Writes<\/td><\/tr><tr><td>-z<\/td><td>Show GFIX and server version<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Examples<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Set Database to Read-Only<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-shut -attach 60<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-shut -force 0<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-mode read_only<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-online<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Set Database to SQL Dialect 3<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-sql_dialect 3<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Enable Forced Writes<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-write sync<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Disable Forced Writes<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">gfix -user SYSDBA -password masterkey dbserver:\/db\/mydb.fdb <strong>-write async<\/strong>\n\nhttp:\/\/www.destructor.de\/firebird\/gfix.htm<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>GFIX is Firebird&#8217;s command line tool for administration issues like data repair, sweeping, etc. General Syntax gfix [options] -user &lt;username&gt; -password &lt;password&gt; &lt;database&gt; [options] &nbsp; -user &lt;username&gt; Database user name -pas[sword] &lt;password&gt; Database password -fet[ch_password] &lt;filename&gt; Instead of -password: Fetch password from the file so it is not visible in the command line. When &lt;filename&gt; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/basicwebsitesolutions.com\/blog\/2021\/12\/10\/gfix-firebird-administration\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;GFIX \u2014 Firebird Administration&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-299","post","type-post","status-publish","format-standard","hentry","category-life-as-a-programmer"],"_links":{"self":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=299"}],"version-history":[{"count":1,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/299\/revisions"}],"predecessor-version":[{"id":300,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/299\/revisions\/300"}],"wp:attachment":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}