FR [ 1810532 ] DBRestore for postgresql

This commit is contained in:
Carlos Ruiz 2007-10-10 03:42:04 +00:00
parent ad16265417
commit 9aafb79e99
8 changed files with 104 additions and 10 deletions

View File

@ -10,6 +10,7 @@
@pause
@Rem Parameter: <systemAccount> <adempiereID> <adempierePwd>
@call %ADEMPIERE_DB_PATH%\DBRestore system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD%
@Rem globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres (ignored in oracle)
@call %ADEMPIERE_DB_PATH%\DBRestore system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD% %ADEMPIERE_DB_SYSTEM%
@pause

View File

@ -13,4 +13,5 @@ echo Press enter to continue ...
read in
# Parameter: <systemAccount> <adempiereID> <adempierePwd>
sh $ADEMPIERE_DB_PATH/DBRestore.sh system/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD
# globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres(ignored in oracle)
sh $ADEMPIERE_DB_PATH/DBRestore.sh system/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM

View File

@ -10,6 +10,7 @@
@pause
@Rem Parameter: <systemAccount> <AdempiereID> <AdempierePwd>
@call %ADEMPIERE_DB_PATH%\ImportAdempiere system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD%
@Rem globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres (ignored in oracle)
@call %ADEMPIERE_DB_PATH%\ImportAdempiere system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD% %ADEMPIERE_DB_SYSTEM%
@pause

View File

@ -23,4 +23,5 @@ echo Press enter to continue ...
read in
# Parameter: <systemAccount> <AdempiereID> <AdempierePwd>
sh $ADEMPIERE_DB_PATH/ImportAdempiere.sh $SYSUSER/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD
# globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres(ignored in oracle)
sh $ADEMPIERE_DB_PATH/ImportAdempiere.sh $SYSUSER/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM

View File

@ -0,0 +1,46 @@
@Echo Adempiere Database Import $Revision: 1.3 $
@Rem $Id: ImportAdempiere.bat,v 1.3 2005/01/22 21:59:15 jjanke Exp $
@Echo Importing Adempiere DB from %ADEMPIERE_HOME%\data\ExpDat.dmp (%ADEMPIERE_DB_NAME%)
@if (%ADEMPIERE_HOME%) == () goto environment
@if (%ADEMPIERE_DB_NAME%) == () goto environment
@Rem Must have parameters systemAccount AdempiereID AdempierePwd PostgresPwd
@if (%1) == () goto usage
@if (%2) == () goto usage
@if (%3) == () goto usage
@if (%4) == () goto usage
@set PGPASSWORD=%4
@echo -------------------------------------
@echo Re-Create user and database
@echo -------------------------------------
@dropdb -U postgres %ADEMPIERE_DB_NAME%
@dropuser -U postgres %2
@set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3'
@psql -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%"
@set ADEMPIERE_CREATE_ROLE_SQL=
@set PGPASSWORD=%3
@createdb %ADEMPIERE_DB_NAME% -E UNICODE -O %2 -U %2
@echo -------------------------------------
@echo Import Adempiere_pg.dmp
@echo -------------------------------------
@psql -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade"
@psql -d %ADEMPIERE_DB_NAME% -U %2 -f %ADEMPIERE_HOME%/data/ExpDat.dmp
@set PGPASSWORD=
@goto end
:environment
@Echo Please make sure that the enviroment variables are set correctly:
@Echo ADEMPIERE_HOME e.g. D:\Adempiere
@Echo ADEMPIERE_DB_NAME e.g. dev1.adempiere.org
:usage
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd> <postgresPwd>
@echo Example: %0 postgres Adempiere Adempiere postgrespwd
:end

View File

@ -0,0 +1,42 @@
# $Id: ImportAdempiere.sh,v 1.10 2005/12/20 07:12:17 jjanke Exp $
echo Adempiere Database Import $Revision: 1.10 $
echo Importing Adempiere DB from $ADEMPIERE_HOME/data/ExpDat.dmp
if [ $# -le 2 ]
then
echo "Usage: $0 <systemAccount> <AdempiereID> <AdempierePWD> <PostgresPWD>"
echo "Example: $0 postgres adempiere adempiere postgrespwd"
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
export PGPASSWORD=$4
echo -------------------------------------
echo Recreate user and database
echo -------------------------------------
dropdb -U postgres $ADEMPIERE_DB_NAME
dropuser -U postgres $2
ADEMPIERE_CREATE_ROLE_SQL="CREATE ROLE $2 SUPERUSER LOGIN PASSWORD '$3'"
psql -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL"
ADEMPIERE_CREATE_ROLE_SQL=
export PGPASSWORD=$3
createdb $ADEMPIERE_DB_NAME -E UNICODE -O $2 -U $2
echo -------------------------------------
echo Import Adempiere_pg.dmp
echo -------------------------------------
psql -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade"
psql -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/ExpDat.dmp
export PGPASSWORD=

View File

@ -2,7 +2,7 @@
@Rem $Id: ImportAdempiere.bat,v 1.3 2005/01/22 21:59:15 jjanke Exp $
@Echo Importing Adempiere DB from %ADEMPIERE_HOME%\data\Adempiere.dmp (%ADEMPIERE_DB_NAME%)
@Echo Importing Adempiere DB from %ADEMPIERE_HOME%\data\Adempiere_pg.dmp (%ADEMPIERE_DB_NAME%)
@if (%ADEMPIERE_HOME%) == () goto environment
@if (%ADEMPIERE_DB_NAME%) == () goto environment
@ -11,6 +11,7 @@
@if (%2) == () goto usage
@if (%3) == () goto usage
@set PGPASSWORD=%4
@echo -------------------------------------
@echo Re-Create user and database
@echo -------------------------------------
@ -38,7 +39,7 @@
@Echo ADEMPIERE_DB_NAME e.g. dev1.adempiere.org
:usage
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd>
@echo Example: %0 postgres Adempiere Adempiere
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd> <PostgresPwd>
@echo Example: %0 postgres Adempiere Adempiere postgresPwd
:end

View File

@ -1,12 +1,12 @@
# $Id: ImportAdempiere.sh,v 1.10 2005/12/20 07:12:17 jjanke Exp $
echo Adempiere Database Import $Revision: 1.10 $
echo Importing Adempiere DB from $ADEMPIERE_HOME/data/Adempiere.dmp
echo Importing Adempiere DB from $ADEMPIERE_HOME/data/Adempiere_pg.dmp
if [ $# -le 2 ]
then
echo "Usage: $0 <systemAccount> <AdempiereID> <AdempierePWD>"
echo "Example: $0 postgres adempiere adempiere"
echo "Usage: $0 <systemAccount> <AdempiereID> <AdempierePWD> <PostgresPwd>"
echo "Example: $0 postgres adempiere adempiere postgresPwd"
exit 1
fi
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
@ -18,6 +18,7 @@ if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
fi
export PGPASSWORD=$4
echo -------------------------------------
echo Recreate user and database
echo -------------------------------------