Pentaho Initialization Exception Error _0014 on starting Pentaho 6.1 - oracle

I'm trying to install Pentaho BA on CentOS 7 with Java 1.8
I downloaded the Community Edition 6.1.0.1-196. I run ./start-pentaho.sh and after correcting some bugs, everything worked.
Then I decided to Use Oracle as Repository and by following this guide : https://help.pentaho.com/Documentation/5.4/0F0/0K0/040/0C0#title
I change some files.
When I changed Hibernate and Quartz everything were fine. Then I modified Jackrabbit ( repository.xml ) and context.xml and the error came up:
ERROR [org.pentaho.platform.util.logging.Logger] misc-org.pentaho.platform.engine.core.system.PentahoSystem: org.pentaho.platform.api.engine.PentahoSystemException: PentahoSystem.ERROR_0014 - Error while trying to execute startup sequence for org.pentaho.platform.engine.services.connection.datasource.dbcp.DynamicallyPooledDatasourceSystemListener
org.pentaho.platform.api.engine.PentahoSystemException: org.pentaho.platform.api.engine.PentahoSystemException: PentahoSystem.ERROR_0014 - Error while trying to execute startup sequence for org.pentaho.platform.engine.services.connection.datasource.dbcp.DynamicallyPooledDatasourceSystemListener
Now it's not even starting and the page looks like the image.
What did I put on the repository, or better what I changed is the password and the url.
I changed the url from jdbc:oracle:thin:#localhost:1521/XE to jdbc:oracle:thin:#hostname:port/servername or jdbc:oracle:thin:#hostname:port:servername but none of them are working.
Before that, I create the repository and the 3 user as explained in the guide:
--THIS USER IS SPECIFIC TO THE DATABASE WHERE THIS SCRIPT IS TO BE RUN AND
--IT SHOULD BE A USER WITH DBA PRIVS.
--AND ALSO #pentaho should be replaced with the correct instance name
--
--NOTE: run create_repository_ora.sql before running this script, which
-- creates the pentaho_tablespace
-- conn admin/password#pentaho
drop user quartz cascade;
create tablespace pentaho_tablespace
logging
datafile 'ptho_ts.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
create user quartz identified by "password" default tablespace pentaho_tablespace quota unlimited on pentaho_tablespace temporary tablespace temp quota 5M on system;
grant create session, create procedure, create table to quartz;
--CREATE QUARTZ TABLES
CONN quartz/password
CREATE TABLE QRTZ5_JOB_DETAILS
(
JOB_NAME VARCHAR2(200) NOT NULL,
JOB_GROUP VARCHAR2(200) NOT NULL,
DESCRIPTION VARCHAR2(250) NULL,
JOB_CLASS_NAME VARCHAR2(250) NOT NULL,
IS_DURABLE VARCHAR2(1) NOT NULL,
IS_VOLATILE VARCHAR2(1) NOT NULL,
IS_STATEFUL VARCHAR2(1) NOT NULL,
REQUESTS_RECOVERY VARCHAR2(1) NOT NULL,
JOB_DATA BLOB NULL,
PRIMARY KEY (JOB_NAME,JOB_GROUP)
);
CREATE TABLE QRTZ5_JOB_LISTENERS
(
JOB_NAME VARCHAR2(200) NOT NULL,
JOB_GROUP VARCHAR2(200) NOT NULL,
JOB_LISTENER VARCHAR2(200) NOT NULL,
PRIMARY KEY (JOB_NAME,JOB_GROUP,JOB_LISTENER),
FOREIGN KEY (JOB_NAME,JOB_GROUP)
REFERENCES QRTZ5_JOB_DETAILS(JOB_NAME,JOB_GROUP)
);
CREATE TABLE QRTZ5_TRIGGERS
(
TRIGGER_NAME VARCHAR2(200) NOT NULL,
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
JOB_NAME VARCHAR2(200) NOT NULL,
JOB_GROUP VARCHAR2(200) NOT NULL,
IS_VOLATILE VARCHAR2(1) NOT NULL,
DESCRIPTION VARCHAR2(250) NULL,
NEXT_FIRE_TIME number(13) NULL,
PREV_FIRE_TIME number(13) NULL,
PRIORITY NUMBER(13) NULL,
TRIGGER_STATE varchar2(16) NOT NULL,
TRIGGER_TYPE varchar2(8) NOT NULL,
START_TIME number(13) NOT NULL,
END_TIME number(13) NULL,
CALENDAR_NAME VARCHAR2(200) NULL,
MISFIRE_INSTR number(2) NULL,
JOB_DATA BLOB NULL,
PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (JOB_NAME,JOB_GROUP)
REFERENCES QRTZ5_JOB_DETAILS(JOB_NAME,JOB_GROUP)
);
CREATE TABLE QRTZ5_SIMPLE_TRIGGERS
(
TRIGGER_NAME VARCHAR2(200) NOT NULL,
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
REPEAT_COUNT number(7) NOT NULL,
REPEAT_INTERVAL number(12) NOT NULL,
TIMES_TRIGGERED NUMBER(10) NOT NULL,
PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ5_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ5_CRON_TRIGGERS
(
TRIGGER_NAME VARCHAR2(200) NOT NULL,
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
CRON_EXPRESSION VARCHAR2(120) NOT NULL,
TIME_ZONE_ID varchar2(80),
PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ5_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ5_BLOB_TRIGGERS
(
TRIGGER_NAME VARCHAR2(200) NOT NULL,
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
BLOB_DATA BLOB NULL,
PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ5_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ5_TRIGGER_LISTENERS
(
TRIGGER_NAME VARCHAR2(200) NOT NULL,
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
TRIGGER_LISTENER VARCHAR2(200) NOT NULL,
PRIMARY KEY(TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_LISTENER),
FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
REFERENCES QRTZ5_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
);
CREATE TABLE QRTZ5_CALENDARS
(
CALENDAR_NAME VARCHAR2(200) NOT NULL,
CALENDAR BLOB NOT NULL,
PRIMARY KEY (CALENDAR_NAME)
);
CREATE TABLE QRTZ5_PAUSED_TRIGGER_GRPS
(
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
PRIMARY KEY (TRIGGER_GROUP)
);
CREATE TABLE QRTZ5_FIRED_TRIGGERS
(
ENTRY_ID varchar2(95) NOT NULL,
TRIGGER_NAME VARCHAR2(200) NOT NULL,
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
IS_VOLATILE varchar2(1) NOT NULL,
INSTANCE_NAME VARCHAR2(200) NOT NULL,
FIRED_TIME number(13) NOT NULL,
PRIORITY NUMBER(13) NOT NULL,
STATE varchar2(16) NOT NULL,
JOB_NAME VARCHAR2(200) NULL,
JOB_GROUP VARCHAR2(200) NULL,
IS_STATEFUL varchar2(1) NULL,
REQUESTS_RECOVERY varchar2(1) NULL,
PRIMARY KEY (ENTRY_ID)
);
CREATE TABLE QRTZ5_SCHEDULER_STATE
(
INSTANCE_NAME VARCHAR2(200) NOT NULL,
LAST_CHECKIN_TIME number(13) NOT NULL,
CHECKIN_INTERVAL number(13) NOT NULL,
PRIMARY KEY (INSTANCE_NAME)
);
CREATE TABLE QRTZ5_LOCKS
(
LOCK_NAME varchar2(40) NOT NULL,
PRIMARY KEY (LOCK_NAME)
);
INSERT INTO QRTZ5_LOCKS values('TRIGGER_ACCESS');
INSERT INTO QRTZ5_LOCKS values('JOB_ACCESS');
INSERT INTO QRTZ5_LOCKS values('CALENDAR_ACCESS');
INSERT INTO QRTZ5_LOCKS values('STATE_ACCESS');
INSERT INTO QRTZ5_LOCKS values('MISFIRE_ACCESS');
create index idx_QRTZ5_j_req_recovery on QRTZ5_job_details(REQUESTS_RECOVERY);
create index idx_QRTZ5_t_next_fire_time on QRTZ5_triggers(NEXT_FIRE_TIME);
create index idx_QRTZ5_t_state on QRTZ5_triggers(TRIGGER_STATE);
create index idx_QRTZ5_t_nft_st on QRTZ5_triggers(NEXT_FIRE_TIME,TRIGGER_STATE);
create index idx_QRTZ5_t_volatile on QRTZ5_triggers(IS_VOLATILE);
create index idx_QRTZ5_ft_trig_name on QRTZ5_fired_triggers(TRIGGER_NAME);
create index idx_QRTZ5_ft_trig_group on QRTZ5_fired_triggers(TRIGGER_GROUP);
create index idx_QRTZ5_ft_trig_nm_gp on QRTZ5_fired_triggers(TRIGGER_NAME,TRIGGER_GROUP);
create index idx_QRTZ5_ft_trig_volatile on QRTZ5_fired_triggers(IS_VOLATILE);
create index idx_QRTZ5_ft_trig_inst_name on QRTZ5_fired_triggers(INSTANCE_NAME);
create index idx_QRTZ5_ft_job_name on QRTZ5_fired_triggers(JOB_NAME);
create index idx_QRTZ5_ft_job_group on QRTZ5_fired_triggers(JOB_GROUP);
create index idx_QRTZ5_ft_job_stateful on QRTZ5_fired_triggers(IS_STATEFUL);
create index idx_QRTZ5_ft_job_req_recovery on QRTZ5_fired_triggers(REQUESTS_RECOVERY);
commit;

Still bumped into this problem with Pentaho 7.1.
After some digging it looks like the real error is logged in tomcat/logs/pentaho.log (truncated on every start) and not catalina.out.
org.apache.jackrabbit.core.config.ConfigurationException: Duplicate configuration element DataStore in Repository.
Solution is to make sure you only have 1 instance of DataStore class, 1 instance of PersistanceManger class etc in pentaho-solutions/system/jackrabbit/repository.xml.
Make sure to comment out all instances of following classes (which are there by default):
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.H2PersistenceManager">

When you edit repository destination from default one to a new one make sure a user that is will be used to connect to a database is able to perform DDL instruction like create table or view and so on.
When starting platform tries to create repository from scratch for the first time after a config changes. If it is not able to connect/create repository - it will just not start as you see on a screenshot. It just will not work without a repository.
All oracle connection string syntax is described here as for Oracle jdbc driver - will be used under the hood. And of course you have to have jdbc driver jar in class-path.

Related

How to add constraint in ALTER TABLE statement: ORA-00942: table or view does not exist

I am altering a table and add constraints, but I get the error "ORA-00942: table or view does not exist". Could somebody please help me, as I can't manage to find from where the error is coming from? Thank you!
CREATE TABLE Functionar (
CNP NUMBER(11),
Nume VARCHAR (255) NOT NULL,
Salariu NUMBER(9, 2) NOT NULL,
Functie VARCHAR (255) NOT NULL,
Oras VARCHAR (255) NOT NULL,
Str VARCHAR (255) NOT NULL,
Num NUMBER(9) NOT NULL,
Cod_postal VARCHAR (2) NOT NULL,
Sector VARCHAR (255) NOT NULL,
PRIMARY KEY(CNP)
);
CREATE TABLE TELEFON_FUNCTIONAR (
Telefon_F NUMBER(9) NOT NULL,
Nr NUMBER(9) NOT NULL,
Doza_zil NUMBER(3) NOT NULL,
PRIMARY KEY(Telefon_F)
);
ALTER TABLE TELEFON_FUNCTIONAR
ADD CONSTRAINT "efectueaza" FOREIGN KEY(CNP) REFERENCES Functionar(CNP) ON DELETE
CASCADE;
ALTER TABLE TELEFON_FUNCTIONAR
ADD CONSTRAINT pk_TELEFON_FUNCTIONAR PRIMARY KEY(Telefon_F);

Oracle SQL: Missing right parenthesis

I'm migrating a database from mySQL to Oracle SQL but I'm getting a "ORA-00907: missing right parenthesis" error when creating a table. I've tried everything I can think of but still keep getting the same error.
Create table statement:
CREATE TABLE menu
(id int(11) NOT NULL AUTO_INCREMENT,
restaurant_id varchar(30) DEFAULT NULL,
menu_name varchar(30) DEFAULT NULL,
menu_description varchar(500) DEFAULT NULL,
menu_price varchar(30) DEFAULT NULL,
quantity int(11) DEFAULT '1',
PRIMARY KEY (id))
I think the problem is with the PRIMARY KEY as it's only table with PRIMARY KEYs that I get the error on. Apologies if this is an obvious question, I'm new to Oracle SQL. Thanks in advance!
Oracle != MySQL:
CREATE TABLE menu
( id number(11,0) GENERATED AS IDENTITY, --IDENTITY <=> AUTO_INCREMENT
restaurant_id varchar2(30) DEFAULT NULL, --VARCHAR2 instead of VARCHAR
menu_name varchar2(30) DEFAULT NULL,
menu_description varchar2(500) DEFAULT NULL,
menu_price varchar2(30) DEFAULT NULL,
quantity number(11,0) DEFAULT '1', --NUMBER(11,0) instead of INT(11)
PRIMARY KEY (id)
);

Oracle - Creating Triggers

I am trying to create a trigger in Oracle whereby we move deleted records to another table. So when deleted column is set to 1, it should move the records from the patient_table to the deleted_patient_table.
Can you please help :)
CREATE TABLE Patient_Table(
PatientID NUMBER(6) Primary Key,
Title char(4) NOT NULL,
Forename varchar2(20) NOT NULL,
Surname varchar2(20) NOT NULL,
Gender char(1) NOT NULL CHECK (Gender in ('M','F')),
DOB date NOT NULL,
TelNo varchar(12) NOT NULL,
Conditions varchar(200) NOT NULL,
Deleted Number(1) NOT NULL CHECK (Deleted in ('0','1'));
-- Table that should contain deleted records --
Create Table Deleted_Patient_table(
PatientID NUMBER(6) Primary Key,
Title char(4) NOT NULL,
Forename varchar2(20) NOT NULL,
Surname varchar2(20) NOT NULL,
Gender char(1) NOT NULL CHECK (Gender in ('M','F')),
DOB date NOT NULL,
TelNo varchar(12) NOT NULL,
Conditions varchar(200) NOT NULL,
Deleted Number(1));
Create or replace trigger trg_del
Before delete on Patient_Table
for each row
Begin
Insert into Deleted_Patient_table value (:old.PatientID,...)
End;
It seems you're soft-deleting your rows. i.e. not deleting but updating related column(Deleted) from 0 to 1. The values of column can be one of two and not null, so you only need to compare only two values of them without nvl operator. During this update operation you can use below trigger to produce log records :
Create or Replace Trigger Trg_Del_Patient
After Update on Patient_Table
For Each Row
Begin
If ( :old.Deleted = 0 and :new.Deleted = 1 ) Then
Insert into Deleted_Patient_table
values(:old.PatientID,:old.Title,:old.Forename,:old.Surname,
:old.Gender,:old.DOB,:old.TelNo,:old.Conditions);
Delete Patient_Table where PatientID = :old.PatientID;
-- Include this Delete statement, if you want to remove after the row has been inserted to the Deleted_Patient_Table
End If;
End;

ORA-00907: missing right parenthesis Error while creating a table?

I am new to oracle,
I have created two tables using following queries,
CREATE TABLE employee
(
emp_name VARCHAR(20) NOT NULL,
street VARCHAR(50) NOT NULL,
city VARCHAR(20) NOT NULL,
PRIMARY KEY(emp_name)
)
and
CREATE TABLE company
(
comp_name VARCHAR(20) NOT NULL,
city VARCHAR(20) NOT NULL,
PRIMARY KEY(comp_name)
)
Now I am trying to create another table using some foreign keys,
CREATE TABLE works
(
emp_name varchar(20) NOT NULL,
comp_name varchar(20) NOT NULL,
salary int(10) NOT NULL,
FOREIGN KEY(emp_name) REFERENCES employee(emp_name),
FOREIGN KEY(comp_name) REFERENCES company(comp_name)
)
Getting ERROR : ORA-00907: missing right parenthesis
I have also tried with
CREATE TABLE works
(
emp_name varchar(20) NOT NULL,
comp_name varchar(20) NOT NULL,
salary int(10) NOT NULL,
constraint wemployee FOREIGN KEY(emp_name) REFERENCES employee(emp_name),
constraint wcompany FOREIGN KEY(comp_name) REFERENCES company(comp_name)
)
But getting same error.
Can any one tell me that where I am doing mistake?
I'm no expert in oracle, but are you allowed to specify the (10) in salary int(10) NOT NULL?
1: you should have a table called "test" with two columns, id and testdata. (This is just a dumb quick example, so I won't bother to specify any constraints on id.)
create table test (id number, testdata varchar2(255));
2: Next we'll create a sequence to use for the id numbers in our test table.
create sequence test_seq
start with 1
increment by 1
nomaxvalue;
You could change "start with 1" to any number you want to begin with (e.g. if you already have 213 entries in a table and you want to begin using this for your 214th entry, replace with "start with 214"). The "increment by 1" clause is the default, so you could omit it. You could also replace it with "increment by n" if you want it to skip n-1 numbers between id numbers. The "nomaxvalue" tells it to keep incrementing forever as opposed to resetting at some point.i (I'm sure Oracle has some limitation on how big it can get, but I don't know what that limit is).
3: Now we're ready to create the trigger that will automatically insert the next number from the sequence into the id column.
create trigger test_trigger
before insert on test
for each row beginselect test_seq.nextval into :new.id from dual;
end;
/
There are two different ways to create a table with constraints:
1)
create table department(
deptno number(5) primary key,
deptname varchar2(30),
empno number(5) references emp(empno));
2)
create table department(
deptno number(5),
deptname varchar2(30),
empno number(5),
constraint pkey_deptno primary key(deptno),
constraint fkey_empno foreign key(empno) references Emp(empno));
When creating the index inline with the rest of the table creation statement try dropping the FOREIGN KEY part:
CREATE TABLE works
(
emp_name varchar(20) NOT NULL,
comp_name varchar(20) NOT NULL,
salary int(10) NOT NULL,
emp_name REFERENCES employee(emp_name),
comp_name REFERENCES company(comp_name)
)
See this question for more details:
ORA-00907: missing right parenthesis

Oracle trigger to update an entity in different table

So this is from a uni coursework and is my first time working with Oracle (and using triggers). We are supposed to be creating a database for an airlines.
Part of the database is
CREATE TABLE FLIGHT_BOOKING (
BOOKING_ID NUMBER(11) PRIMARY KEY,
BOOKING_TIME DATE NOT NULL,
EMPLOYEE_ID NUMBER(11) NOT NULL,
FLIGHT_ID NUMBER(11) NOT NULL,
TOTAL_COST NUMBER(4,2) NOT NULL
);
CREATE TABLE FLIGHT (
FLIGHT_ID NUMBER(11) PRIMARY KEY,
PLANE_ID NUMBER(11) NOT NULL,
START_ID NUMBER(11) NOT NULL,
DESTINATION_ID NUMBER(11) NOT NULL,
TRANSIT_ID NUMBER(11),
DEPARTURE_TIME DATE NOT NULL,
ARRIVAL_TIME DATE NOT NULL,
NUM_BOOKED NUMBER (4) NOT NULL
);
CREATE TABLE PASSENGER (
PASSENGER_ID NUMBER(11) PRIMARY KEY,
FIRST_NAME VARCHAR2(20) NOT NULL,
MIDDLE_NAME VARCHAR2(20) NULL,
LAST_NAME VARCHAR2(20) NOT NULL,
TELEPHONE NUMBER(11) NOT NULL,
BOOKING_ID NUMBER(11) NOT NULL
);
So what I want to do is create a trigger such that every time a new passenger is added to the PASSENGER table, the trigger finds the corresponding FLIGHT_ID from the FLIGHT_BOOKING table and increments NUM_BOOKED for the corresponding flight in the FLIGHT table.
I have tried going through the oracle documentation, but i could not find anything that describes a situation where two or more tables are concerned.
Any help would be really appreciated!
you can do it like this:
CREATE OR REPLACE TRIGGER update_flight_booking_info
AFTER INSERT ON PASSENGER
FOR EACH ROW
DECLARE
v_flight_id number;
v_booking_id number;
BEGIN
v_booking_id := :new.booking_id ;
select flight_id into v_flight_id
from flight_booking
where booking_id = v_booking_id;
update flight
set NUM_BOOKED = NUM_BOOKED + 1
where flight_id = v_flight_id;
END;
HTH.
I'd rather not store that number, and calculate it as needed, but okay, it is just course material. :)
When you create a trigger, inside it you can put all kinds of code, including update statements.
So you can write a trigger like this:
create or replace trigger TIDB_BOOKING
before insert or delete
for each row
declare
V_Increment int;
begin
-- Inc or dec, depending on insert or update.
-- Hasn't a booking got a number of seats?
-- Also, can bookings be updated/moved to other flights?
-- These problems aren't yet taken into account in this code.
V_Increment := 1;
if deleting then
V_Increment := -1;
update FLIGHT f
set f.NUM_BOOKED = f.NUM_BOOKED + V_Increment
where f.FLIGHT_ID = nvl(:new.FLIGHT_ID, :old.FLIGHT_ID);
end;

Resources