Ingres Community Forums Login Register Ingres.com  

Ingres Community Forum


Go Back   Ingres Community Forums > Ingres Forums > DBA Forum
 

Reply
 
LinkBack Thread Tools Display Modes
Old 2009-07-09   #1 (permalink)
Ingres Community
 
richard.david@aah.co.uk's Avatar
 
Join Date: Mar 2007
Location: Coventry, UK
Posts: 22
Lightbulb Tips for copying an entire Ingres installation from one Unix/Linux host to another

Hi Fellow Ingres DBAs,

Here's a little something for your DBA kit bag.

If, like me, you need the ability to take an entire copy of a production ingres installation (and all its databases), and move it to a an identically built (same filesystem paths etc.), but differently named host for testing, the process can be tricky. Especially if you don't use II_HOSTNAME!

The main thing you will need to do (after copying), is to edit $II_SYSTEM/ingres/files/config.dat and $II_SYSTEM/ingres/files/protect.dat and change all references to hostname.

e.g. ii.livebox.ingstart.*.dbms: 1
ii.livebox.ingstart.*.gcc: 1
etc.

becomes:-

ii.testbox.ingstart.*.dbms: 1
ii.testbox.ingstart.*.gcc: 1
etc.

Here's a really simple shell script to do the job for you:-

Code:
OLD_HOSTNAME="LiveBox"
NEW_HOSTNAME="TestBox"

OLD_HOSTNAME_UPPER=$(echo $OLD_HOSTNAME | tr '[:lower:]' '[:upper:]')
NEW_HOSTNAME_UPPER=$(echo $NEW_HOSTNAME | tr '[:lower:]' '[:upper:]')
OLD_HOSTNAME_LOWER=$(echo $OLD_HOSTNAME | tr '[:upper:]' '[:lower:]')
NEW_HOSTNAME_LOWER=$(echo $NEW_HOSTNAME | tr '[:upper:]' '[:lower:]')

cat $II_SYSTEM/ingres/files/config.dat | \
      sed -e "s/$OLD_HOSTNAME_UPPER/$NEW_HOSTNAME_UPPER/g" \
          -e "s/$OLD_HOSTNAME_LOWER/$NEW_HOSTNAME_LOWER/g" \
      >| /tmp/rename.$$
mv /tmp/rename.$$ $II_SYSTEM/ingres/files/config.dat

cat $II_SYSTEM/ingres/files/protect.dat | \
      sed -e "s/$OLD_HOSTNAME_UPPER/$NEW_HOSTNAME_UPPER/g" \
          -e "s/$OLD_HOSTNAME_LOWER/$NEW_HOSTNAME_LOWER/g" \
      >| /tmp/rename.$$
mv /tmp/rename.$$ $II_SYSTEM/ingres/files/protect.dat


The next thing you will need to do is to check that (or set) the Ingres/NET installation password for the new hostname.

This method should be fine for regular Ingres databases, but a further step is needed for STAR databases as follows:-

Code:
NEW_HOSTNAME="testbox"

sql +Y iidbdb >/tmp/sql.$$ <<!!
update iistar_cdbs
set    cdb_node = '${NEW_HOSTNAME}';
commit;
select 'STAR_DB' as description, 
       name as star_db
from   iidatabase
where  dbservice = 131074;
\g
!!
STAR_DB_LIST=$(grep 'STAR_DB' /tmp/sql.$$ | cut -d'|' -f3)
rm /tmp/sql.$$

for STAR_DB in ${STAR_DB_LIST}
do
    sql ${STAR_DB} +Y <<!!
    update iidd_ddb_ldbids
    set    ldb_node = '${NEW_HOSTNAME}'
    where  ldb_database = '${STAR_DB}'
    \p\g
!!
done


NB The same procedure applies if you use II_HOSTNAME, but where II_HOSTNAME is different on the new host
i.e. II_HOSTNAME=LIVEBOX on the live system and II_HOSTNAME=TESTBOX on the test system.

I hope that this tip proves useful. Please let me know if you sport any mistakes.

= = = = = = = = = = = = = = = = = =

DISCLAIMER
This information is based on personal experience and may not necessarily be supported by Ingres Corporation. All tips shared are intended for information only.

Last edited by richard.david@aah.co.uk; 2009-07-16 at 03:40 AM.
richard.david@aah.co.uk is offline   Reply With Quote
Old 2009-07-09   #2 (permalink)
Ingres Community
 
daryl.monge@ingres.com's Avatar
 
Join Date: Mar 2007
Posts: 68
Default

That is really helpful. I would add in a
cp config.dat config.previous.dat
and
cp protect.dat protect.previous.dat
or some clever variation of it.

Also, I know that there are installations where the host name is the present in other contexts (database name, path names) and the sed strings have no other context like the leading and trailing dots. However to improve it you would have to make sure you processed the "vnode" entries as well as the kerberos domain settings, if appropriate.
daryl.monge@ingres.com is offline   Reply With Quote

Reply


Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© 2009 Ingres Corporation. All Rights Reserved