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.