OpenEdge 10.2A - Generate database files using only .d1 and an old version of .db files - database

I have a .d1 file and an old version of .db file of the same database.
When I open .d1 file using a text editor, the content of the file is readible so it seems the database can be regenerated.
First, I have used only .d1 file and run the command under proenv:
prostrct builddb c:\db\myDb
the generated .db file only contains:
0020
string and nothing else, where as my standard .db files contains 640 KB data in each one.
I have tried to unlock my database using:
proutil unlock c:\db\myDb -extents
and pressed y for recovery question. And the output is:
** Database has the wrong version number. (db: 0, pro: 150). (44)
When I have put old .db file I have for the same database, and run the same command:
proutil unlock c:\db\myDb -extents
and pressed y for recovery question, the output is:
Database c:\db\myDb uses 32-bit dbkeys. It cannot be unlocked by this codebase. (13888)
Use the 10.1A prostrct utility to unlock this database. (13889)
I haven't seen the 10.1A version more than 10 years now and I'm pretty sure the version of the .d1 file is 10.2A.
If you direct me to the way to recover the database, it would be much appriciated.

If the .d1 file is truly 10.2a and you are using 10.2a to try to open it and the only thing missing is the .db file then you can properly recreate the .db file with:
prostrct builddb dbname
But if you are missing other critical files (such as the .b1 file) this will not work.
If you really only have the .d1 file then you almost certainly do not have enough pieces to work with.

Related

Pervasive SQL(10.3) File size exceeding 2GB resulting in a .^01 file being created

We have a database with a data file exceeding 2Gb, this resulted in a .^01 file being generated with the same file name. We now have a .DAT file and a .^01 with the same name.
I have subsequently deleted the unnecessary data (old history, no longer required) and the .DAT file is now only 372MB, but the .^01 file remains.
I would like to clone the .DAT file and save the data and reload it into the cloned (blank file. I normally use Butil (Clone, Save and Load) but am unsure what I need to do with the .^01 file as the Butil -Save FileName.^01 FileName.seq returns an error as it does not recognise the ^:
BUTIL-14: The file that caused the error is FileName.01.
BUTIL-100: MicroKernel error = 12. The MicroKernel cannot find the specified file.
I would greatly appreciate some direction/input in this regard
Thank you and kind regards,
You don't need to do anything with the .^XX file(s). They are called Extended files and are automatically handled by the PSQL engine. A BUTIL -CLONE / -COPY will read all of the data (original file and extended file(s)) and copy it to the new file.
To rebuild it, you should do something like:
BUTIL -CLONE <NEWFILE.DAT> <OLDFILE.DAT>
BUTIL -COPY <OLDFILE.DAT> <NEWFILE.DAT>
Also, if the file grows above 2GB again, the Extended File (.^01) will come back.

Btrieve file only shows partial data

Almost ready to throw up the white flag but thought I'd throw it out there. I have an OLD program from 1994 that uses a btrieve dB and renders basic membership info for a gym. The btr file that holds the data will open in notepad and I can search and find all records although the formatting is nearly unreadable. When it opens in the program there is a huge chunk of records missing. It seems to stop on specific records up and down when scrolling.
I know almost nothing about btrieve as it predates my IT career by many years and I've honestly never seen it. Any suggestions on where I should troubleshoot or tools that may help would be much appreciated.
This sounds like the file may be corrupted although I would expect errors if it was corrupted. One way to rebuild the file is to use BUTIL (and a couple of OS commands).
The steps to rebuild are:
Make a backup of the original file to another directory.
Rename the original file. I like to use change the extension to .OLD.
Delete the original file. It will be recreated in the next step.
Issue the BUTIL -CLONE command (BUTIL -CLONE
Issue the BUTIL -COPY command (BUTIL -COPY
The rebuild is complete.
I've use the commands below in the past (changing 'filename' and the extensions to match my files).
copy filename.btr someother\location\filename.btr
ren filename.btr filename.old
del filename.btr
butil -clone filename.btr filename.old
butil -copy filename.old filename.btr

SQLite3 using another hard drive for creating index

I have two hard disks: C (40GB capacity left) and D (1TB capacity left).
My sqlite folder (SQLite3 Windows download files from tutorial) is in disk D.
I created a database called myDatabase.db in the sqlite folder and have created a table in it and populated the table from a CSV file. This was done successfully as I ran a few queries and they worked.
The size of the database is quite large (50GB) and I want to create an index for my table. I do the CREATE INDEX command and it starts - it creates a myDatabase.db-journal file in the folder next to the .db file.
However, from "This PC" view of the hard drives I can see that disk C is getting drained (from 40GB, going 39 38 etc incrementally), myDatabase.db in drive D is not getting bigger.
I dont want SQLite to use C when it doesnt make sense for it do it as sqlite and .db file are in disk D.
Any suggestions why this is happening ?
Thanks in advance for your time.

Detecting the database a .DAT file belongs to

I have a set of .DAT files present along side a set of .IDX files with the same name.
The goal is to be able to open these files and read its contents, parsing it into a new format. The problem: I have no idea what database the data is being stored in! The files contain no headers or clues, they are binary, and the resource from which I have received these has no idea as to its storage mechanism.
So the question is: What are some common databases which store databases in .DAT files and store their indexes in .IDX files with the same name? Is there an application I can use in Linux or Windows which can detect the database?
EDIT :-
File names:
price.dat
price.idx
Here is a hex dump of the beginning of the .DAT file:
030D04806420500FFE3E0500002078581001C000738054E0C0099804138100402550080442090082403C101F7406010080C0A010201002010C006FC0246C0403FE00B041C051F0091BFE042F812FE054F8177E066F81BFE078F8207E08AF824FE09CF8297E0AEF82DFE0C0F8327E0D2F836FE0E4F83B7E0F6F83FE5FEFF47C06608480FA91F003C0213101F1BFDFE804220100F500D2A00388430801E04028D4390D128B46804024010A067269FCA546003C0844060E11F084B9E1377850
Here is a hex dump of the beginning of the .IDX file:
030D04805820100FFD7E0000397FEB60050410007300246A3060068220009BE0401030088B3903F740E010C80402410281402030094004C708004DC058880FFC052F015EBFE042F812FE054F8177E066F81BFE078F8207E08AF824FE09CF8297E0AEF82DFE0C0F8327E0D2F836FE0E4F83B7E0F6F83FFE108F8447E11AF848FE12CF84D7E13EF851FE150F8567E162F85AFE174F85F7E186F863FE198F8687E1AAF86CFE1BCF8717E1CEF875FE1E0F87A7E1F2F87EF5FEFF005E30901714
Both files uniquely start out with 030D04806420500FF wonder if this is a good start?
Did a quick search on Google but it didn't return anything...
END EDIT :-
Any other ideas?
Thanks much in advance!
There is a faircom ODBC driver called 'ctreeODBC_RO.exe' which should be capable.

Is it possible to detect file format and encoding of file using batch files?

Is it possible to detect file format and encoding of file using batch files? And if a particular file is not of intended format, throw an error?
As a *nix guy, I'd want to jump for something more powerful than a batch file, such as Python. (or a shell script, but I'm assuming you're using Windows --- you might look into PowerShell, but I've never tried it.)
Unix has a great utility for this sort of thing, it's named file. There appears to be a Windows version here: http://gnuwin32.sourceforge.net/packages/file.htm
Basically, you run file [your filename here] and file spits out a blurb about the file. For example:
$ file zdoom-2.4.1-src.7z
zdoom-2.4.1-src.7z: 7-zip archive data, version 0.3
It's not always right, and it doesn't mean that if file says "this is a JPEG" that the file is actually a JPEG: it could be corrupt, etc.
Also, if I rename the above 7z archive to "foo":
$ file foo
foo: 7-zip archive data, version 0.3
... file will still get it.

Resources