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.

Automated Initialization

This section describes how you can create a clean eZ Publish database on your Oracle server using the "ora-initialize.sh" script. The script is intended to help those Linux/UNIX users who wish to create a new eZ Publish site running on an Oracle database. (Windows users must do manual initialization instead.) It is also possible to re-initialize an Oracle database that contains eZ Publish related information left after previous eZ Publish installations.The "ora-initialize.sh" script is located in the "extension/ezoracle/scripts" directory and can be executed using the Bourne Again Shell (bash). The following example shows how to run the script.

  1.  Navigate into the eZ Publish installation directory.
  2.  Run the script using the following command:
    ./extension/ezoracle/bin/shell/ora-initialize.sh
    
     

Warning: when using this method, the tables needed by extensions will not be automatically created.The script will perform several steps (described below). Note that when the script needs to perform any actions on an Oracle server, it will create a temporary (hidden) file called ".ezoracle_test.php". Execute it and then remove it (the temporary file is a script that makes use of the PHP Oracle functions). This is done on every step except the 4-th one. In other words, the script must have write/create privileges in the directory.

Step 1. Checking requirements

The script will check if the following requirements are met:

  •  PHP CLI is available
  •  PHP has support for Oracle compiled in
  •  The eZ Publish installation contains the "ezoracle" extension
  •  Both the database schema and database data files ("share/db_schema.dba" and "share/db_data.dba") are present in the eZ Publish directory.

The script will also check if the environment variable ORACLE_HOME, which points to the Oracle installation directory, is set and the "tnsnames.ora" file is present it the "network/admin" subdirectory. Alternatively, the script will check if the TNS_ADMIN variable is set and points to a directory where the "tnsnames.ora" file resides. Depending on whether these variables are set and the "tnsnames.ora" file is present, the script may display a warning to the user before continuing with the remaining tests.Two other environment variables that will be checked by the script are LD_LIBRARY_PATH and NLS_LANG. If any of these is not set, a warning will be displayed. If the character set component of the NLS_LANG variable is set to something else than UTF-8 ("AL32UTF8"), the script will display a warning and wait for the user's response, since this configuration is not recommended.

Step 2. Testing connection to an Oracle server (optional)

The script will ask you if this step should be performed or not (skipping is not recommended). If yes, you will have to provide the following information:

Information

Description

Username

Which user to connect with

Password

The password for the user.

Instance

The name of the Oracle instance. In most cases, it is a simple name specified in your "tnsnames.ora" file. This must match the instance configured on the client. If you are unsure about this you can use the one set in the ORACLE_SID environment variable.

Step 3. Creating an Oracle user with sufficient privileges (optional)

The script will ask if you wish to create a new Oracle user account. If you already have a user with sufficient privileges, you can skip this step. To create a new user, you will have to provide the following:

  •  The username and password for the database administrator (or any other Oracle user that has the "CREATE USER" system privilege).
  •  The username and password for the user that is being created.
  •  The name of the Oracle instance.
  •  The name of the default tablespace for the user that is being created (optional).

The script will display the SQL query for creating a new user, ask for confirmation and finally add the user.

Step 4. Connecting to an Oracle server

If you did not create a new user account during step 3, the script will ask you to provide the username/password (not the DB administrator, but the one which the eZ Publish database belongs to) and the name of the Oracle instance. The user must have the required privileges, so that the script can connect to the specified Oracle database and perform the next steps.Note that this step will be skipped if you created a new user during step 3.

Step 5. Testing user info with Oracle

The script will now attempt to connect to the specified Oracle database using the Oracle account that was specified/created during step 3 or 4.

Step 6. Creating 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 provided string input. The script will create this function if the Oracle account that is being used has the "CREATE PROCEDURE" privilege.

Step 7. Creating the "bitor" function

The database extension requires a custom function called "bitor" to be stored in the database. This function returns the result of a bitwise OR operation performed on two numeric arguments. The script will create this function if the Oracle account that is being used has the "CREATE PROCEDURE" privilege.

Step 8. Cleaning up the database

The script will search for existing eZ Publish data in the database and get rid of it (if any).

Step 9. Initializing the database structure

The script will initialize the necessary database structure for eZ Publish (create all the necessary tables, sequences and triggers in the Oracle database) according to the definitions specified in the "share/db_schema.dba" file.

Step 10. Importing pre-defined data to the database

The script will import the pre-defined data from the "share/db_data.dba" file to the database, so that the clean eZ Publish database will be ready to use.To migrate an existing database with its data, you first need to generate the schema file and the data file with the following commands (launched from the eZ Publish installation directory):

./bin/php/ezsqldumpschema.php --output-types=schema --format=generic \ --output-array --type=mysql \ --host= --user= --password= \  path/to/schema.dba
./bin/php/ezsqldumpschema.php --output-types=data --format=generic \ --output-array --type=mysql \ --host= --user= --password= \  path/to/data.dba

Then you can run the ora-initialize.sh script with the previously generated files in parameter.

./extension/ezoracle/bin/shell/ora-initialize.sh -s path/to/schema.dba \-d path/to/data.dba

Once the automated initialization has successfully finished, you may continue the installation process by following the remaining steps.

Andrea Melo (12/11/2012 3:46 pm)

Andrea Melo (06/12/2012 11:24 am)


Comments

There are no comments.