help: cleanup the ofbiz database

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

help: cleanup the ofbiz database

Francis ANDRE
Hi

I am wondering how to make a full cleanup/erase of all datas in the database in
order to reload only seed and seed-initial??? Any idea other than drop the
database and reinstall??

TIA


Reply | Threaded
Open this post in threaded view
|

Re: help: cleanup the ofbiz database

dhiraj.g
HI Francls,
Please follow the these commands

First make sure the internal  database is empty:
linux:  ./ant clean-all
windows: ant.bat clean-all
Then create the tables and load the seed data which is required for the functioning of the system and execute the following command in the ofbiz home directory:
linux:  ./ant run-install-extseed
windows: ant.bat run-install-extseed
…..this can run for a while.......
Then run the next command to create the admin user :
linux:  ./ant create-admin-user-login
windows: ant.bat create-admin-user-login


Thanks
Dhiraj Gupta
Dhiraj Gupta
Reply | Threaded
Open this post in threaded view
|

Re: help: cleanup the ofbiz database

dhiraj.g
In reply to this post by Francis ANDRE
HI Francls,
Please follow the these commands

First make sure the internal  database is empty:
linux:  ./ant clean-all
windows: ant.bat clean-all
Then create the tables and load the seed data which is required for the functioning of the system and execute the following command in the ofbiz home directory:
linux:  ./ant run-install-extseed
windows: ant.bat run-install-extseed
…..this can run for a while.......
Then run the next command to create the admin user :
linux:  ./ant create-admin-user-login
windows: ant.bat create-admin-user-login


Thanks
Dhiraj Gupta
Dhiraj Gupta
Reply | Threaded
Open this post in threaded view
|

Re: help: cleanup the ofbiz database

Yashwant Dhakad
In reply to this post by Francis ANDRE
Hi Francls,
If you are using Derby Database then use this command:

$ ant clean-all

For loading seed and seed-initial datas use this command:

$ ant run-install-readers -Ddata-readers=seed,seed-initial

Thanks & Regards
--
Yashwant Dhakad

On 03/26/2012 11:03 AM, Francis ANDRE wrote:
> Hi
>
> I am wondering how to make a full cleanup/erase of all datas in the
> database in order to reload only seed and seed-initial??? Any idea
> other than drop the database and reinstall??
>
> TIA
>
>

Reply | Threaded
Open this post in threaded view
|

Re: help: cleanup the ofbiz database

Anne Jessel
Hello Francis,

Others have explained what to do if you are using the supplied Derby db. To
my knowledge, there is no built-in support for doing this with dbs other
than Derby.

We use MySQL, so we wrote our own ant task to do this, which I will include
below. I expect it can be easily modified for use with postgresql or other
database systems.

This ant task assumes existence of a file java.local.properties in the
user's home directory. That file should hold local values for the
environment, such as username and password of a db user that has
appropriate permissions. This means each developer can have a different
configuration for their local database.

Cheers,
Anne.


<target name="clean-mysql" description="Drop and recreate dbs">
        <property file="${user.home}/java.local.properties" />
        <property name="db.name" value="ofbiz" />
        <property name="db.driver" value="${local.db.driver}" />
        <property name="db.url" value="${local.db.url}" />
        <property name="db.pwd" value="${local.db.pwd}" />
        <property name="db.user" value="${local.db.user}" />
        <fail message="No mysql driver, not cleaning mysql db">
            <condition>
                <not>
                    <available type="file"
file="mysql-connector-java-5.1.7-bin.jar"
filepath="framework/entity/lib/jdbc/" />
                </not>
            </condition>
        </fail>
        <echo message="Resetting ${db.name}erp, ${db.name}olap and
${db.name}tenant"
/>
        <sql driver="${db.driver}" url="${db.url}" userid="${db.user}"
password="${db.pwd}" expandproperties="true">
            <classpath>
                <fileset dir="framework/entity/lib/jdbc" includes="*.jar" />
            </classpath>
            <![CDATA[
            drop database if exists ${db.name}erp;
            drop database if exists ${db.name}olap;
            drop database if exists ${db.name}tenant;
            create database ${db.name}erp;
            create database ${db.name}olap;
            create database ${db.name}tenant;
            ]]>
        </sql>
    </target>


On 26 March 2012 17:00, Yashwant Dhakad <[hidden email]>wrote:

> Hi Francls,
> If you are using Derby Database then use this command:
>
> $ ant clean-all
>
> For loading seed and seed-initial datas use this command:
>
> $ ant run-install-readers -Ddata-readers=seed,seed-**initial
>
> Thanks & Regards
> --
> Yashwant Dhakad
>
>
> On 03/26/2012 11:03 AM, Francis ANDRE wrote:
>
>> Hi
>>
>> I am wondering how to make a full cleanup/erase of all datas in the
>> database in order to reload only seed and seed-initial??? Any idea other
>> than drop the database and reinstall??
>>
>> TIA
>>
>>
>>
>


--
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Phone: (03) 9585 6788
Fax: (03) 9585 1086
Web: http://www.cohsoft.com.au/
Email: [hidden email]

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/
Reply | Threaded
Open this post in threaded view
|

Re: help: cleanup the ofbiz database

mookins
This is my PostgreSQL version. It is a little rough at the moment and does not handle all possible conditions
The schemas must all have the owner that is being used to connect, in this case "ofbiz"
This script also requires the use of a java.local.properties file located in the ofbiz root directory or in the user's home directory.

        <target name="clean-postgresql" description="Drop and recreate dbs">
        <property file="java.local.properties"/>
                <property file="${user.home}/java.local.properties"/>
        <property name="db.name" value="ofbiz"/>
        <property name="db.driver" value="${local.db.driver}"/>
        <property name="db.host" value="${local.db.host}"/>
        <property name="db.password" value="${local.db.password}"/>
        <property name="db.user" value="${local.db.user}"/>
        <fail message="No postgresql driver, not cleaning postgresql db">
            <condition>
                <not>
                    <available type="file" file="${local.db.driverjar}" filepath="framework/entity/lib/jdbc/"/>
                </not>
            </condition>
        </fail>
        <echo message="Resetting ${db.name}, ${db.name}olap and ${db.name}tenant"/>
        <sql driver="${db.driver}" url="jdbc:postgresql://${db.host}/${db.name}" userid="${db.user}" password="${db.password}" expandproperties="true">
            <classpath>
                <fileset dir="framework/entity/lib/jdbc" includes="*.jar"/>
            </classpath>
                                DROP SCHEMA public CASCADE;
                                CREATE SCHEMA public AUTHORIZATION ofbiz;
                                GRANT ALL ON SCHEMA public TO ofbiz;
                                GRANT ALL ON SCHEMA public TO public;
        </sql>
                <sql driver="${db.driver}" url="jdbc:postgresql://${db.host}/${db.name}olap" userid="${db.user}" password="${db.password}" expandproperties="true">
            <classpath>
                <fileset dir="framework/entity/lib/jdbc" includes="*.jar"/>
            </classpath>
                                DROP SCHEMA public CASCADE;
                                CREATE SCHEMA public AUTHORIZATION ofbiz;
                                GRANT ALL ON SCHEMA public TO ofbiz;
                                GRANT ALL ON SCHEMA public TO public;
        </sql>
        <sql driver="${db.driver}" url="jdbc:postgresql://${db.host}/${db.name}tenant" userid="${db.user}" password="${db.password}" expandproperties="true">
            <classpath>
                <fileset dir="framework/entity/lib/jdbc" includes="*.jar"/>
            </classpath>
                                DROP SCHEMA public CASCADE;
                                CREATE SCHEMA public AUTHORIZATION ofbiz;
                                GRANT ALL ON SCHEMA public TO ofbiz;
                                GRANT ALL ON SCHEMA public TO public;
        </sql>
    </target>