Migration dbi files ?

Migration dbi files ?

am 20.09.2006 08:33:36 von xhenke

------=_NextPart_000_0019_01C6DC8F.780DC440
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit



Hi,



Quick question; how to migrate dbi files from one os type (e.g. AIX) to
another (e.g. HP-UX)?



The files (.dat / .dir / .pag) seem to become corrupt after moving them, or
at least can not be read.



Can they maybe be exported in some sort of platform neutral format and then
imported?



Any ideas on this subject will be highly appreciated.



Many thanks in advance.



Regards,



Henrik.




------=_NextPart_000_0019_01C6DC8F.780DC440--

Re: Migration dbi files ?

am 20.09.2006 14:50:21 von hjp

--pfTAc8Cvt8L6I27a
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2006-09-20 08:33:36 +0200, Henrik Nilsson wrote:
> Quick question; how to migrate dbi files from one os type (e.g. AIX) to
> another (e.g. HP-UX)?

What are dbi files? DBI is a generic interface to SQL database systems.
It doesn't read or write any files - that is left to the database.

> The files (.dat / .dir / .pag) seem to become corrupt after moving them, =
or
> at least can not be read.

dir and .pag could be DBM. I don't know about .dat. DBM-Files are
platform specific.

> Can they maybe be exported in some sort of platform neutral format and th=
en
> imported?

Assuming the files are accessed using DBI, your best bet is to write
Scripts which dump the tables into CSV and restore it from there.

hp

--=20
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | hjp@wsr.ac.at | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users

--pfTAc8Cvt8L6I27a
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iQDQAwUBRRE5DVLjemazOuKpAQJMnAXUC040bRSxHAE1hq7y5pIAMpLOcHd2 L1If
/fh96Gb44kaiTuQi2SyHeAYBchXnDQx6WoFLpYwiQepdciKxy7fjhtGZoW3F M8fQ
09Qr2vlvRWZTpuhqcaCPDaSOkZrHw5KH6Ge0QB9L2+JVtyE+Wxl/LPaYnp4o Gplo
GrIBlEtfbOvk2vsa9IfAxbfOJFioZZ52En5YbmOtVJwReqYMhcFpFPB9cGpp eT1V
l+7ZXEjuGaoVg90fzzg8VmGo/g==
=d9Xd
-----END PGP SIGNATURE-----

--pfTAc8Cvt8L6I27a--

Re: Migration dbi files ?

am 20.09.2006 15:02:54 von pdalec

On 9/20/06, Henrik Nilsson wrote:
>
> Quick question; how to migrate dbi files from one os type (e.g. AIX) to
> another (e.g. HP-UX)?
>
[...]
>
> Can they maybe be exported in some sort of platform neutral format and then
> imported?

Well, I know Oracle has 'export' and 'import' program that will work
with the contents of a database in a platform-independent format.
What dB are you using?

--
pDale Campbell
"Anything not worth doing
Is not worth doing well."

RE: Migration dbi files ?

am 20.09.2006 15:10:08 von xhenke

We do indeed use Oracle on both ends. So you mean that by some way putting
this Perl binary hash file in to a table, exporting/importing it, should
solve it...?
Thanks
Henrik.

-----Original Message-----
From: pDale [mailto:pdalec@gmail.com]
Sent: Wednesday, September 20, 2006 3:03 PM
To: dbi-users@perl.org
Subject: Re: Migration dbi files ?

On 9/20/06, Henrik Nilsson wrote:
>
> Quick question; how to migrate dbi files from one os type (e.g. AIX) to
> another (e.g. HP-UX)?
>
[...]
>
> Can they maybe be exported in some sort of platform neutral format and
then
> imported?

Well, I know Oracle has 'export' and 'import' program that will work
with the contents of a database in a platform-independent format.
What dB are you using?

--
pDale Campbell
"Anything not worth doing
Is not worth doing well."

Re: Migration dbi files ?

am 20.09.2006 15:20:54 von pdalec

On 9/20/06, Henrik Nilsson wrote:
>
> We do indeed use Oracle on both ends. So you mean that by some way putting
> this Perl binary hash file in to a table, exporting/importing it, should
> solve it...?

What Perl binary hash file? I was referring to the contents of the
database (tables, procedures, constraints, etc). If you have a binary
object stored in the dB, export/import won't make it portable.

--
pDale Campbell
Eleven plus two = twelve plus onE

RE: Migration dbi files ?

am 20.09.2006 15:27:12 von xhenke

> What Perl binary hash file? I was referring to the contents of the
> database (tables, procedures, constraints, etc). If you have a binary
> object stored in the dB, export/import won't make it portable.

No, this was no Oracle database matter but a Perl hash file (which I think
is in binary format) matter. Sorry, perhaps I didn't make this clear.
So the problem is really, how to make such a file work on another os...?

Re: Migration dbi files ?

am 20.09.2006 15:29:09 von pdalec

On 9/20/06, Henrik Nilsson wrote:
>
> We do indeed use Oracle on both ends. So you mean that by some way putting
> this Perl binary hash file in to a table, exporting/importing it, should
> solve it...?

Are you wanting to make your Perl data portable? How about Storable?
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Sto rable.html

Or Freeze/Thaw?
http://search.cpan.org/~ilyaz/FreezeThaw-0.43/FreezeThaw.pm


So this is NOT a DBI-related query?

--
pDale Campbell

RE: Migration dbi files ?

am 20.09.2006 15:57:41 von Philip.Garrett

Henrik Nilsson wrote:
>> What Perl binary hash file? I was referring to the contents of the
>> database (tables, procedures, constraints, etc). If you have a binary
>> object stored in the dB, export/import won't make it portable.
>
> No, this was no Oracle database matter but a Perl hash file (which I
> think is in binary format) matter. Sorry, perhaps I didn't make this
> clear. So the problem is really, how to make such a file work on
> another os...?

1) If you can get the data you need out of Oracle, use its
exp/imp programs, otherwise:

2) If you're trying to move a small DBM file (one of the AnyDBM_File
derivatives) from one platform to another, follow these steps. By
"small", I mean that it will fit in your system's virtual memory.

A) Open the database with tie() like usual.

# replace "SOME_File" with the right module name.
tie my %database, 'SOME_File', 'filename', ...

B) use Storable's nstore to store a portable binary representation:

# note, you cannot store by reference, you must make a copy.
use Storable qw(nstore);
nstore({%database}, 'filename.bin') || die $!;

C) On the destination system, use Storable's retrieve to load the
data, and put it back into the database.
=20
use Storable qw(retrieve);
$db_data =3D retrieve('filename.bin') || die $!;
%database =3D %$db_data;

3) If you're trying to move a *large* DBM file (larger than will fit in
virtual memory), you'll need to dump it a little at a time. Using a
CSV file is an option:

A) Open the database with tie() like usual.

# replace "SOME_File" with the right module name
tie my %database, 'SOME_File', 'filename', ...

B) Iterate over the name/value pairs (using "each" -- not "keys"), and
store each one in the CSV file.

use Text::CSV_XS;
my $csv =3D Text::CSV_XS->new(); # be sure to read perldoc
while (my ($k,$v) =3D each %database) {
$csv->combine($k,$v)
|| die "can't combine row for key '$k'";
print OUTFILE $csv->string(), "\n";
}

C) On the destination system, read the CSV file and populate the
database file with its contents.

use Text::CSV_XS;
my $csv =3D Text::CSV_XS->new();
while (<>) {
$csv->parse($_) || die "can't parse line $.";
my ($k,$v) =3D $csv->fields;
$database{$k} =3D $v;
}


Regards,
Philip

Re: Migration dbi files ?

am 20.09.2006 16:02:04 von hjp

--U3s59FfKcByyGl+j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2006-09-20 15:27:12 +0200, Henrik Nilsson wrote:
> > What Perl binary hash file? I was referring to the contents of the
> > database (tables, procedures, constraints, etc). If you have a binary
> > object stored in the dB, export/import won't make it portable.
>=20
> No, this was no Oracle database matter but a Perl hash file

By "Perl hash file" you mean a dbm file tied to a Perl hash?=20

If so, how does DBI fit into the picture?=20

hp

--=20
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | hjp@wsr.ac.at | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users

--U3s59FfKcByyGl+j
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iQDQAwUBRRFJ3FLjemazOuKpAQLSqQXUCZplh3VcV2wn7cTZa/2oBdLQeItX 9OJE
kZ3leKA/8+lVfMPhV592YxbHJuSa/4NCTE2QWWhi6VsXZ876Mr+y160tyGiW s7k1
65oPJth7jsxxH985TkxoVRVU+VpPJ7eB6Z3FUe8JyUcZ8n+Adej7ay4tN5PT VZo3
DJLqtMjPU6tLsjCmxhmnE/FuJdYFKGmDLTo4NA/8YNnrQVR1KBIZHwbPn80f 38gi
v7/poa1SMnIIlDcpC9TyTWDoRQ==
=Wf6o
-----END PGP SIGNATURE-----

--U3s59FfKcByyGl+j--

RE: Migration dbi files ?

am 20.09.2006 16:06:57 von xhenke

> By "Perl hash file" you mean a dbm file tied to a Perl hash?
>
> If so, how does DBI fit into the picture?
>
> hp

It doesn't. New to Perl and made a typo (should have been dbm of course).
Sorry all.
Henrik.

RE: Migration dbi files ?

am 20.09.2006 16:07:52 von xhenke

> Are you wanting to make your Perl data portable? How about Storable?
> http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/lib/Sto rable.html
> Or Freeze/Thaw?
> http://search.cpan.org/~ilyaz/FreezeThaw-0.43/FreezeThaw.pm
> So this is NOT a DBI-related query?

No it is not a dbi related query, sorry for the confusion.
I'll have a look at the links you've suggested.
Thanks!