Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-3613

Problem installing on Oracle schema when other schemas in the same database have one or more tables sharing the same name as any of Confluence's tables

      This is a list of the tables in used in Confluence as of version 1.4.2:

      SPACEPERMISSIONS
      TRACKBACKLINKS
      CONTENTLOCK
      PAGETEMPLATES
      os_user_group
      EXTRNLNKS
      NOTIFICATIONS
      ATTACHMENTS
      os_user
      SPACES
      os_group
      CONTENT
      ANCESTORS
      LINKS
      OS_PROPERTYENTRY

      If any of these tables in exist in other oracle schemas in the "same database", those tables will not be created, impairing bits of Confluence functionality that depend on those table(s).

      The bug is tied to this hibernate SchemaUpdate bug:

      http://opensource.atlassian.com/projects/hibernate/browse/HB-534

      This problem also affects PostgreSQL.

      Workaround

      This issue only occurs if the database user you are connecting to Oracle with has permission to view all tables across the database, not just those that relate to its own schema. You need to ensure you have followed all the steps in the Database Setup for Oracle document. The relevant ones here are the local all objects view, and ensuring that 'select any table' is not granted. However, all steps in that document need to be followed to avoid running into other issues down the track.

            [CONFSERVER-3613] Problem installing on Oracle schema when other schemas in the same database have one or more tables sharing the same name as any of Confluence's tables

            Minh Tran added a comment -

            Dear All,

            Thanks for taking the time to raise and comment on this issue.

            I believe this problem could be easily avoided if we follow the required Oracle DB setup document https://confluence.atlassian.com/doc/database-setup-for-oracle-173821.html when installing Confluence
            I decided to close this as won't fix.

            Regards
            Minh Tran
            Confluence Bugmaster
            Atlassian

            Minh Tran added a comment - Dear All, Thanks for taking the time to raise and comment on this issue. I believe this problem could be easily avoided if we follow the required Oracle DB setup document https://confluence.atlassian.com/doc/database-setup-for-oracle-173821.html when installing Confluence I decided to close this as won't fix. Regards Minh Tran Confluence Bugmaster Atlassian

            Hi guys we just upgraded to v5.6.3 and have 22 matches when running the log scanner.

            Zachary Buckholz added a comment - Hi guys we just upgraded to v5.6.3 and have 22 matches when running the log scanner.

            ctbto added a comment -

            Any news on this problem?

            ctbto added a comment - Any news on this problem?

            Hi Rodrigo

            This issue is currently on our backlog and we should be addressing it in the near future.

            Regards
            Steve Haffenden
            Confluence Bugmaster
            Atlassian

            Steve Haffenden (Inactive) added a comment - Hi Rodrigo This issue is currently on our backlog and we should be addressing it in the near future. Regards Steve Haffenden Confluence Bugmaster Atlassian

            Logs from upgrade from 3.1.2 to 3.5.5

            Rodrigo Prado Brandao [Atlassian] added a comment - Logs from upgrade from 3.1.2 to 3.5.5

            Faced the same error when upgrading from 3.1.2 to 3.5.5.

            When upgrading a Confluence instance configured with Oracle with the following scenario, the upgrade process is stopped and an error is thrown on the log file (attached).

            • table (e.g. cwd_user) already exists on the same database but belongs to another user (e.g. jira)
            • the confluence user on the database as grant to select any table.

            Rodrigo Prado Brandao [Atlassian] added a comment - Faced the same error when upgrading from 3.1.2 to 3.5.5. When upgrading a Confluence instance configured with Oracle with the following scenario, the upgrade process is stopped and an error is thrown on the log file (attached). table (e.g. cwd_user) already exists on the same database but belongs to another user (e.g. jira) the confluence user on the database as grant to select any table.

            We also ran into this issue when upgrading to Confluence v2.7.4 as an interim upgrade to v3.5.9 with an Oracle database.

            Our error logs showed an Oracle insufficient privileges error (see below) but since the SQL scripts are auto-generated in the upgrade process, we could not show our DBAs exactly what DB transactions/SQL commands were being executed...for them to be able to grant any particular privilege needed.

            net.sf.hibernate.HibernateException: java.sql.SQLException: ORA-01031: insufficient privileges

            In the end, we resolved the issue by restricting DB privileges/grants (not adding grants) to the Confluence schema that we were using so that it could only see it's own DB objects.

            Also, our resolution was contrary to the Atlassian recommendation that we found in the Schema Requirements section of the doc here...

            http://confluence.atlassian.com/display/CONF27/Database+Setup+for+Oracle

            We suggest that it be good to update that part of the Atlassian docs which states '...Confluence must be deployed to a schema in it's own, separate Oracle instance...' since that was not necessary at all in our case.

            Cyril Phillips added a comment - We also ran into this issue when upgrading to Confluence v2.7.4 as an interim upgrade to v3.5.9 with an Oracle database. Our error logs showed an Oracle insufficient privileges error (see below) but since the SQL scripts are auto-generated in the upgrade process, we could not show our DBAs exactly what DB transactions/SQL commands were being executed...for them to be able to grant any particular privilege needed. net.sf.hibernate.HibernateException: java.sql.SQLException: ORA-01031: insufficient privileges In the end, we resolved the issue by restricting DB privileges/grants (not adding grants) to the Confluence schema that we were using so that it could only see it's own DB objects. Also, our resolution was contrary to the Atlassian recommendation that we found in the Schema Requirements section of the doc here... http://confluence.atlassian.com/display/CONF27/Database+Setup+for+Oracle We suggest that it be good to update that part of the Atlassian docs which states '...Confluence must be deployed to a schema in it's own, separate Oracle instance...' since that was not necessary at all in our case.

            It's been my experience with other projects using Hibernate and Oracle that this behavior is not necessarily a bug - it's caused by the Oracle user having access to more than one schema. For example, if the Confluence user has 'select any table' privileges, and there is more than one table on the database with the same name, and Hibernate does not explicitly specify the schema to query, then you'll get a namespace collision. You can work around this by setting the hibernate.default_schema property.

            AnonAtlassianUser added a comment - It's been my experience with other projects using Hibernate and Oracle that this behavior is not necessarily a bug - it's caused by the Oracle user having access to more than one schema. For example, if the Confluence user has 'select any table' privileges, and there is more than one table on the database with the same name, and Hibernate does not explicitly specify the schema to query, then you'll get a namespace collision. You can work around this by setting the hibernate.default_schema property.

            Alternatively, an error message might look like:

            execute ORA-01430: column being added already exists in table

            Jeremy Largman added a comment - Alternatively, an error message might look like: execute ORA-01430: column being added already exists in table

            This appears somewhat infrequently, perhaps because the documentation on Oracle installation includes a warning, or perhaps because the chance of it happening are more or less rare. Nonetheless it does continue to occur, and when it does the error might look like:

            (HibernateTemplate): data integrity violated by SQL ''; nested exception is java.sql.BatchUpdateException: ORA-00001: unique constraint (CONFLUENCE.SYS_C003601) violated

            Jeremy Largman added a comment - This appears somewhat infrequently, perhaps because the documentation on Oracle installation includes a warning, or perhaps because the chance of it happening are more or less rare. Nonetheless it does continue to occur, and when it does the error might look like: (HibernateTemplate): data integrity violated by SQL ''; nested exception is java.sql.BatchUpdateException: ORA-00001: unique constraint (CONFLUENCE.SYS_C003601) violated

            Mike Barrs added a comment -

            Based on what I have read on this issue and my knowledge of Oracle, this should not be an issue if the oracle account(schema) only has permissions to objects in it's own schema (a good security practice for this type of account anyway.)

            Can anyone confirm this?

            I am going to be trying next week, I try to remember to post my results.

            Mike Barrs added a comment - Based on what I have read on this issue and my knowledge of Oracle, this should not be an issue if the oracle account(schema) only has permissions to objects in it's own schema (a good security practice for this type of account anyway.) Can anyone confirm this? I am going to be trying next week, I try to remember to post my results.

            Jeremy Largman added a comment - - edited

            A possible workaround:

            I think I found a workaround. I created a view within the schema to filter the object queries. As long as hibernate doesn't access sys.all_objects table directly, it will see only what's owned by the schema.

            CREATE VIEW wiki_dev.all_objects
            AS
            SELECT *
            FROM sys.all_objects
            WHERE owner = 'WIKI_DEV'
            ;

            Jeremy Largman added a comment - - edited A possible workaround: I think I found a workaround. I created a view within the schema to filter the object queries. As long as hibernate doesn't access sys.all_objects table directly, it will see only what's owned by the schema. CREATE VIEW wiki_dev.all_objects AS SELECT * FROM sys.all_objects WHERE owner = 'WIKI_DEV' ;

            fixversion and affects version were incorrectly set

            Per Fragemann [Atlassian] added a comment - fixversion and affects version were incorrectly set

            Jeremy Largman added a comment - - edited

            This issue may still be open. Here are the tables in 2.5.6:

            ATTACHMENTDATA
            ATTACHMENTS
            BODYCONTENT
            CLUSTERSAFETY
            CONFANCESTORS
            CONFVERSION
            CONTENTLOCK
            CONTENT_LABEL
            CONTENT_PERM
            CONTENT_PERM_SET
            EXTRNLNKS
            INDEXQUEUEENTRIES
            LINKS
            NOTIFICATIONS
            PAGETEMPLATES
            PLUGINDATA
            SPACEGROUPS
            SPACEPERMISSIONS
            SPACES
            TRACKBACKLINKS
            bandana
            content
            decorator
            draft
            external_entities
            external_members
            groups
            hibernate_unique_key
            label
            local_members
            os_group
            os_propertyentry
            os_user
            os_user_group
            users

            Jeremy Largman added a comment - - edited This issue may still be open. Here are the tables in 2.5.6: ATTACHMENTDATA ATTACHMENTS BODYCONTENT CLUSTERSAFETY CONFANCESTORS CONFVERSION CONTENTLOCK CONTENT_LABEL CONTENT_PERM CONTENT_PERM_SET EXTRNLNKS INDEXQUEUEENTRIES LINKS NOTIFICATIONS PAGETEMPLATES PLUGINDATA SPACEGROUPS SPACEPERMISSIONS SPACES TRACKBACKLINKS bandana content decorator draft external_entities external_members groups hibernate_unique_key label local_members os_group os_propertyentry os_user os_user_group users

            Don Willis added a comment - - edited

            I just tried confirmed that this is fixed in head. I created one Oracle user on a SID and that user created a CONTENT table. I then installed confluence using a different oracle user on the same SID with no difficulties.

            We have been using the same hibernate jar throught 2.2 and 2.3.

            Don Willis added a comment - - edited I just tried confirmed that this is fixed in head. I created one Oracle user on a SID and that user created a CONTENT table. I then installed confluence using a different oracle user on the same SID with no difficulties. We have been using the same hibernate jar throught 2.2 and 2.3.

            Perci Wong added a comment -

            Hi,

            Does the latest Confluence Wiki still require a separate Oracle Instance for the configuration to Oracle database? Would a new Confluence Schema on an existing SID work? Assume the Confluence Wiki is going to be deployed on an existing Tomcat instance.

            Thanks
            -Perci Wong

            Perci Wong added a comment - Hi, Does the latest Confluence Wiki still require a separate Oracle Instance for the configuration to Oracle database? Would a new Confluence Schema on an existing SID work? Assume the Confluence Wiki is going to be deployed on an existing Tomcat instance. Thanks -Perci Wong

            jens added a comment -

            It also appears that is is no longer a problem in 2.2.6a+ as a customer reported in his support issue. We will need to verify this and update the issue as well as the documentation.

            jens added a comment - It also appears that is is no longer a problem in 2.2.6a+ as a customer reported in his support issue. We will need to verify this and update the issue as well as the documentation.

            jens added a comment -

            Apparently this bug has been fixed. We will need to find out for which exact version of Hibernate and should consider upgrading.

            jens added a comment - Apparently this bug has been fixed. We will need to find out for which exact version of Hibernate and should consider upgrading.

            DonnaA added a comment -

            Confluence 2.2.2 List of Tables Update:

            ATTACHMENTDATA
            ATTACHMENTS
            BODYCONTENT
            CONFANCESTORS
            CONTENTLOCK
            CONTENT_LABEL
            EXTRNLNKS
            INDEXQUEUEENTRIES
            LINKS
            NOTIFICATIONS
            PAGETEMPLATES
            SPACEPERMISSIONS
            SPACES
            TRACKBACKLINKS
            bandana
            content
            draft
            external_entities
            external_members
            groups
            hibernate_unique_key
            label
            local_members
            os_group
            os_propertyentry
            os_user
            os_user_group
            users

            DonnaA added a comment - Confluence 2.2.2 List of Tables Update: ATTACHMENTDATA ATTACHMENTS BODYCONTENT CONFANCESTORS CONTENTLOCK CONTENT_LABEL EXTRNLNKS INDEXQUEUEENTRIES LINKS NOTIFICATIONS PAGETEMPLATES SPACEPERMISSIONS SPACES TRACKBACKLINKS bandana content draft external_entities external_members groups hibernate_unique_key label local_members os_group os_propertyentry os_user os_user_group users

              Unassigned Unassigned
              dave@atlassian.com dave (Inactive)
              Affected customers:
              22 This affects my team
              Watchers:
              34 Start watching this issue

                Created:
                Updated:
                Resolved: