diff --git a/utils/myEnvironmentTemplate.bat b/utils/myEnvironmentTemplate.bat index fe2ddb929f..8bc5bde1d5 100644 --- a/utils/myEnvironmentTemplate.bat +++ b/utils/myEnvironmentTemplate.bat @@ -21,6 +21,7 @@ @SET ADEMPIERE_DB_USER=@ADEMPIERE_DB_USER@ @SET ADEMPIERE_DB_PASSWORD=@ADEMPIERE_DB_PASSWORD@ @SET ADEMPIERE_DB_URL=@ADEMPIERE_DB_URL@ +@SET ADEMPIERE_DB_PORT=@ADEMPIERE_DB_PORT@ @Rem Oracle specifics @SET ADEMPIERE_DB_PATH=@ADEMPIERE_DB_PATH@ diff --git a/utils/myEnvironmentTemplate.sh b/utils/myEnvironmentTemplate.sh index dc3260466f..5c4be4b052 100644 --- a/utils/myEnvironmentTemplate.sh +++ b/utils/myEnvironmentTemplate.sh @@ -31,6 +31,8 @@ ADEMPIERE_DB_PASSWORD=@ADEMPIERE_DB_PASSWORD@ export ADEMPIERE_DB_PASSWORD ADEMPIERE_DB_URL=@ADEMPIERE_DB_URL@ export ADEMPIERE_DB_URL +ADEMPIERE_DB_PORT=@ADEMPIERE_DB_PORT@ +export ADEMPIERE_DB_PORT # Oracle Specifics ... ADEMPIERE_DB_PATH=@ADEMPIERE_DB_PATH@ diff --git a/utils/postgresql/DBExport.bat b/utils/postgresql/DBExport.bat index c60ed30695..a54a355c38 100644 --- a/utils/postgresql/DBExport.bat +++ b/utils/postgresql/DBExport.bat @@ -6,11 +6,13 @@ @if (%ADEMPIERE_HOME%) == () goto environment @if (%ADEMPIERE_DB_NAME%) == () goto environment +@if (%ADEMPIERE_DB_SERVER%) == () goto environment +@if (%ADEMPIERE_DB_PORT%) == () goto environment @Rem Must have parameter: userAccount @if (%1) == () goto usage @set PGPASSWORD=%2 -pg_dump -U %1 %ADEMPIERE_DB_NAME% > %ADEMPIERE_HOME%\data\ExpDat.dmp +pg_dump -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U %1 %ADEMPIERE_DB_NAME% > %ADEMPIERE_HOME%\data\ExpDat.dmp @set PGPASSWORD= @cd %ADEMPIERE_HOME%\Data @@ -21,7 +23,9 @@ pg_dump -U %1 %ADEMPIERE_DB_NAME% > %ADEMPIERE_HOME%\data\ExpDat.dmp :environment @Echo Please make sure that the enviroment variables are set correctly: @Echo ADEMPIERE_HOME e.g. D:\ADEMPIERE2 -@Echo ADEMPIERE_DB_NAME e.g. ADEMPIERE.ADEMPIERE.org +@Echo ADEMPIERE_DB_NAME e.g. adempiere or xe +@Echo ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org +@Echo ADEMPIERE_DB_PORT e.g. 5432 or 1521 :usage @echo Usage: %0 diff --git a/utils/postgresql/DBExport.sh b/utils/postgresql/DBExport.sh index df8d44ae1a..47e03e5bb0 100644 --- a/utils/postgresql/DBExport.sh +++ b/utils/postgresql/DBExport.sh @@ -10,17 +10,21 @@ if [ $# -eq 0 ] echo "Example: $0 adempiere adempiere" exit 1 fi -if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ] +if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ] 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" + echo " ADEMPIERE_DB_NAME e.g. adempiere or xe" + echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org" + echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521" exit 1 fi -export PGPASSWORD=$2 -pg_dump --no-owner -U $1 $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/ExpDat.dmp -export PGPASSWORD= +PGPASSWORD=$2 +export PGPASSWORD +pg_dump -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT --no-owner -U $1 $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/ExpDat.dmp +PGPASSWORD= +export PGPASSWORD cd $ADEMPIERE_HOME/data jar cvfM ExpDat.jar ExpDat.dmp diff --git a/utils/postgresql/DBRestore.bat b/utils/postgresql/DBRestore.bat index 35e86807bc..6d8f81be20 100644 --- a/utils/postgresql/DBRestore.bat +++ b/utils/postgresql/DBRestore.bat @@ -6,6 +6,8 @@ @if (%ADEMPIERE_HOME%) == () goto environment @if (%ADEMPIERE_DB_NAME%) == () goto environment +@if (%ADEMPIERE_DB_SERVER%) == () goto environment +@if (%ADEMPIERE_DB_PORT%) == () goto environment @Rem Must have parameters systemAccount AdempiereID AdempierePwd PostgresPwd @if (%1) == () goto usage @if (%2) == () goto usage @@ -16,28 +18,30 @@ @echo ------------------------------------- @echo Re-Create user and database @echo ------------------------------------- -@dropdb -U postgres %ADEMPIERE_DB_NAME% -@dropuser -U postgres %2 +@dropdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %ADEMPIERE_DB_NAME% +@dropuser -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %2 @set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3' -@psql -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%" +@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%" @set ADEMPIERE_CREATE_ROLE_SQL= @set PGPASSWORD=%3 -@createdb -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME% +@createdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME% @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 +@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade" +@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -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 +@Echo ADEMPIERE_HOME e.g. D:\ADEMPIERE2 +@Echo ADEMPIERE_DB_NAME e.g. adempiere or xe +@Echo ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org +@Echo ADEMPIERE_DB_PORT e.g. 5432 or 1521 :usage @echo Usage: %0 diff --git a/utils/postgresql/DBRestore.sh b/utils/postgresql/DBRestore.sh index 0b0ef2e643..ece23523e4 100644 --- a/utils/postgresql/DBRestore.sh +++ b/utils/postgresql/DBRestore.sh @@ -9,34 +9,39 @@ if [ $# -le 2 ] echo "Example: $0 postgres adempiere adempiere postgrespwd" exit 1 fi -if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ] +if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ] 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" + echo " ADEMPIERE_DB_NAME e.g. adempiere or xe" + echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org" + echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521" exit 1 fi -export PGPASSWORD=$4 +PGPASSWORD=$4 +export PGPASSWORD echo ------------------------------------- echo Recreate user and database echo ------------------------------------- -dropdb -U postgres $ADEMPIERE_DB_NAME +dropdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $ADEMPIERE_DB_NAME -dropuser -U postgres $2 +dropuser -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $2 ADEMPIERE_CREATE_ROLE_SQL="CREATE ROLE $2 SUPERUSER LOGIN PASSWORD '$3'" -psql -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL" +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL" ADEMPIERE_CREATE_ROLE_SQL= -export PGPASSWORD=$3 -createdb -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME +PGPASSWORD=$3 +export PGPASSWORD +createdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME 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 +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade" +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/ExpDat.dmp -export PGPASSWORD= +PGPASSWORD= +export PGPASSWORD diff --git a/utils/postgresql/ExportReference.sh b/utils/postgresql/ExportReference.sh index a8b2fe1dc0..8235e751ea 100644 --- a/utils/postgresql/ExportReference.sh +++ b/utils/postgresql/ExportReference.sh @@ -4,17 +4,21 @@ echo Adempiere PostgreSQL Database Export $Revision: 1.3 $ echo Saving database reference@$ADEMPIERE_DB_NAME to $ADEMPIERE_HOME/data/Adempiere_pg.dmp -if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ] +if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ] 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" + echo " ADEMPIERE_DB_NAME e.g. adempiere or xe" + echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org" + echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521" exit 1 fi -export PGPASSWORD=reference -pg_dump --no-owner -U reference $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/Adempiere_pg.dmp -export PGPASSWORD= +PGPASSWORD=reference +export PGPASSWORD +pg_dump -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT --no-owner -U reference $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/Adempiere_pg.dmp +PGPASSWORD= +export PGPASSWORD cd $ADEMPIERE_HOME/data jar cvfM Adempiere_pg.jar Adempiere_pg.dmp diff --git a/utils/postgresql/ImportAdempiere.bat b/utils/postgresql/ImportAdempiere.bat index 817eb214f6..261b5acbab 100644 --- a/utils/postgresql/ImportAdempiere.bat +++ b/utils/postgresql/ImportAdempiere.bat @@ -6,6 +6,8 @@ @if (%ADEMPIERE_HOME%) == () goto environment @if (%ADEMPIERE_DB_NAME%) == () goto environment +@if (%ADEMPIERE_DB_SERVER%) == () goto environment +@if (%ADEMPIERE_DB_PORT%) == () goto environment @Rem Must have parameters systemAccount AdempiereID AdempierePwd @if (%1) == () goto usage @if (%2) == () goto usage @@ -15,22 +17,22 @@ @echo ------------------------------------- @echo Re-Create user and database @echo ------------------------------------- -@dropdb -U postgres %ADEMPIERE_DB_NAME% -@dropuser -U postgres %2 +@dropdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %ADEMPIERE_DB_NAME% +@dropuser -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %2 @set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3' -@psql -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%" +@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%" @set ADEMPIERE_CREATE_ROLE_SQL= @set PGPASSWORD=%3 -@createdb -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME% +@createdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME% @echo ------------------------------------- @echo Import Adempiere_pg.dmp @echo ------------------------------------- @set ADEMPIERE_ALTER_ROLE_SQL=ALTER ROLE %2 SET search_path TO adempiere, sqlj, pg_catalog -@psql -d %ADEMPIERE_DB_NAME% -U %2 -c "%ADEMPIERE_ALTER_ROLE_SQL%" -@psql -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade" -@psql -d %ADEMPIERE_DB_NAME% -U %2 -f %ADEMPIERE_HOME%/data/Adempiere_pg.dmp +@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -c "%ADEMPIERE_ALTER_ROLE_SQL%" +@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade" +@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -f %ADEMPIERE_HOME%/data/Adempiere_pg.dmp @set ADEMPIERE_ALTER_ROLE_SQL= @@ -39,8 +41,10 @@ :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 +@Echo ADEMPIERE_HOME e.g. D:\ADEMPIERE2 +@Echo ADEMPIERE_DB_NAME e.g. adempiere or xe +@Echo ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org +@Echo ADEMPIERE_DB_PORT e.g. 5432 or 1521 :usage @echo Usage: %0 diff --git a/utils/postgresql/ImportAdempiere.sh b/utils/postgresql/ImportAdempiere.sh index 4c1c4596eb..201487a5f4 100644 --- a/utils/postgresql/ImportAdempiere.sh +++ b/utils/postgresql/ImportAdempiere.sh @@ -9,36 +9,40 @@ if [ $# -le 2 ] echo "Example: $0 postgres adempiere adempiere postgresPwd" exit 1 fi -if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ] +if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ] 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" + echo " ADEMPIERE_DB_NAME e.g. adempiere or xe" + echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org" + echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521" exit 1 fi - -export PGPASSWORD=$4 +PGPASSWORD=$4 +export PGPASSWORD echo ------------------------------------- echo Recreate user and database echo ------------------------------------- -dropdb -U postgres $ADEMPIERE_DB_NAME +dropdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $ADEMPIERE_DB_NAME -dropuser -U postgres $2 +dropuser -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $2 ADEMPIERE_CREATE_ROLE_SQL="CREATE ROLE $2 SUPERUSER LOGIN PASSWORD '$3'" -psql -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL" +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL" ADEMPIERE_CREATE_ROLE_SQL= -export PGPASSWORD=$3 -createdb -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME +PGPASSWORD=$3 +export PGPASSWORD +createdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME echo ------------------------------------- echo Import Adempiere_pg.dmp echo ------------------------------------- ADEMPIERE_ALTER_ROLE_SQL="ALTER ROLE $2 SET search_path TO adempiere, sqlj, pg_catalog" -psql -d $ADEMPIERE_DB_NAME -U $2 -c "$ADEMPIERE_ALTER_ROLE_SQL" -psql -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade" -psql -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/Adempiere_pg.dmp +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -c "$ADEMPIERE_ALTER_ROLE_SQL" +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade" +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/Adempiere_pg.dmp ADEMPIERE_ALTER_ROLE_SQL= -export PGPASSWORD= +PGPASSWORD= +export PGPASSWORD diff --git a/utils/postgresql/PostMigration.sh b/utils/postgresql/PostMigration.sh index db4b0c058b..3d008b5c49 100644 --- a/utils/postgresql/PostMigration.sh +++ b/utils/postgresql/PostMigration.sh @@ -7,17 +7,21 @@ if [ $# -le 2 ] echo "Example: $0 postgres adempiere adempiere postgresPwd" exit 1 fi -if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ] +if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ] 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" + echo " ADEMPIERE_DB_NAME e.g. adempiere or xe" + echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org" + echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521" exit 1 fi -export PGPASSWORD=$3 +PGPASSWORD=$3 +export PGPASSWORD echo ------------------------------------- echo Add missing translations echo ------------------------------------- -psql -d $ADEMPIERE_DB_NAME -U $2 -f 01_add_missing_translations.sql -export PGPASSWORD= +psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f 01_add_missing_translations.sql +PGPASSWORD= +export PGPASSWORD