Informix

 View Only
  • 1.  renaming a chunk file pathname

    Posted Wed March 23, 2022 08:30 PM
    Hello,

    I have a chunk file that I want to move to a different directory.  This is not the online_root file, just a different file that holds a few dbspaces.

    After doing some searching, I found a page on the IBM support site that says this can be achieved during a restore with 'ontape'.

    ontape –r -rename –p old_path -o oldo_ffset -n new_path -o new_offset

    Our DB's are transactionless, our TAPEDEV and LTAPEDEV=/dev/null  (Linux).  So I don't understand what I can restore from, and would prefer not to do a restore.

    Thanks for any advice,
    Gary

    ------------------------------
    Gary McNair
    ------------------------------

    #Informix


  • 2.  RE: renaming a chunk file pathname

    IBM Champion
    Posted Thu March 24, 2022 04:08 AM

    You will have to create backup i.e.
    ontape -s -L 0 -t STDIO > backup.ontape
    Stop instance i.e.
    onmode -ky
    And finaly do restore with chunk rename
    cat backup.ontape | ontape -r -t STDIO  –p old_path -o oldo_ffset -n new_path -o new_offset

    Or you can try sth like this:
    https://www.oninitgroup.com/faq-items/informix-storage-migration-via-mirroring/

    HTH

    Hrvoje



    ------------------------------
    Hrvoje Zokovic
    ------------------------------



  • 3.  RE: renaming a chunk file pathname

    IBM Champion
    Posted Thu March 24, 2022 07:12 AM
    Gary:

    The redirected restore will work, however, there is another option. If you are using v14.10 you can use mirroring to relocate the chunk. Just create the new file empty, add the new file as a mirror of the existing chunk(s) and wait for the sync to complete. Once the mirror chunks are all active you can switch the status of the primary and mirror chunks then drop the original (now mirror) chunks and once that's done you will be able to delete the original chunk file.

    The way to switch chunk roles is an SQL API function:
    execute function sysadmin:task( "modify chunk swap mirror", <chunk number> );

    Example:

    EXECUTE FUNCTION sysadmin:task("add mirror", "newdbs", "/prod1/IFX_CHUNKS/chunk5", 0, "/prod8/IFX_CHUNKS/chunk1", 0);
    select chknum from sysmaster:syschunks where fname = "/prod1/IFX_CHUNKS/chunk5"; EXECUTE FUNCTION sysadmin:task("modify chunk swap_mirror", "12");
    EXECUTE FUNCTION sysadmin:task("stop mirroring","newdbs");

    One caveat: If the dbspace containing a chunk has multiple chunks you have to mirror all chunks in that dbspace. So not practical if the chunk you need to move is one of many in a dbspace.

    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 4.  RE: renaming a chunk file pathname

    IBM Champion
    Posted Thu March 24, 2022 09:19 AM
    I don't believe it's possible without a backup and restore. However, a workaround would be to take down the database, move the file and create a symbolic link at the old path that points to the new path. [It's considered best practice to use symbolic links for all of your chunks for precisely this reason.]

    Tom Girsch

    Lead System Architect
    Auto Europe Group
    tgirsch@autoeurope.com
    Office #207-842-2139


    " If you think there is something more important than a Client ... think again "





  • 5.  RE: renaming a chunk file pathname

    Posted Thu March 24, 2022 11:56 PM
    Many thanks to everyone, great suggestions.  I will give the backup/restore a try.  I am on 12.10 but will keep the mirroring in mind for the future.

    ------------------------------
    Gary McNair
    ------------------------------



  • 6.  RE: renaming a chunk file pathname

    IBM Champion
    Posted Mon April 04, 2022 04:28 PM
    Hi, I can confirm (at least on Unx/Linux systems) that a symbolic link would work, even if you change from a 
    raw device to a cooked file, keeping the path.
    Shut down DB, move the file, create the symbolic link from old location and restart DB (check access rights).

    Ontape would also work, with rename option.
    I would try to perform an external restore with ontape -p -e, followed by the rename option, which might work 
    in place.
    Depending on the size of DB, a backup/restore might produce a too long downtime.
    -> make a L0 backup (just to make sure you are able to recover first)
    -> shutdown DB cleanly with onmode -ukcy
    -> rename your chunk file on OS level
    -> ontape -p -e -rename ......
    DB should be starting, resulting in recovery mode, you need to change mode afterwards to online with onmode -m
    I think I tried something like that a while ago, could be the way with the smallest downtime if mirroring is no option,
    which would possibly work with no downtime, while needing double space temporarily.

    Good luck

    ------------------------------
    Marcus Haarmann
    ------------------------------



  • 7.  RE: renaming a chunk file pathname

    IBM Champion
    Posted Mon April 04, 2022 04:35 PM

    You can do it without an outage if you use informix mirroring.

     

    Add mirror

    Take out the primary

    Link new primary as required

    Sync to mirror

    Drop mirror

     

    Cheers

    Paul