Forum OpenACS Q&A: OpenACS 4.6 does not yet work with Oracle 9i?

hi!

The 4.6 docs say that "OpenACS 4.6 does not yet work with Oracle 9i". I wonder if this is still the case, and what about 4.7?

Thanks for any information.

/Mohan

Collapse
Posted by Jeff Davis on
Nothing has been done for this on 4.6 or on the HEAD. It would be useful if someone who has made it work could provide the laundry list of what needs to be done. I am under the impression it's mostly the reserved word collisions for delete and some others. I don't think it's a lot of work but upgrade scripts might be pretty tough I guess.
Collapse
Posted by Don Baccus on
Upgrade scripts wouldn't be a problem as we'd just CREATE OR REPLACE all the offending packages and of course chase down every reference in the toolkit sources.  That's the headache ...

We'd just make sure that standard OpenACS and dotLRN packages work.

There's no way to upgrade user's custom code so we'd just have to document the changes and force them to do it manually.  They'll have their own custom types with "delete" in them to chase down, etc ad nauseum.

Upgrading custom code would be a hassle because of this but since we can't write the upgrade scripts, writing them wouldn't be a problem!

"when to do it" - that's the question.  4.7?

Collapse
Posted by Don Baccus on
Actually I think you can still use "delete" in 9i if you fully qualify it in the source.  I'm not sure of this, but it would be worth checking out.

If so that would give us a clean way to upgrade for those staying with 8i.  Users with custom types etc wouldn't have to clean them up until they themselves upgrade to 9i, in which case they'll get annoyed at Oracle, not us.

If I'm right, that is ...

Collapse
Posted by Hazi Gharagozlou on
Taking the bull by the horns.

I have started migrating OACS 4.6 from Oracle 8i (8.1.7) to Oracle 9i (9.2.) on a Suse 8.1 machine (Oracle seems to prefer Suse to Red Hat). I have had to do the following to make it work.

A. The famous delete and rename. Oracle 9i does not mind a package having either delete or rename as functions or procedures, however it will not allow addressing the variable by its dot notation (i.e. where object_id = acs_objects.delete.object_id). For the moment, I have gone through all packages and have removed all leading dot notations (i.e. where object_id = object_id).

It seems to work

B. SQLJ error. While loading packages I got the following error message:

Loading SQLJ code /web/ilo/packages/acs-content-repository/java/Regexp-oracle.sqlj...
arguments: '-verbose' '-user' 'ilo/xxxx' '/web/ilo/packages/acs-content-repository/java/Regexp-oracle.sqlj'
oracleora9: relocation error: /ora9/m01/app/oracle/product/9.2/lib/libjox9.so: undefined symbol: __fixunssfdi
SQL Error while connecting with oci8 driver to default database: ORA-12547: TNS:lost contact

Thanks to a Suse user I was able to correct the above by

1. Installed the latest sdk (1.4)from sun
2. Modified $ORACLE_HOME/bin/loadjava - changed JAVA_HOME to point to the newer sdk

Linking with 9i libraries

C. rel_contstraints_violated view. - Also thanks to an OpenACS user, I have also changed the view from constraints_rels.* to include all actual column names.

I still have a problem. On a fresh install after admin name and password screen, the system hangs. I am going to chase this problem next week.

Collapse
Posted by Don Baccus on
That doesn't sound bad at all ...

For parameters I'd love to switch parameter names to the convention we began on the PG side ... p_foo rather than foo (which nicely complements the v_foo style for variables.)

But with all the calls that use named parameters that's probably impractical.  It would make things more readable ...

It's ironic that I had it backwards - it is the fully-qualified form that fails rather than the unqualified form!  That's bizarre, frankly.  Both should work within a package itself if Oracle followed normal scoping rules for Ada-ish languages, but, hell, I'm just a compiler writer, what do *I* know?

Collapse
Posted by Jun Yamog on
Isn't YBOS ACS 4.3 run on 9i?  If yes, maybe they can help by providing a list of what they have done.

https://openacs.org/forums/message-view?message_id=29416

Collapse
Posted by Andrew Grumet on
You can actually preserve the function signatures though this has a kind of band-aid quality to it. The trick is to disambiguate by declaring a new variable, assigning it to the parameter passed in, and henceforth using the new variable. So the revised content-folder.delete, for example, would look like this
procedure delete (
  folder_id     in cr_folders.folder_id%TYPE
) is

  v_count integer;
  v_parent_id integer;
*  v_folder_id integer;

begin
*  v_folder_id := folder_id;


  -- check if the folder contains any items

  [snip snip snip]

  content_folder.unregister_content_type(
*      folder_id        => v_folder_id,
      content_type     => 'content_revision',
      include_subtypes => 't' );

  delete from cr_folder_type_map
*    where folder_id = v_folder_id;

  [etc etc etc]
end delete;
where new/changed code is marked with a * (I would have used color but it looks like FONT tags are disallowed).

I used this approach on my personal site as a one-off since it's on an already-dead codebase (Classic ACS 4.2).

Oh, also there are a few cases where this approach falls down due to the use of the dot notation in cursor declarations. The trick is to declare the cursor inline (for cur in (select ...) loop) instead of in the declaration block.

Collapse
Posted by Jade Rubick on
Not that it affects me personally, but could whoever is doing this sort of work provide patches so that this could get into the toolkit?
Collapse
Posted by Hazi Gharagozlou on
Executing the following view drops the Oracle connection (end of communciation).

I followed up all the views and they all seem to work indvidually. Then I tried to play around with the outer joins and the view works if I take out the second outer join(party_id). Is there something that I missiing in Oracle 9i (ver 9.2)? May be sombody would point me in the right direction?

CREATE OR REPLACE VIEW REL_CONSTRAINTS_VIOLATED_ONE ( CONSTRAINT_ID, 
CONSTRAINT_NAME, REL_ID, CONTAINER_ID, PARTY_ID, 
REL_TYPE, REL_SEGMENT, REL_SIDE, REQUIRED_REL_SEGMENT
 ) AS select constrained_rels.constraint_id, constrained_rels.constraint_name,
   constrained_rels.rel_id, constrained_rels.container_id,
   constrained_rels.party_id, constrained_rels.rel_type,
   constrained_rels.rel_segment,constrained_rels.rel_side,
   constrained_rels.required_rel_segment
from (select rel_constraints.constraint_id, rel_constraints.constraint_name,
             r.rel_id, r.container_id, r.party_id, r.rel_type,
             rel_constraints.rel_segment,
             rel_constraints.rel_side,
             rel_constraints.required_rel_segment
      from rel_constraints, rel_segment_party_map r
      where rel_constraints.rel_side = 'one'
        and rel_constraints.rel_segment = r.segment_id
     ) constrained_rels,
     rel_segment_party_map rspm
where rspm.segment_id(+) = constrained_rels.required_rel_segment
  and rspm.party_id(+) = constrained_rels.container_id
Collapse
Posted by Mohan Pakkurti on
OACS is still not ported to Oracle 9i.

My work on porting is stalled for now. I have been having aolserver4 problems on Solaris and my attempt to port is stalled. I am also going away for a month, so if someone else is willing to volunteer for the Oracle 9i porting work, please let me know.

Collapse
Posted by Mohan Pakkurti on
OACS is still not ported to Oracle 9i.

My work on porting is stalled for now. I have been having aolserver4 problems on Solaris and my attempt to port is stalled and have little time this week to look at it. I am also going away for a month, so if someone else is willing to volunteer for the Oracle 9i porting work, please let me know.

/Mohan

Collapse
Posted by Michael Hinds on
How far did you get, Mohan?
Collapse
Posted by Michael Hinds on
Hazi,

How are you executing this, from within AOLserver or sqlplus? I tried it on our 9i db from sqlplus and it works fine.

Collapse
Posted by Hazi Gharagozlou on
SqlPlus. The data model loads correctly and then at Admin creation I get the end of communication of Oracle.

I load the data and stop just prior to admin creation screen. I then create the admin by inserting indvidual rows with sqlplus. When I get to the the above view Oracle drops.

I will get back to it on Thursday, I need to figure out the problem by beg. of next week.

Collapse
Posted by Simos Gabrielidis on
Hello Hazi,

I think this is a bug in the SQL code of the rel_constraints_violated_one and rel_constraints_violated_two views; it seems that they use the equality operator(=) on NULL columns. However, because of tri-value logic in SQL, NULL=NULL always fails.

I believe the two view should be re-written as following (note the code in bold):

create or replace view rel_constraints_violated_one as select constrained_rels.*
from (select rel_constraints.constraint_id, rel_constraints.constraint_name, 
             r.rel_id, r.container_id, r.party_id, r.rel_type, 
             rel_constraints.rel_segment,
             rel_constraints.rel_side, 
             rel_constraints.required_rel_segment
      from rel_constraints, rel_segment_party_map r
      where rel_constraints.rel_side = 'one'
        and rel_constraints.rel_segment = r.segment_id
     ) constrained_rels,
     rel_segment_party_map rspm
where rspm.segment_id(+) = constrained_rels.required_rel_segment
  and constrained_rels.container_id is null
  and rspm.party_id is null;


create or replace view rel_constraints_violated_two as
select constrained_rels.*
from (select rel_constraints.constraint_id, rel_constraints.constraint_name, 
             r.rel_id, r.container_id, r.party_id, r.rel_type, 
             rel_constraints.rel_segment,
             rel_constraints.rel_side, 
             rel_constraints.required_rel_segment
      from rel_constraints, rel_segment_party_map r
      where rel_constraints.rel_side = 'two'
        and rel_constraints.rel_segment = r.segment_id
     ) constrained_rels,
     rel_segment_party_map rspm
where rspm.segment_id(+) = constrained_rels.required_rel_segment
  and constrained_rels.party_id is null
  and rspm.party_id is null;

See also an old thread Installation of ACS 4.2 and Oracle 9i on Linux
Collapse
Posted by Hazi Gharagozlou on
Your modifications work. Meanwhile to test fully I will run the views on a site with more users and will look at explain plan in detail.

Thanks

Collapse
Posted by Simos Gabrielidis on
BTW, I still think it's a good practice to include all the actual column names in the views; I was just too lazy (constrained_rels.*) to follow my own suggestions, I guess 😉
Collapse
Posted by Andrew Piskorski on
Yipes, more than a year after Simos first found the solution, and that view still hasn't been fixed in the toolkit? Hazi, please be sure to let us know how your testing of the fix goes, so we can patch the OpenACS sources as well.
Collapse
Posted by Hazi Gharagozlou on
I am going through all the views and changing * to actual column names.

Don, what level of testing is required for our modifcations to be included in OpenACS release. Do we need to test all packages?

Collapse
Posted by Gaven Eogan on
I'm trying to do an install an 9i and it keeps failing with some strange error that nobody here has seen before - "resource busy and acquire with NOWAIT specified" (see below) - we're using OpenACS partially fixed for 9i (Hazi's I think)
It seems to happen everywhere that a new table is being created.
Has anyone seen this or know what's the cause and fix for it?

Thanks,
Gaven

# Installing data model for ACS Service Contract 4.7d2...

    * Loading data model /data/web/enke_dev/packages/acs-service-contract/sql/oracle/acs-service-contract-create.sql...

SQL*Plus: Release 8.1.7.0.0 - Production on Mon May 19 14:40:25 2003
(c) Copyright 2000 Oracle Corporation.  All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.0.1.3.0 - Production
With the Partitioning option
JServer Release 9.0.1.3.0 - Production
PL/SQL procedure successfully completed.
No errors.
create table acs_sc_msg_types (
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified
                references acs_sc_msg_types(msg_type_id)
                            *

Collapse
Posted by Gaven Eogan on
Well it seems the problem is that even though the user is dropped and recreated some things stay in the background until they're cleaned up by Oracle.
See for more on this:
http://www.dbaclick.com/forums/archive/20/1422.html
(Ciaran DeBuitlear found this solution)

I had to wait for an hour after dropping user, and then the install continued without above error (still failed though for other reasons) ie.

*** Initializing content repository hierarchy...
declare
*
ERROR at line 1:
ORA-02291: integrity constraint (ENKE_KM.ACS_OBJECTS_CONTEXT_ID_FK) violated -
parent key not found
ORA-06512: at "ENKE_KM.ACS_OBJECT", line 68
ORA-06512: at "ENKE_KM.CONTENT_ITEM", line 146
ORA-06512: at "ENKE_KM.CONTENT_FOLDER", line 34
ORA-06512: at line 5

and then it stopped at:

Completing Install sequence by mounting the main site and other core packages.

SQL*Plus: Release 8.1.7.0.0 - Production on Fri May 23 16:30:33 2003
(c) Copyright 2000 Oracle Corporation.  All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.0.1.3.0 - Production
With the Partitioning option
JServer Release 9.0.1.3.0 - Production
declare
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "ENKE_KM.ACS", line 90
ORA-06512: at line 9

Collapse
Posted by Jade Rubick on
Mohan,

I really appreciate you going through all the code (even the code in contrib!) and making things more compatible with Oracle8i. I didn't realize that my code was going to make porting more difficult for others.

However, I'm not sure how this happened, but the code you checked back in was from 5 weeks ago, so I'm going to have to go in and reconcile the difference. I know it wasn't intentional, but if you're still working on this, perhaps there's a way you can reconcile the changes you make with the current code?