TAFJ Oracle Install
TAFJ Oracle Install
R24
Revisio
Date Amended Name Description
n
1 1st April 2011 TAFJ team Initial version
2 7st February 2012 H. Aubert R12GA review
10th September
4 H. Aubert R14GA review
2013
20th February
5 R. Vincent R14GA review
2014
20th September
9 JN. Charpin Grant for XA recovery
2017
12th December
10 S. Vinod Altered the user creation dbscript
2017
Please include your name, company, address, and telephone and fax numbers, and email
address if applicable. [email protected]
Table of Contents
Document History................................................................................................................... 2
Copyright................................................................................................................................ 3
Errata and Comments............................................................................................................. 3
Introduction............................................................................................................................. 5
Install Oracle........................................................................................................................... 5
Create a Database Instance.................................................................................................... 5
Create Tablespace and a User............................................................................................... 13
Load the necessary PLSQL functions.....................................................................................16
Storing JSON.......................................................................................................................... 17
Procedure for applying JSON fix............................................................................................... 17
Appendix: Oracle performance parameters...........................................................................18
Install Oracle
Most steps aren’t shown. Please follow the official Oracle document setup.
For 12c, see http://docs.oracle.com/cd/E16655_01/nav/portal_11.htm
Or
Execute %ORACLE_HOME%\BIN\dbca.bat
Set a Global Database name. You will have to report this name in the property file of
your project to the key temn.tafj.jdbc.url
uncheck configure Enterprise Manager
Press Next…
Enter the Administrative password for the DB.
(This is NOT (!) the password you will set in the properties file...)
Press Next…
Uncheck Flash recovery.
Press Next…
Choose Oracle JVM
Press Next…
IMPORTANT! Specify AL32UTF8 in the Character Sets tab...
Press Next…
Press Next…
Press Finish…
Press Exit… (The URL will be used as to connect to the database monitor.)
Press Close…
In the TAFJ installation <TAFJ_HOME> \dbscripts\oracle, you will find 2 SQL scripts:
createtablespace.sql
createuser.sql
You will need to edit this script to reflect the correct data.
i.e:
CREATE SMALLFILE TABLESPACE T24DB DATAFILE 'C:\product\database\
oracle\oradata\T24DB.dbf' SIZE 7G AUTOEXTEND ON NEXT 100M MAXSIZE
UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT
AUTO;
In the createuser_oracle.sql, you will need to change the username and the password and the
tablespace name (in Green):
The tablespace Name: <TableSpace_Name>
The DB Username: <DBUser>
The DB Password: <DBPassword>
i.e:
CREATE USER tafj PROFILE "DEFAULT" IDENTIFIED BY secret DEFAULT TABLESPACE
"T24BD" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK;
GRANT "CONNECT" TO tafj;
GRANT "RESOURCE" TO tafj;
grant query rewrite to tafj;
grant create synonym to tafj;
grant drop any procedure to tafj;
grant create any table to tafj;
grant select any table to tafj;
grant update any table to tafj;
grant insert any table to tafj;
grant delete any table to tafj;
grant drop any table to tafj;
grant create any index to tafj;
grant alter any index to tafj;
grant drop any index to tafj;
grant create any view to tafj;
grant drop any view to tafj;
grant create any directory to tafj;
grant select_catalog_role to tafj;
grant xdbadmin to tafj;
grant execute on dbms_lock to tafj;
grant unlimited tablespace to tafj;
grant select on sys.dba_pending_transactions to tafj;
Once these values have been changed, launch a console and from <TAFJ_HOME> \dbscripts\
oracle, type:
Then, type:
@createtablespace_oracle.sql
And
@createuser_oracle.sql
You will have to give the full path to these scripts if there are not in the current directory. These
scripts can take several minutes to be executed. Then, exit from sqlplus
exit
>sqlplus <DBUser>
And type
@oracle_plsql_functions.sql
This should create your PLSql functions necessary for the transact to work properly.
Then, exit from sqlplus
exit
Once this is finished you should be able to run a DBImport for oracle. Don’t forget to copy the
ORACLE drivers from <TAFJ_HOME>/dbdrivers to <TAFJ_HOME>/ext. The properties that go
in the TAFJ properties file look like this:
temn.tafj.jdbc.url = jdbc:oracle:thin:@localhost:1521:T24DB
temn.tafj.jdbc.driver = oracle.jdbc.driver.OracleDriver
temn.tafj.jdbc.username = tafj
temn.tafj.jdbc.password = secret
JSON tables are created with a constraint to ensure it is valid JSON. An example CREATE TABLE
statement follows.
CREATE TABLE <TableName> (RECID VARCHAR2(255) NOT NULL PRIMARY KEY, XMLRECORD
BLOB CONSTRAINT <TableName>_json CHECK (XMLRECORD IS JSON)) LOB (XMLRECORD)
STORE AS (CACHE)”.
During the DBImport, JSON views will be created with a json_table for single attribute columns.
Multi-value columns will be formed using json_exists function dynamically. Putting multi-value
columns inside a json_table creates an unwanted Cartesian product.
JSON columns can be promoted and indexed. Please see the Oracle documentation.
Note that Oracle has a bug with prepared statements with version 12.2.0.1 that
requires a patch. To get around this bug, one can set the property
temn.tafj.jdbc.use.ps.json.oracle.fix=true in tafj.properties (default is false as
applying the patch is better)
When using INSERT/UPDATE instead of MERGE for TAFJ-TRANSACT, the following is the
recommendation from Oracle to improve the performance with respect to primary key violation
errors.
# Use the MERGE statement instead of UPDATE/INSERT for XML Schema
#
temn.tafj.jdbc.write.use.merge= false
# Use the MERGE statement instead of UPDATE/INSERT for NO XML Schema and NO XML Schema work
#
temn.tafj.jdbc.write.use.merge.no.xml=false
When an INSERT is executed, it will return an ORA-00001 error saying that the primary key already exists,
and that error message include the table owner and name; to get that information, we internally execute a
data dictionary query, namely 2jfqzrxhrm93b. Unfortunately, we don't cache the result (which is the table
owner and name), so we re-execute and also re-parse this query for every ORA-00001. There is a
workaround for the mentioned problem which can be put in place if the application does not need to
actually get the table owner/name, but just needs to get the fact that there is a duplication, i.e. ORA-00001.
The way to change this is to set the parameter "_suppress_identifiers_on_dupkey" to true; this
can be done online without database/instance bounce.