Subject Re: [firebird-support] Firebird Migration from version 1.5 to version 2.1 help please !!!!
Author Helen Borrie
Thursday, February 2, 2017, 3:20:10 AM, d.picciotto wrote:

> I have some Trouble with the Migration of Firebird vers. 1.5 to Firebird vers. 2.1

> First of all I made a Backup of my Database File *.gdb with the function gbak using isql

No, you didn't. Isql is an SQL language support program, not a backup
utility. Gbak is a stand-alone program, not a function. (The same
code can, however, be accessed through Services API calls...but it
doesn't sound as though you were attempting that.) It looks as though
you possibly used isql -x to extract the metadata to a script. That
is not a backup.

> Then I disinstalled the Old Version >> Firebird 1.5 because the
> Files won't be Updated and not Overwritten

You didn't need a full uninstall, as Firebird 2.1 would be written (by
default) to a separate sub-directory under Program Files\Firebird.

What you do need to do is stop the Firebird service, in the Services
applet. Then you would run 'instsvc.exe r' (without the quotes) from
the \bin directory to remove the Firebird 1.5 service.

> Is it enough to disinstall the 1.5 Version from the Control Panel in Windows ?

Probably.

> Then I export The Metadata from *.gdb file as a SQL File using a Tool like IBExpert
> How should I apply this Metadata to Firebird 2.1
> Just by running it on FlameRobin as a query or in isql ?
> Doesn't make any Sense to me
> When I run the script I get following error:
>
> Error: *** IBPP::SQLException ***

> Context: Statement::Prepare(
> /******************************************************************************/

> /* Generated by IBExpert 2017.1.22.1 24/01/2017 16:44:44 */

> /******************************************************************************/

> SET SQL DIALECT 3 )

> Message: isc_dsql_prepare failed
> SQL Message : -104
> Invalid token
> Engine Code : 335544569
> Engine Message :
> Dynamic SQL Error
> SQL error code = -104
> Token unknown - line 5, column 5
> SQL

OK, that error refers to the right-bracket character in the SET SQL
DIALECT statement. A syntax error - it should not be there. The fact
that the metadata script is trying to set the dialect to 3 indicates
that the DATABASE is dialect 3. In order for the script to create the
metadata, it needs to set the CLIENT dialect to 3, to match the
DATABASE dialect. That is what that statement was trying to do. If
you intend to go by this route, it will be necessary to open the
extract script in a text editor and look for things like this.

> Something wrong with the DIALECT 3 should it be DIALECT 1 or DIALECT 2 instead ?

Before you try anything, first find out what you are working with.
Use your preferred tool(s) to get the database header information.
The details you need are: ODS version, database dialect and default
character set.

Using Firebird's command-line tools:
gstat -h path\to\database will return the first two.
isql path\to\database -user sysdba -password masterkey
will return the default character set.

A database created or restored under Firebird 1.5 should have an ODS
of 10.1. When you restore it under v.2.1 it should have an ODS of
11.1.
IBExpert probably has a tab that shows all of this information in one
place.


You do not need to pump the data UNLESS (one or both):
- the database dialect is 1 and you want it to be 3 (apparently not
necessary in this case)
- the default character set is NONE and you know that it is actually
in a directly supported character set. In that case, you would need
to pump the data into an empty database with the desired default
character if you wanted to realise the true charset of the text data.

Otherwise, you need to:

1. Back up the v.1.5 database using the gbak.exe from the V.1.5
distribution. If you no longer have it, you can download the v.1.5.6
zip kit from website and extract the program.

NOTE, you must make this backup using the v.1.5 gbak.exe. You can run
this program under your v.2.1.7 installation. Either (a) temporarily
reanme gbak.exe in your v.2.1.7 installation and copy the v.1.5
version to the \bin directory; or you can run the v.1.5 gbak.exe from
a different location.

2. Restore the backup file using the **v.2.1.7 version*** of gbak.exe.
Regarding the notes above about database dialect, you might run into
some transliteration problems. I won't go into that here; but you
can read up about in the v.2.1.7 release notes. Gbak has some switches
you can use.

> Reading the Documentation i should create an Output File errors.txt
> to see the execution exceptions/errors
> With which Procedure/Function will I bring the errors in that File

I guess you are referring to script execution. It's not clear. But
you can pipe the screen output of isql to a file, as you are
apparently aware. You can do the same with gbak screen output.

> Next I should apply the Database Patch and I immagine it's
> compatible with the Version 2.1 right ?

> Can I find the Patch here ??

I don't know what that means, sorry. I've never heard of a "database
patch" for Firebird.

> 32-bit Debug Kits (Binary + PDB components)December 5,
> 2014Firebird-2.1.7.18553_0_Win32_ pdb.exe11 MBFull Classic or Superserver, installer kit
>
> sourceforge.net/projects/firebird/files/firebird-win32/2.1.7-Release/Firebird-2.1.7.18553_0_Win32_pdb.exe

If that is what you are referring to as a "database patch" then you
have got it wrong. That is a debug version of the same engine, that
provides some "pdb" files for analysis by the engine programmers. It
is used when someone suspects there might be some bug in Firebird.

> But I'm exporting/importing is just the Structure of the Database right ?

You probably don't need to.

> How do I proceed to Export the Data should I use DataPump ? How do I do it ?
That is what people use when they need to pump data. It is not a
Firebird tool and there are several around: find one that has
documentation.

> How do I improve the Execution Performance of the Firebird Database...
> By Putting hands and tricking the export sql File ??

??????

> I really need help on this I'm use to Oracle PL/SQL and can't figure out how it works...

Oracle PL/SQL is a procedural language, equivalent to PSQL in
Firebird. It is not used for constructing/reconstructing data or
metadata. There is no standard for procedural SQL so you will have a
new lexicon to learn.

Database Definition Language (DDL) is used for construction and
reconstruction.
Database Manipulation Language (DML) is used for creating, modifying,
deleting and querying data.

In Firebird, DDL and DML are highly compliant with standards.

HB