DevOps Cloud (ADM)
Cybersecurity
IT Operations Management
service jboss_init stop
su novlua /opt/novell/idm/mysql/stop-mysql.sh root your_db_admin_password
cd /opt/novell
mv idm idm_mysql
cp /etc/init.d/jboss_init /opt/novell/idm_mysql
/dvd_media_path/products/RBPM/JBossPostgreSQL.bin
cd /dvd_media_path/products/RBPM/user_app_install
(it is better to launch the installer from this dir, otherwise you will have to specify the .war location later on)/opt/novell/idm/jre/bin/java -jar IdmUserApp.jar
cp /opt/novell/idm{_mysql,}/master-key.txt
cat /opt/novell/idm/master-key.txt
and copy the value into the installer input fieldservice jboss_init start
service jboss_init stop
cp -a /opt/novell/idm{_mysql,}/mysql
(alternatively you can just move it instead of copying it, but then the idm_mysql directory wouldn't be a valid backup anymore)su novlua /opt/novell/idm/mysql/start-mysql.sh
su novlua /opt/novell/idm/mysql/stop-mysql.sh root your_db_admin_password
cp -b /opt/novell/idm{_mysql,}/jboss/server/IDM/deploy/IDM.war
cp -b /opt/novell/idm{_mysql,}/jboss/server/IDM/conf/sys-configuration-xmldata.xml
cp -b /opt/novell/idm{_mysql,}/jre/lib/security/cacerts
cd /tmp
unzip -o /opt/novell/idm/jboss/server/IDM/deploy/IDM.war~ WEB-INF/classes/hibernate.cfg.xml
zip -u /opt/novell/idm/jboss/server/IDM/deploy/IDM.war WEB-INF/classes/hibernate.cfg.xml
clear-checksums.sh
update-context.sh
diff {/etc/init.d,/opt/novell/idm_mysql}/jboss_init
service jboss_init start
#!/bin/bash
passwd=your_db_admin_password
MSQLdump=/tmp/msql.sql
PSQLdump=/tmp/psql.sql
export PGPASSWORD="$passwd"
key_tables=(AFMODEL AFPROCESS PORTALPRODUCERS PORTALREGISTRY DSS_CONFIG DSS_BROWSER_TYPE DSS_APPLET_CFG SECURITYACCESSRIGHTS SEC_DELPROXY_CFG)
all_tables=$(/opt/novell/idm/mysql/bin/mysql --defaults-file=/opt/novell/idm/mysql/my.cnf -u root --password="$passwd" -B -D idmuserappdb -e "show tables" | tail -n 2 | grep -ve ^DATABASECHANGELOG)
# dump data from mysql
/opt/novell/idm/mysql/bin/mysqldump --defaults-extra-file=/opt/novell/idm/mysql/my.cnf --compatible=postgresql --default-character-set=utf8 --no-create-db --no-create-info --compact --skip-quote-names --complete-insert --hex-blob -r $MSQLdump -u root --password="$passwd" idmuserappdb
# this is to get escapes in mysql strings to be accepted by psql
echo "SET standard_conforming_strings = off; SET escape_string_warning = off;" > $PSQLdump
# this is to have 0/1 in mysql tinyint to be accepted by psql as booleans
echo "update pg_cast set castcontext='a' where casttarget = 'boolean'::regtype;" >> $PSQLdump
# clear data
# first clear non key tables
(
for t in $all_tables
do
(echo "${key_tables[@]}"|grep -q -w $t) || echo $t
done
# then clear key_tables in reverse order
for ((i=${#key_tables[@]}-1; i >=0; i--))
do
echo ${key_tables[$i]}
done
) | while read t
do
echo "DELETE FROM $t;";
done >> $PSQLdump
# insert data
# first insert into key tables
(
for t in "${key_tables[@]}"
do
echo $t
done
for t in $all_tables
do
(echo "${key_tables[@]}"|grep -q -w $t) || echo $t
done
) | while read t
do
if $t = "JBM_MSG"
then
# this table has blobs, convert them via decode function
grep "^INSERT INTO $t " $MSQLdump | sed "s/\(,\|(\)0x\([0-9A-F]*\)/\1decode('\2','hex')/g" >> $PSQLdump
else
grep "^INSERT INTO $t " $MSQLdump >> $PSQLdump
fi
done
# revert the pg_cast change
echo "update pg_cast set castcontext='e' where casttarget = 'boolean'::regtype;" >> $PSQLdump
/opt/novell/idm/Postgres/bin/psql -U postgres -f $PSQLdump idmuserappdb