#####
#
# Perform database specific checks for the bootstrap and installer scripts.
#
#####
proc db_bootstrap_checks { errors error_p } {
upvar $errors my_errors
upvar $error_p my_error_p
foreach pool [db_available_pools {}] {
if { [catch { set db [ns_db gethandle -timeout 15 $pool]}] || $db eq "" } {
# This should never happened - we were able to grab a handle previously, why not now?
append my_errors "(db_bootstrap_checks) Internal error accessing pool \"$pool\".
"
set my_error_p 1
} else { # DRB: The aD code didn't deallocate the database handle if either of the following
# errors occurred. Boo hiss...
if { [catch { ns_ora 1row $db "select sysdate from dual" }] ||
[catch { ns_ora exec_plsql_bind $db { begin :1 := 37*73; end; } 1 "" }] } {
append my_errors "Database pool \"$pool\" has been configured with an old version of the Oracle driver. You'll need version 2.3 or later.
"
set my_error_p 1
}
ns_db releasehandle $db
}
}
if { ![info exists my_error_p] } {
# Get the version from Oracle, using the db tools equivalent of
# sticks and fire...
set db [ns_db gethandle [lindex [db_available_pools {}] 0]]
set selection [ns_db 1row $db "select version from product_component_version where product like 'Oracle%'"]
regexp {^[0-9]+\.[0-9]+\.[0-9]+} [ns_set value $selection 0] match
ns_db releasehandle $db
nsv_set ad_database_version . $match
}
}
proc db_installer_checks { errors error_p } {
upvar $errors my_errors
upvar $error_p my_error_p
# Date format is a globally defined value for Oracle, so we only need to check it once
# for correctness.
if { [db_string sysdate "select sysdate from dual"] !=
[db_string sysdate2 "select to_char(sysdate,'YYYY-MM-DD') from dual"] } {
# See if NLS_DATE_FORMAT is set correctly
append my_errors "
" append my_errors [db_string sysdate "select sysdate from dual"] append my_errors "
" append my_errors [ns_fmttime [ns_time] "%Y-%m-%d"] append my_errors "
Your Oracle driver is correctly installed, however Oracle's date format should be set to YYYY-MM-DD.
\n" set my_error_p 1 } } # If we're using Oracle we have to check that the korn shell's available and a couple of # other similar things. proc db_helper_checks { errors error_p } { upvar $errors my_errors upvar $error_p my_error_p # Oracle should provide ctxhx global env # How the hell we'd get this far without ORACLE_HOME is beyond me, but they want to # check, so let them check! if {![info exists env(ORACLE_HOME)]} { append my_errors "
There is no ORACLE_HOME
variable in your environment.
This variable must be set in order for the Oracle software to work properly (even on an Oracle client).
" set my_error_p 1 } # First we look for the overall presence of interMedia db_1row check_role "SELECT (SELECT COUNT(*) FROM USER_ROLE_PRIVS WHERE GRANTED_ROLE = 'CTXAPP') ctxrole, (SELECT COUNT(*) FROM ALL_USERS WHERE USERNAME = 'CTXSYS') ctxuser, USER thisuser FROM DUAL" if {$ctxuser < 1} { append my_errors "
The CTXSYS user does not exist in your database. This means
that interMedia is probably not installed. interMedia is needed for full-text searching.
To install it, you may either use the Oracle Database Assistant (dbassist
under UNIX) to re-create
your database or add the missing capabilities (JServer and interMedia), or, if you're feeling adventurous, look at running
the SQL*Plus script \$ORACLE_HOME/ctx/admin/dr0inst.sql
on the Oracle server.
The CTXAPP
role has not been granted to this database
user ($thisuser
). Without the role, it will be impossible to synchronize interMedia indexes
and several other tasks. As a dba user (e.g., SYSTEM
), grant the role:
If you still receive this error after restarting AOLserver, you may need to include the role
as a \"default\" role for the user. To do so, run the following as a dba user such as
GRANT CTXAPP TO $thisuser;
SYSTEM
:
ALTER USER $thisuser DEFAULT ROLE ALL;
You are running Oracle $dbversion under Linux (Intel). Versions of
Oracle prior to 8.1.7 lack the INSO filters used by interMedia. (These filters convert content
stored in a variety of proprietary formats (e.g., Microsoft Word) into plain text or HTML for indexing
and searching.) The best solution is to upgrade the server to Oracle 8.1.7. A workaround is to create the
file \$ORACLE_HOME/ctx/bin/ctxhx
on the Oracle server containing the following lines:
This is a simple shell script that just copies the input onto the output. This will work fine
for the HTML and text documents generally stored in this toolset. After saving this file,
be sure to give it the proper ownership and permissions:
#!/bin/sh
cat \$1 > \$2
chown oracle:oinstall \$ORACLE_HOME/ctx/bin/ctxhx
chmod 755 \$ORACLE_HOME/ctx/bin/ctxhx
" set my_error_p 1 } # do some cleanup db_dml drop "DROP FUNCTION oacs_get_oracle_version" # ksh must be installed for Oracle's loadjava to work. if { ![ad_windows_p] && ![file exists "/bin/ksh"] } { if {[file exists "/usr/bin/ksh"]} { set usr_bin_p 1 } else { set usr_bin_p 0 } if {!($usr_bin_p)} { append my_errors "
The file /bin/ksh
is not present. This file is the Korn shell and
is required by Oracle's loadjava
utility for adding Java class files to the database.
It must be installed in order for OpenACS to install properly. Please obtain it from
David Korn's Kornshell page. (Alternatively, pdksh
(a ksh clone) has been reported to work.) Install it and provide
a symbolic link from /bin/ksh
to the executable. Alternatively, loadjava
is known to work if /bin/sh
is linked to /bin/ksh
. You can do this by typing
as root:
ln -s /bin/sh /bin/ksh
You have the Korn shell installed in /usr/bin/ksh
, but Oracle's
loadjava
program expects in in /bin/ksh
. As root, please create
a symbolic link.
" } set my_error_p 1 } } # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End:ln -s /usr/bin/ksh /bin/ksh