I need to take a dump/backup of a database to a file (not tape) overnight via a cron job.
Being very much an informix newbie, my first thought was to use the dbexport command, but it looks like this fails if the database is open by another process. (Presumably this would still be the case even when there are no records actually being read or written to the database.)
I have found that there is a "onbar" command but as far as I can tell it will only archive database spaces. In my case, the database I want to dump is in the same space as another database which I do NOT want to dump.
Is there a way of dumping a database (not a complete space) to a file via a cron job, while the database is in use?
If you want to take the backup while database is in use u have these 3 utilities
But all these utilities are meant for taking backup of a single/multiple dbspaces and not for a specific database (when 2 or more database are residing in the same dbspace, it will backup all the database).
If you want to take the backup of a single database then u can use data-movement utilities i.e. dbexport. This utility places a exclusive lock on database being backedup. And while doing so if some logged into database (means a shared lock on database) even when he is not doing any inserts/update/deletes etc the utility will fail.
The only 2 options u are left out
(1) Make ur own set of command using "unload" utility. This will backup all the records from the given table. But from this utility it is not possible to take the schema of the database. Which u can take using "dbschema" utility.
(2) The second option is, through cron shutdown(immediate) the database and restart and then run ur utility having dbexport syntax. The problem with this solution is when u shutdown informix (immediate) then all the on-going sessions will be disconnected within 10seconds and any on-going transaction will be lost.
Now its upto you to decide which option for u want to go.
I have had a quick look at on-bar but it looks a lot more complicated than ontape, which seems the best option.
So, if we could move our database into its own space this might help, but it looks like ontape will only backup a complete system (all dbspaces) although it will resotore specified dbspaces ... the usage says
for ontape backup: