If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Backing up a database via cron

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-26-03, 05:29
colinbr colinbr is offline
Registered User
 
Join Date: Sep 2003
Posts: 2
Backing up a database via cron

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?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 09-26-03, 08:15
adityanlal adityanlal is offline
Registered User
 
Join Date: Jul 2003
Location: Calcutta, India
Posts: 42
If you want to take the backup while database is in use u have these 3 utilities
1. ontape
2. onarchive
3. on-bar

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.
Reply With Quote
  #3 (permalink)  
Old 09-26-03, 08:51
colinbr colinbr is offline
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks.

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:

-s [-L archive level ] [ -A database_list] [ -B database_list]
[ -N database_list] [ -U database_list]

and for restore:

-r [-D DBspace_list]

i.e. you can only specify a dbspace in the restore, so as I understand it ontape will only dump the COMPLETE system (all dbspaces)!

How do you use ontape to backup only one dbspace?

Also as I need to do the backup to DISK (not tape), is the correct way to do this to set TAPEDEV to a plain filename?

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On