Subject Re: [firebird-support] Sweep and Mend incompatible Validation options. Why?
Author Helen Borrie
At 10:58 AM 15/02/2006, you wrote:
>I am trying to run a
>Sweep then a Mend then a BackUp.

Why?


>I ran the Sweep validation method.
>using IBOServices and Firebird 1.5.

This is OK. Sweep doesn't need exclusive access.

>Then I ran the Mend validation method.
>and the error came up:
>
>bad parameters on attach or create database
>
>secondary server attachments cannot validate databases

This is two messages, not one. The first (top-level) refers to the
attachment request passed by the service manager on behalf of the
user. The user for a validation operation has to be SYSDBA or the
database owner AND there must not be already any other attachments to
the database, i.e. exclusive access is required. That's what the
lower-level message is telling you.


>I then made the sweep and the mend option part
>of the same validation service and I got this:
>
>please retry, specifying an option
>
>What can I do?

First, understand that the IBOService is a class. When you
instantiate the class in your application, you create a service
*object* that performs one of the services that the class is capable
of performing. Trying to make one instance perform multiple services
is analogous to trying to assign multiple datasets to the same query
object simultaneously: it's a no-can-do.

Then, instantiate one object for each service you want to
request. And make sure you understand the rules for each request,
because different services are subject to varying rules.

To answer the question in your subject: why Sweep and Mend are
incompatible. Well, at the level of a call to gfix, they are
unrelated utility jobs that gfix does. Gfix "knows" what job you want
to do by the switch setting. The -sweep switch is one utility job
(clean up garbage), the -mend switch is a different job (find and
isolate lost row structures).

If you're using the Services API, it's a really good idea to study
the documentation for the command-line utilities and match up the
methods of the service components with the switches that apply to the
tools. Most of the SAPI is just macrotised calls to those utilities
(gfix, gbak, gstat, gsec). (There are a few calls that read the
database header, as well...). The rules that apply to the utility
programs apply whether they are invoked from the command line or
through the proxy interface that the Service Manager provides.

./heLen