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/scripts/ora-initialize.sh
    

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

The Oracle username that belongs to the Oracle user.

Password

The password that belongs to the Oracle user.

Instance

The name of the Oracle instance. In most cases, it is a simple name specified in your "tnsnames.ora" file.

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.

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

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

Svitlana Shatokhina (30/10/2008 11:23 am)


Comments

There are no comments.