Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Manual initialization

This section describes the generic manual initialization method that makes it possible to create a clean eZ Publish database on your Oracle server and/or import data from an existing MySQL database to Oracle. Both Linux/UNIX and Windows users can perform manual initialization.

In order to run eZ Publish on an Oracle database, you must have an Oracle user account with sufficient privileges. If you do not have such an account, proceed with the first step of the instructions below to create a new Oracle user for eZ Publish. When you have such a user, all the remaining steps must be done using this account.

1. Create an Oracle user with sufficient privileges (optional)

In order to create a new Oracle user for eZ Publish, connect to the Oracle instance as the database administrator (or any other Oracle user that has the "CREATE USER" system privilege) and execute the following SQL query:

SQL> CREATE USER scott IDENTIFIED BY tiger QUOTA UNLIMITED ON SYSTEM;
 GRANT CREATE    SESSION   TO scott;
 GRANT CREATE    TABLE     TO scott;
 GRANT CREATE    TRIGGER   TO scott;
 GRANT CREATE    SEQUENCE  TO scott;
 GRANT CREATE    PROCEDURE TO scott;

Replace "SYSTEM" with the name of the default tablespace for users if it is configured. (The default tablespace for users can be specified in Oracle Database server software version 10 or higher. Previous versions default to the SYSTEM tablespace if a user is created without the DEFAULT TABLESPACE option.)

This will create an Oracle account with username "scott" and password "tiger". If the user "scott" already exists, you will see the following error message:

ORA-01920: user name 'SCOTT' conflicts with another user or role name

In this case, you should either choose a different username or make sure that the user with the username "scott" has the necessary privileges.

2. Create the "md5_digest" function

The database extension requires a custom function called "md5_digest" to be stored in the database. This function returns an MD5 hash (checksum) generated for the supplied string input. To add this function, connect to the database using the Oracle account created for eZ Publish and execute the SQL query located in the "extension/ezoracle/sql/md5_digest.sql" file. The following example shows how this can be done assuming that user "scott" can connect to an Oracle instance called "ORCL" and has the "CREATE PROCEDURE" privilege.

  1. Navigate into the eZ Publish installation directory.
  2. Create the "md5_digest" function using the following shell command:
    sqlplus scott/tiger@ORCL @extension/ezoracle/sql/md5_digest.sql
    

3. Create the "bitor" function

Another custom function that needs to be added is called "bitor". This function returns the result of a bitwise OR operation performed on two numeric arguments. To add this function, connect to the database using the Oracle account created for eZ Publish and execute the SQL query located in the "extension/ezoracle/sql/bitor.sql" file. The following example shows how this can be done assuming that user "scott" can connect to an Oracle instance called "ORCL" and has the "CREATE PROCEDURE" privilege.

  1. Navigate into the eZ Publish installation directory.
  2. Create the "bitor" function using the following shell command:
    sqlplus scott/tiger@ORCL @extension/ezoracle/sql/bitor.sql
    

4. Initialize the database structure and import pre-defined data

It is possible to create a clean eZ Publish database on your Oracle server or import data from an existing MySQL database to Oracle. Follow the instructions given in the corresponding subsection below.

Creating a clean database

In order to create a new eZ Publish site that uses an Oracle database, you will have to initialize the necessary database structure for eZ Publish according to the definitions specified in the "share/db_schema.dba" file and then import pre-defined data from the "share/db_data.dba" file to the database. This can be done by using the "ezsqlinsertschema.php" script located in the "bin/php" directory of your eZ Publish installation. The following example shows how to run this script:

  1. Navigate into the eZ Publish installation directory.
  2. Initialize the necessary database structure using the following shell command:

    php bin/php/ezsqlinsertschema.php --type=oracle --user=scott --password=tiger share/db_schema.dba ORCL
    

    The "--clean-existing" option makes it possible to remove eZ Publish data (if it already exists, left-overs from a previous installation):

    php bin/php/ezsqlinsertschema.php --type=oracle --user=scott --password=tiger share/db_schema.dba ORCL --clean-existing
    

     

  3. Import the pre-defined data to the database using the following shell command:
    php bin/php/ezsqlinsertschema.php --type=oracle --user=scott --password=tiger --schema-file=share/db_schema.dba --insert-types=data share/db_data.dba ORCL
    

Importing data from MySQL

In order to migrate an existing eZ Publish site from MySQL to Oracle, you will have to import data from an existing MySQL database to Oracle. The following example shows how this can be done assuming that user "root" has password "secret" and can connect to a MySQL database called "mydb" on localhost.

  1. Navigate into the "extension/ezoracle/scripts" subdirectory.
  2. Run the "mysql2oracle-schema.php" script like this:

    php mysql2oracle-schema.php mydb:root/secret@localhost > mydump.sql
    

     

    The script will connect to the MySQL database, retrieve the database schema and save it to the "mydump.sql" file in a specific format that is compatible with Oracle.

    If the Oracle database that you are going to use already contains some eZ Publish data, the "mysql2oracle-schema.php" script must be run using the "--drop" option, like this:

    php mysql2oracle-schema.php mydb:root/secret@localhost > mydump.sql --drop
    

     

  3. Import the database schema from "mydump.sql" to the Oracle database:
    sqlplus scott/tiger@ORCL < mydump.sql
    

    If you have used the "--drop" option during the previous step, the "mydump.sql" file will include an appropriate "drop" statement before every "create" instruction, so that the existing elements (if any) will be removed before new ones are created.
  4. Run the "mysql2oracle-data.php" script using the following shell command:
    php mysql2oracle-data.php mydb:root/secret@localhost scott/tiger@ORCL
    

    The script will import data from the MySQL database to the Oracle database.
  5. Update the sequences in the Oracle database:
    php ora-update-seqs.php scott/tiger@ORCL
    

5. Continue the installation process

Once the Oracle database is ready, you may continue the installation process by following the remaining steps.

Svitlana Shatokhina (20/12/2006 10:47 am)

Svitlana Shatokhina (28/10/2008 12:37 pm)


Comments

There are no comments.