Page MenuHomePhabricator

Oracle installer throw SET CONSTRAINTS ALL DEFERRED PL/SQL error
Closed, ResolvedPublic

Description

Author: jfehrman

Description:
This error appears on install.

Setting up database... done
Creating database user... done
Creating tables...A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
SET CONSTRAINTS ALL DEFERRED
from within function "DatabaseOracle::doQuery". Database returned error ": ".
Backtrace:
#0 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/db/DatabaseOracle.php(337): DatabaseOracle->reportQueryError(NULL, NULL, 'SET CONSTRAINTS...', 'DatabaseOracle:...')
#1 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/db/DatabaseOracle.php(944): DatabaseOracle->doQuery('SET CONSTRAINTS...')
#2 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/DatabaseInstaller.php(158): DatabaseOracle->begin('DatabaseInstall...')
#3 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/OracleInstaller.php(245): DatabaseInstaller->createTables()
#4 [internal function]: OracleInstaller->createTables(Object(OracleInstaller))
#5 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/Installer.php(1331): call_user_func(Array, Object(OracleInstaller))
#6 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstallerPage.php(1127): Installer->performInstallation(Array, Array)
#7 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstaller.php(254): WebInstaller_Install->execute()
#8 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(50): WebInstaller->execute(Array)
#9 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(18): wfInstallerMain()
#10 {main}


Version: 1.18.x
Severity: blocker
OS: Solaris
Platform: Other

Details

Reference
bz34280
TitleReferenceAuthorSource BranchDest Branch
mediawiki-pages: rename to Community Requests, add peer gadgetrepos/commtech/wishlist-intake!38musikanimalcommunity-requests-renamemain
Add more wishlist pages, templates and basic bot runrepos/commtech/wishlist-intake!22musikanimaltemplatesmain
Use wiki page when editing wishes, add centralized config and Util classrepos/commtech/wishlist-intake!17musikanimalutilmain
Add 'setup' command to automate deploying necessary pages and templatesrepos/commtech/wishlist-intake!14musikanimalmediawiki-pagesmain
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:16 AM
bzimport set Reference to bz34280.
bzimport added a subscriber: Unknown Object (MLST).

Adding Jure in CC since he is the Oracle guru

Can you tell us what php version and what version of Oracle you are using?

jfehrman wrote:

(In reply to comment #2)

Can you tell us what php version and what version of Oracle you are using?

Sure I know the oracle version should be oracle 10g. The OS is a Solaris. Running a PHP 5. OCI8 configured to work with PHP. MB-String module installed.

Looks like that command is the Oracle way of starting a transaction. From includes/db/DatabaseOracle.php :

function begin( $fname = 'DatabaseOracle::begin' ) {
    $this->mTrxLevel = 1;
    $this->doQuery( 'SET CONSTRAINTS ALL DEFERRED' );
}

Your credentials might lack the user right to set constraints, or the DB might lack that support.

jfehrman wrote:

(In reply to comment #4)

Looks like that command is the Oracle way of starting a transaction. From
includes/db/DatabaseOracle.php :

function begin( $fname = 'DatabaseOracle::begin' ) {
    $this->mTrxLevel = 1;
    $this->doQuery( 'SET CONSTRAINTS ALL DEFERRED' );
}

Your credentials might lack the user right to set constraints, or the DB might
lack that support.

Well that depends do you mean that the DB user may lack credentials or the Solaris user account. My user account with the DB has DBA and create session capabilities.

For some reason oci_execute() fails and then oci_error() does not return any error. I have no idea how we could track this issue further down :-(

jfehrman wrote:

Line 337 changed to $this->reportQueryError( $e, $e['message'], $e['code'], $sql, METHOD ); to print out some error. I currently am unsure what the error means but the error message that is now printed is:
Setting up database... done
Creating database user... done
Creating tables...bool(false) bool(false) A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
from within function "DatabaseInstaller::createTables". Database returned error "0: Query "CREATE SEQUENCE user_user_id_seq MINVALUE 0 START WITH 0 " failed with error code "". ".
Backtrace:
#0 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/DatabaseInstaller.php(162): DatabaseOracle->reportQueryError('Query "CREATE S...', 0, '', 'DatabaseInstall...')
#1 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/OracleInstaller.php(245): DatabaseInstaller->createTables()
#2 [internal function]: OracleInstaller->createTables(Object(OracleInstaller))
#3 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/Installer.php(1331): call_user_func(Array, Object(OracleInstaller))
#4 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstallerPage.php(1127): Installer->performInstallation(Array, Array)
#5 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstaller.php(254): WebInstaller_Install->execute()
#6 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(50): WebInstaller->execute(Array)
#7 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(18): wfInstallerMain()
#8 {main}

jfehrman wrote:

(In reply to comment #7)

Line 337 changed to $this->reportQueryError( $e, $e['message'], $e['code'],
$sql, METHOD ); to print out some error. I currently am unsure what the
error means but the error message that is now printed is:
Setting up database... done
Creating database user... done
Creating tables...bool(false) bool(false) A database query syntax error has
occurred. This may indicate a bug in the software. The last attempted database
query was:
from within function "DatabaseInstaller::createTables". Database returned error
"0: Query "CREATE SEQUENCE user_user_id_seq MINVALUE 0 START WITH 0 " failed
with error code "". ".
Backtrace:
#0
/appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/DatabaseInstaller.php(162):
DatabaseOracle->reportQueryError('Query "CREATE S...', 0, '',
'DatabaseInstall...')
#1
/appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/OracleInstaller.php(245):
DatabaseInstaller->createTables()
#2 [internal function]: OracleInstaller->createTables(Object(OracleInstaller))
#3
/appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/Installer.php(1331):
call_user_func(Array, Object(OracleInstaller))
#4
/appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstallerPage.php(1127):
Installer->performInstallation(Array, Array)
#5
/appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstaller.php(254):
WebInstaller_Install->execute()
#6
/appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(50):
WebInstaller->execute(Array)
#7
/appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(18):
wfInstallerMain()
#8 {main}

May have created that error by adding a parameter. I don't know.

freak wrote:

Are you creating a new user in the install process or using an existing one?

There *should* be no difference, i'm just trying to replicate the bug.

jfehrman wrote:

No I am not creating a new user. The user exist in the DB.

jfehrman wrote:

The DB user also has DBA permissions and create session permissions.

jfehrman wrote:

Tried to set up an new DB in Oracle 11g on a different server and I had the same issue.

jfehrman wrote:

<?php

$db = '*';
$connect = oci_connect('user', 'password', $db);
$query = oci_parse($connect, 'CREATE TABLE t (a NUMBER, b VARCHAR2(10))');
oci_execute($query);

?>

This test php page was created to ensure that I was able to connect to the DB and create a table. It was a success.

freak wrote:

OK, Found it ... the problem occurs if you try to use a predefined account and there seems to be a bug when the installer tries to switch from install user to web access user.

Until this is fixed you can use a simple workaround by entering the same credentials into "User account for installation" and "Database account for web access" ... leave "Create the account if it does not already exist" unchecked

Oh and another thing ... for Christ's, Santa Clause's, Easter Bunny's or for that matter any other fictional character's sake ... DO NOT USE A USER WITH DBA ROLE for a web access account.
If you want to manually create the user, open the user.sql file in maintenance/oracle folder and take a look at the required privileges. Using a DBA role for a webpage backend is bad almost beyond words. #youhavebeenwarned

jfehrman wrote:

(In reply to comment #14)

OK, Found it ... the problem occurs if you try to use a predefined account and
there seems to be a bug when the installer tries to switch from install user to
web access user.

Until this is fixed you can use a simple workaround by entering the same
credentials into "User account for installation" and "Database account for web
access" ... leave "Create the account if it does not already exist" unchecked

Oh and another thing ... for Christ's, Santa Clause's, Easter Bunny's or for
that matter any other fictional character's sake ... DO NOT USE A USER WITH DBA
ROLE for a web access account.
If you want to manually create the user, open the user.sql file in
maintenance/oracle folder and take a look at the required privileges. Using a
DBA role for a webpage backend is bad almost beyond words. #youhavebeenwarned

Jure thanks for the help. It did not work as planned though. It still is throwing the same error. Plus I don't know if this is a JS error but the checkbox doesn't appear the first time through I had to go backwards in the installation for that checkbox. (I use Chrome) I will continue to try it but no luck so far.

jfehrman wrote:

Oh yeah and this MW installation is not for production it is a proof of concept.

freak wrote:

Have you tried instead of backing up, dropping the user in the database and clicking "restart installation" in the installer.

jfehrman wrote:

Are you suggesting that I create a new user in the database for the install? The user currently exist but I can try that.

freak wrote:

I am suggesting you try this:

  • if the current user you try to install MW with was manually created, drop id from database
  • run the installer and click on "restart installation"
  • for the installing user enter a superuser credentials like SYSTEM or SYS
  • uncheck "Use the same account as for installation"
  • enter a new username and password (if you dropped a user in the first step then enter those credentials)
  • check "Create the account if it does not already exist"

try that and tell me how it goes ...

jfehrman wrote:

Installation Settings Selected:
Langauge
-English
-English
Connect to Database:
-Database Type: Oracle
-Database TNS: **2 <-in TNSnames.ora
-Database Prefix: MW1
-Default tablespace: USERS
-Temporary Tablespace: TEMP
-Database username: *$wiki
-Database password:
**
-Do not use same account for installation
-Database username: *$wiki
-Database password:
*
Name:
-Name of Wiki: MyWiki
-Project namespace: same as the wiki name: $1 ; MyWiki <-in textbox
-Your Name: admin
-Password: *
-Password again: *
-E-mail address: j**@****.com
-I'm bored already, just install the wiki (Nothing on the next page needs to be changed)

jfehrman wrote:

(In reply to comment #19)

I am suggesting you try this:

  • if the current user you try to install MW with was manually created, drop id

from database

  • run the installer and click on "restart installation"
  • for the installing user enter a superuser credentials like SYSTEM or SYS
  • uncheck "Use the same account as for installation"
  • enter a new username and password (if you dropped a user in the first step

then enter those credentials)

  • check "Create the account if it does not already exist"

try that and tell me how it goes ...

Creation of new account does not work. Fails on creation. Error says database connection issue.

jfehrman wrote:

I placed print statements in OracleInstaller.php to see what functions the install script was calling and I discovered that it appears to be failing on getSchemaVars() because it is returning a bool false array. Below is how the install script reads after the print statements were included.

OracleInstaller.php preInstall()
Setting up database...OracleInstaller.php setupDatabase() done
Creating database user...OracleInstaller.php setupUser() done
Creating tables...OracleInstaller.php createTables()OracleInstaller.php openConnection()OracleInstaller.php getSchemaVars()OracleInstaller.php getSchemaVars() return: Arraybool(false) A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
SET CONSTRAINTS ALL DEFERRED
from within function "DatabaseOracle::doQuery". Database returned error ": ".
Backtrace:
#0 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/db/DatabaseOracle.php(338): DatabaseOracle->reportQueryError(NULL, NULL, 'SET CONSTRAINTS...', 'DatabaseOracle:...')
#1 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/db/DatabaseOracle.php(945): DatabaseOracle->doQuery('SET CONSTRAINTS...')
#2 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/DatabaseInstaller.php(158): DatabaseOracle->begin('DatabaseInstall...')
#3 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/OracleInstaller.php(256): DatabaseInstaller->createTables()
#4 [internal function]: OracleInstaller->createTables(Object(OracleInstaller))
#5 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/Installer.php(1331): call_user_func(Array, Object(OracleInstaller))
#6 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstallerPage.php(1127): Installer->performInstallation(Array, Array)
#7 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/includes/installer/WebInstaller.php(254): WebInstaller_Install->execute()
#8 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(50): WebInstaller->execute(Array)
#9 /appsrvr/wwwdd/apache_2.2.16/ddweb/mediawiki/mediawiki-1.18.1/mw-config/index.php(18): wfInstallerMain()
#10 {main}

jfehrman wrote:

Tried making user sysdba. Nothing changed.

jfehrman wrote:

Attempted in two browsers to ensure that it was not a browser issue. I.E. and Google Chrome. -Yes at this point I am trying everything.-

jfehrman wrote:

Created user through MW scripts. The final step of the install script is not creating an objects (no tables) for this user. Upon removing the lines of code for SET CONSTRAINTS a different error was thrown. So the SET CONSTRAINTS were placed back in and now the focus is on figuring out why tables are not being created.

jfehrman wrote:

Currently upgrading to PHP 5.3.10 to see if the old PHP version could be contributing to the issue in some way.

jfehrman wrote:

PHP 5.3.10 Confirmed to work. It requires that the user puts the same account information in both user to create MW install and user to use in MW install. (Not sure why some type of bug) Thanks to Jure who spent hours and hours helping me resolve this issue, Hashar for pointing me in the right direction, and Reedy for helping point out an obvious need for the ticket.

freak wrote:

Still trying to figure out why it didn't work with a superuser.

The workaround (using same pre-created DB user both as install and web-access account) is no longer needed after:
r112502 for trunk (1.20)
r112504 for REL1_19 (1.19)
r112505 for REL1_18 (1.18)

rptrus wrote:

Hello,

I have dowloaded the latest version 1.19 (May2) and am receiving this same error

"Creating tables...A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
SET CONSTRAINTS ALL DEFERRED
"

I am using PHP5.2.17 which is the version needed for Apache. I am using a seperate DB schema (ie username/password) for DB installation and have written a script to confirm that I can connect correctly to oracle using php.
Any ideas?

jfehrman wrote:

rptrus,
I sent you an email but I would update your version of PHP if at all possible. I would also try and update Apache if that is the reason for not updating PHP. This is what worked for me. Let me know if you can not update for some reason.