Oracle Privileges Required by XWiki
Reference
Configure Oracle Manually grants the DBA role to the xwiki user, for simplicity. XWiki needs much less, and the groups below are the whole of it. They are not all needed at the same time: an instance that never creates a wiki never needs the last two.
To move an existing installation off the DBA role, follow Restrict the Privileges of the Oracle User.
Everyday operation
| Privilege | What XWiki does with it |
|---|---|
| CREATE SESSION | Connect to the database. |
| RESOURCE | Create the tables, sequences and indexes of its own schema. |
| SELECT ANY TABLE, SELECT ANY SEQUENCE | Read the schema of any wiki of the farm. |
| INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE | Write to the schema of any wiki of the farm. |
The ANY forms cover the tables of the other wikis of the farm, which XWiki reaches through the same connection rather than by connecting as each wiki's own user.
Schema migrations
XWiki runs its schema migrations when it starts on a new version, and again for each wiki it creates. They create and alter tables in schemas the xwiki user does not own, so they need the ANY forms too.
| Privilege | What XWiki does with it |
|---|---|
| CREATE ANY TABLE, DROP ANY TABLE, ALTER ANY TABLE | Add, remove and reshape tables of a wiki's schema. |
| CREATE ANY INDEX, ALTER ANY INDEX | Add and reshape the indexes of those tables. |
| CREATE ANY SEQUENCE | Add the sequences those tables use. |
GRANT CREATE ANY TABLE TO xwiki;
GRANT DROP ANY TABLE TO xwiki;
GRANT ALTER ANY TABLE TO xwiki;
GRANT CREATE ANY INDEX TO xwiki;
GRANT ALTER ANY INDEX TO xwiki;
GRANT CREATE ANY SEQUENCE TO xwiki;Wiki creation
| Privilege | What XWiki does with it |
|---|---|
| CREATE USER | Create the Oracle user of a new wiki. Not needed when wiki.createDatabase is false. |
Creating a wiki also runs the migrations above, so grant both groups together.
GRANT CREATE USER TO xwiki;Wiki deletion
| Privilege | What XWiki does with it |
|---|---|
| DROP USER | Remove the Oracle user of a deleted wiki, with the tables it owns. |
GRANT DROP USER TO xwiki;Returning to the everyday privileges
Each of the three groups above is used at a moment you choose, so it can be revoked once the wiki creation, the wiki deletion or the upgrade is over.
REVOKE CREATE USER FROM xwiki;
REVOKE DROP USER FROM xwiki;
REVOKE CREATE ANY TABLE FROM xwiki;
REVOKE DROP ANY TABLE FROM xwiki;
REVOKE ALTER ANY TABLE FROM xwiki;
REVOKE CREATE ANY INDEX FROM xwiki;
REVOKE ALTER ANY INDEX FROM xwiki;
REVOKE CREATE ANY SEQUENCE FROM xwiki;FAQ
Is granting the DBA role wrong?
It is convenient rather than wrong, and it is what the installation steps do. It also lets the instance do anything to every schema of that Oracle database, which is worth avoiding on a server XWiki shares.
Which privilege is missing when Oracle answers ORA-01031?
ORA-01031: insufficient privileges names none. Read it against the groups above through what XWiki was doing: a failure while creating a wiki points at CREATE USER, one during the first start on a new version at the migration group.