Implement issue #2 Implement support for Oracle 11G

http://hg.idempiere.com/idempiere/issue/2/implement-support-for-oracle-11g
- upgrade ojdbc6.jar to 11.2.0.2.0
- create scripts to export and import with datapump
This commit is contained in:
Carlos Ruiz 2011-04-22 20:31:43 -05:00
parent e55cf6df11
commit bb21fb8279
14 changed files with 362 additions and 3 deletions

View File

@ -0,0 +1,18 @@
SET ECHO ON
/*************************************************************************
* The contents of this file are subject to the Adempiere License. You may
* obtain a copy of the License at http://www.adempiere.org/license.html
* Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for details. Code: Adempiere ERP+CRM
* Copyright (C) 1999-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved.
*************************************************************************
* $Id: CreateUser.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $
***
* Title: Create or replace directory for data pump
* Description:
* Parameter: Directory
* Run as system
************************************************************************/
CREATE OR REPLACE DIRECTORY ADEMPIERE_DATA_PUMP_DIR AS '&1'
/
EXIT

View File

@ -0,0 +1,18 @@
SET ECHO ON
/*************************************************************************
* The contents of this file are subject to the Adempiere License. You may
* obtain a copy of the License at http://www.adempiere.org/license.html
* Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for details. Code: Adempiere ERP+CRM
* Copyright (C) 1999-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved.
*************************************************************************
* $Id: CreateUser.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $
***
* Title: Create or replace directory for data pump
* Description:
* Parameter: Directory
* Run as system
************************************************************************/
CREATE OR REPLACE DIRECTORY ADEMPIERE_DATA_PUMP_DIR AS '&1'
/
EXIT

View File

@ -12,7 +12,7 @@ echo Export Adempiere Database - $ADEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
# Parameter: <adempiereDBuser>/<adempiereDBpassword>
sh $ADEMPIERE_DB_PATH/DBExport.sh $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD
# sh $ADEMPIERE_DB_PATH/DBExportFull system $ADEMPIERE_DB_SYSTEM
# sh $ADEMPIERE_DB_PATH/DBExportFull.sh system/$ADEMPIERE_DB_SYSTEM
if [ $ADEMPIERE_HOME ]; then
cd $ADEMPIERE_HOME/utils

View File

@ -0,0 +1,21 @@
#!/bin/sh
# Author + Copyright 1999-2005 Jorg Janke
# $Id: RUN_DBExport.sh,v 1.10 2005/05/31 18:45:33 jjanke Exp $
if [ $ADEMPIERE_HOME ]; then
cd $ADEMPIERE_HOME/utils
fi
. ./myEnvironment.sh Server
echo Export Adempiere Database - $ADEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
# Parameter: <adempiereDBuser>/<adempiereDBpassword>
sh $ADEMPIERE_DB_PATH/DBExportdp.sh $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD system/$ADEMPIERE_DB_SYSTEM
# sh $ADEMPIERE_DB_PATH/DBExportFulldp.sh system/$ADEMPIERE_DB_SYSTEM
if [ $ADEMPIERE_HOME ]; then
cd $ADEMPIERE_HOME/utils
fi
sh myDBcopy.sh

View File

@ -0,0 +1,21 @@
#!/bin/sh
# $Id: RUN_DBRestore.sh,v 1.9 2005/01/22 21:59:15 jjanke Exp $
if [ $ADEMPIERE_HOME ]; then
cd $ADEMPIERE_HOME/utils
fi
. ./myEnvironment.sh Server
echo Restore Adempiere Database from Export- $ADEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
echo Re-Create Adempiere User and import $ADEMPIERE_HOME/data/ExpDat.dmp
echo == The import will show warnings. This is OK ==
ls -lsa $ADEMPIERE_HOME/data/ExpDat.dmp
echo Press enter to continue ...
read in
# Parameter: <systemAccount> <adempiereID> <adempierePwd>
# globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres(ignored in oracle)
$ADEMPIERE_DB_PATH/DBRestore.sh system/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM
$ADEMPIERE_HOME/utils/RUN_SignDatabaseBuild.sh

View File

@ -0,0 +1,34 @@
#!/bin/sh
echo Adempiere Full Database Export $Revision: 1.3 $
# $Id: DBExportFull.sh,v 1.3 2005/01/22 21:59:15 jjanke Exp $
echo Saving database $1@$ADEMPIERE_DB_NAME to $ADEMPIERE_HOME/data/ExpDatFull.dmp
if [ $# -eq 0 ]
then
echo "Usage: $0 <systemAccount>"
echo "Example: $0 system/manager"
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 Re-Create DataPump directory
echo -------------------------------------
sqlplus $1@$ADEMPIERE_DB_SERVER/$ADEMPIERE_DB_NAME @$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/CreateDataPumpDir.sql $ADEMPIERE_HOME/data
chgrp dba $ADEMPIERE_HOME/data
chmod 770 $ADEMPIERE_HOME/data
expdp $1@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME DIRECTORY=ADEMPIERE_DATA_PUMP_DIR DUMPFILE=ExpDatFull.dmp LOGFILE=ExpDatFull.log EXCLUDE=STATISTICS FULL=Y
cd $ADEMPIERE_HOME/data
jar cvfM ExpDatFull.jar ExpDatFull.dmp ExpDatFull.log

View File

@ -0,0 +1,37 @@
#!/bin/sh
echo Adempiere Database Export $Revision: 1.5 $
# $Id: DBExport.sh,v 1.5 2005/12/20 07:12:17 jjanke Exp $
echo Saving database $1@$ADEMPIERE_DB_NAME to $ADEMPIERE_HOME/data/ExpDat.dmp
if [ $# -eq 0 ]
then
echo "Usage: $0 <userAccount>"
echo "Example: $0 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
# Cleanup
sqlplus $1/$2@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME @$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/Daily.sql
echo -------------------------------------
echo Re-Create DataPump directory
echo -------------------------------------
sqlplus $3@$ADEMPIERE_DB_SERVER/$ADEMPIERE_DB_NAME @$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/CreateDataPumpDir.sql $ADEMPIERE_HOME/data
chgrp dba $ADEMPIERE_HOME/data
chmod 770 $ADEMPIERE_HOME/data
# Export
expdp $1/$2@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME DIRECTORY=ADEMPIERE_DATA_PUMP_DIR DUMPFILE=ExpDat.dmp LOGFILE=ExpDat.log EXCLUDE=STATISTICS SCHEMAS=$1
cd $ADEMPIERE_HOME/data
jar cvfM ExpDat.jar ExpDat.dmp ExpDat.log

View File

@ -0,0 +1,49 @@
#!/bin/sh
# $Id: DBRestore.sh,v 1.8 2005/12/20 07:12:17 jjanke Exp $
echo Adempiere Database Restore $Revision: 1.8 $
echo Restoring Adempiere DB from $ADEMPIERE_HOME/data/ExpDat.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 Re-Create DB user
echo -------------------------------------
sqlplus $1@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME @$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/CreateUser.sql $2 $3
echo -------------------------------------
echo Re-Create DataPump directory
echo -------------------------------------
sqlplus $1@$ADEMPIERE_DB_SERVER/$ADEMPIERE_DB_NAME @$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/CreateDataPumpDir.sql $ADEMPIERE_HOME/data
chgrp dba $ADEMPIERE_HOME/data
chmod 770 $ADEMPIERE_HOME/data
echo -------------------------------------
echo Import ExpDat
echo -------------------------------------
impdp $1@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME DIRECTORY=ADEMPIERE_DATA_PUMP_DIR DUMPFILE=ExpDat.dmp SCHEMAS=$2
echo -------------------------------------
echo Create SQLJ
echo -------------------------------------
$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/create.sh $ADEMPIERE_DB_USER/$ADEMPIERE_DB_PASSWORD
echo -------------------------------------
echo Check System
echo Import may show some warnings. This is OK as long as the following does not show errors
echo -------------------------------------
sqlplus $2/$3@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME @$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/AfterImport.sql

View File

@ -6,7 +6,7 @@
@Rem Parameter: <adempiereDBuser>/<adempiereDBpassword>
@call %ADEMPIERE_DB_PATH%\DBExport %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD%
@Rem call %ADEMPIERE_DB_PATH%\DBExportFull system %ADEMPIERE_DB_SYSTEM%
@Rem call %ADEMPIERE_DB_PATH%\DBExportFull system/%ADEMPIERE_DB_SYSTEM%
@Echo If the following statement fails, fix your environment
IF (%ADEMPIERE_HOME%) == () (CALL myDBcopy.bat) else (CALL %ADEMPIERE_HOME%\utils\myDBcopy.bat)

View File

@ -0,0 +1,15 @@
@if (%ADEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %ADEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Export Adempiere Database - %ADEMPIERE_HOME% (%ADEMPIERE_DB_NAME%)
@Rem
@Rem $Id: RUN_DBExport.bat,v 1.16 2005/04/27 17:45:02 jjanke Exp $
@Rem
@Rem Parameter: <adempiereDBuser>/<adempiereDBpassword>
@call %ADEMPIERE_DB_PATH%\DBExportdp %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD% system/%ADEMPIERE_DB_SYSTEM%
@Rem call %ADEMPIERE_DB_PATH%\DBExportFulldp system/%ADEMPIERE_DB_SYSTEM%
@Echo If the following statement fails, fix your environment
IF (%ADEMPIERE_HOME%) == () (CALL myDBcopy.bat) else (CALL %ADEMPIERE_HOME%\utils\myDBcopy.bat)
@Rem Sleep 60
@CHOICE /C YN /T 60 /D N > NUL

View File

@ -0,0 +1,18 @@
@Rem $Id: RUN_DBRestore.bat,v 1.13 2005/01/22 21:59:15 jjanke Exp $
@if (%ADEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %ADEMPIERE_HOME%\utils\myEnvironment.bat Server)
@Title Restore Adempiere Database from Export - %ADEMPIERE_HOME% (%ADEMPIERE_DB_NAME%)
@echo Re-Create Adempiere User and import %ADEMPIERE_HOME%\data\ExpDat.dmp
@dir %ADEMPIERE_HOME%\data\ExpDat.dmp
@echo == The import will show warnings. This is OK ==
@pause
@Rem Parameter: <systemAccount> <adempiereID> <adempierePwd>
@Rem globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres (ignored in oracle)
@call %ADEMPIERE_DB_PATH%\DBRestoredp system/%ADEMPIERE_DB_SYSTEM% %ADEMPIERE_DB_USER% %ADEMPIERE_DB_PASSWORD% %ADEMPIERE_DB_SYSTEM%
@Call %ADEMPIERE_HOME%\utils\RUN_SignDatabaseBuild.bat > NUL 2>&1
@pause

View File

@ -0,0 +1,35 @@
@Echo Adempiere Full Database Export $Revision: 1.6 $
@Rem $Id: DBExportFull.bat,v 1.6 2005/04/27 17:45:01 jjanke Exp $
@Echo Saving database %1@%ADEMPIERE_DB_NAME% to %ADEMPIERE_HOME%\data\ExpDatFull.dmp
@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: systemAccount
@if (%1) == () goto usage
@echo -------------------------------------
@echo Re-Create DataPump Directory
@echo -------------------------------------
@sqlplus %1@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% @%ADEMPIERE_HOME%\utils\%ADEMPIERE_DB_PATH%\CreateDataPumpDir.sql %ADEMPIERE_HOME%\data
@expdp %1@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% DIRECTORY=ADEMPIERE_DATA_PUMP_DIR DUMPFILE=ExpDatFull.dmp LOGFILE=ExpDatFull.log EXCLUDE=STATISTICS FULL=Y
@cd %ADEMPIERE_HOME%\data
@jar cvfM data\ExpDatFull.jar ExpDatFull.dmp ExpDatFull.log
@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>
@echo Examples: %0 system/manager
:end

View File

@ -0,0 +1,40 @@
@Echo Adempiere Database Export $Revision: 1.8 $
@Rem $Id: DBExport.bat,v 1.8 2005/04/27 17:45:01 jjanke Exp $
@Rem
@Echo Saving database %1@%ADEMPIERE_DB_NAME% to %ADEMPIERE_HOME%\data\ExpDat.dmp
@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
@Rem Cleanup
@sqlplus %1/%2@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% @%ADEMPIERE_HOME%\utils\%ADEMPIERE_DB_PATH%\Daily.sql
@echo -------------------------------------
@echo Re-Create DataPump Directory
@echo -------------------------------------
@sqlplus %3@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% @%ADEMPIERE_HOME%\utils\%ADEMPIERE_DB_PATH%\CreateDataPumpDir.sql %ADEMPIERE_HOME%\data
@Rem The Export
@expdp %1/%2@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% DIRECTORY=ADEMPIERE_DATA_PUMP_DIR DUMPFILE=ExpDat.dmp LOGFILE=ExpDat.log EXCLUDE=STATISTICS SCHEMAS=%1
@cd %ADEMPIERE_HOME%\Data
@copy ExpDat.jar ExpDatOld.jar
@jar cvfM ExpDat.jar ExpDat.dmp ExpDat.log
@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. adempiere.adempiere.org
:usage
@echo Usage: %0 <userAccount>
@echo Examples: %0 adempiere adempiere
:end

View File

@ -0,0 +1,53 @@
@Echo Adempiere Database Restore $Revision: 1.6 $
@Rem $Id: DBRestore.bat,v 1.6 2005/08/27 02:27:10 jjanke Exp $
@Echo Restoring Adempiere DB from %ADEMPIERE_HOME%\data\ExpDat.dmp
@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: systemAccount adempiereID AdempierePwd
@if (%1) == () goto usage
@if (%2) == () goto usage
@if (%3) == () goto usage
@echo -------------------------------------
@echo Re-Create DB user
@echo -------------------------------------
@sqlplus %1@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% @%ADEMPIERE_HOME%\utils\%ADEMPIERE_DB_PATH%\CreateUser.sql %2 %3
@echo -------------------------------------
@echo Re-Create DataPump Directory
@echo -------------------------------------
@sqlplus %1@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% @%ADEMPIERE_HOME%\utils\%ADEMPIERE_DB_PATH%\CreateDataPumpDir.sql %ADEMPIERE_HOME%\data
@echo -------------------------------------
@echo Import ExpDat
@echo -------------------------------------
@impdp %1@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% DIRECTORY=ADEMPIERE_DATA_PUMP_DIR DUMPFILE=ExpDat.dmp SCHEMAS=%2
@echo -------------------------------------
@echo Create SQLJ
@echo -------------------------------------
@call %ADEMPIERE_HOME%\Utils\%ADEMPIERE_DB_PATH%\create %ADEMPIERE_DB_USER%/%ADEMPIERE_DB_PASSWORD%
@echo -------------------------------------
@echo Check System
@echo Import may show some warnings. This is OK as long as the following does not show errors
@echo -------------------------------------
@sqlplus %2/%3@%ADEMPIERE_DB_SERVER%:%ADEMPIERE_DB_PORT%/%ADEMPIERE_DB_NAME% @%ADEMPIERE_HOME%\utils\%ADEMPIERE_DB_PATH%\AfterImport.sql
@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>
@echo Example: %0% system/manager adempiere adempiere
:end