core-jgi/utils/postgresql/ImportAdempiere.sh

41 lines
1.3 KiB
Bash
Raw Normal View History

# $Id: ImportAdempiere.sh,v 1.10 2005/12/20 07:12:17 jjanke Exp $
echo Adempiere Database Import $Revision: 1.10 $
2006-11-17 10:14:43 +07:00
echo Importing Adempiere DB from $ADEMPIERE_HOME/data/Adempiere.dmp
if [ $# -le 2 ]
then
echo "Usage: $0 <systemAccount> <AdempiereID> <AdempierePWD>"
echo "Example: $0 system/manager adempiere adempiere"
exit 1
fi
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
then
echo "Please make sure that the environment variables are set correctly:"
echo " ADEMPIERE_HOME e.g. /Adempiere"
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
exit 1
fi
echo -------------------------------------
echo Recreate user and database
2006-11-17 10:14:43 +07:00
echo -------------------------------------
dropdb -U postgres $ADEMPIERE_DB_NAME
dropuser -U postgres $ADEMPIERE_DB_USER
createuser -U postgres -a -d $ADEMPIERE_DB_USER -P
createdb $ADEMPIERE_DB_NAME -E UNICODE -O $ADEMPIERE_DB_USER -U $ADEMPIERE_DB_USER
2006-11-17 10:14:43 +07:00
echo -------------------------------------
echo Import Adempiere_pg.dmp
2006-11-17 10:14:43 +07:00
echo -------------------------------------
psql -d $ADEMPIERE_DB_NAME -U $ADEMPIERE_DB_USER -f $ADEMPIERE_HOME/data/Adempiere_pg.dmp
2006-11-17 10:14:43 +07:00
echo -------------------------------------
echo Create SQLJ
2006-11-17 10:14:43 +07:00
echo -------------------------------------
# $ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/create.sh $ADEMPIERE_DB_USER/$ADEMPIERE_DB_PASSWORD