ORA-22813: operand value exceeds system limits - oracle

I'm having an issue with an oracle object I created. The goal of the stored procedure is to either retreive all wires contained on an airplane or compare the list of wires with another one (past airplane wire configuration). You will understand that this can be quite big... I did a first shot with a table of objects. I make a select statement and loop through a cursor to insert values in my objects. The problem comes from when I try this:
OPEN P_CURSOR FOR
SELECT * FROM TABLE(CAST(GET_WIRES(P_ACTUAL_HAR_LIST, P_END_IDENT_TYPES) AS TBL_TP_WIRE_LIST));
I get the ORA-22813: operand value exceeds system limits. So, I started looking on the internet and I found that I should have used a PIPELINED function, which I tryied. But, the PIPELINED function is not allowed in a PL/SQL context, so that doesn't fit my problem, since I need to rework the object afterward. So, I tryied a Global Temporary Table and I have now performance issue. I also tryied to contact the DBA if he could increase the PGA size, which he did (it's now 150mb) but I have the same problem. Maybe it's still not big enough, but I don't want him to reincrease it if it's not going to work... Just so you have an idea, I have 1 487 761 of those:
CREATE OR REPLACE
TYPE TP_WIRE_LIST_ENTRY AS OBJECT (
ATA_NUM VARCHAR2(8 BYTE),
EFFECTIVITIES VARCHAR2(4000 BYTE),
WIRE_ID VARCHAR2(50 BYTE),
DRAWING_NO VARCHAR2(25 BYTE),
END_IDENT_1 VARCHAR2(25 BYTE),
END_IDENT_2 VARCHAR2(25 BYTE),
PIN_1 VARCHAR2(25 BYTE),
PIN_2 VARCHAR2(25 BYTE),
TERM_1 VARCHAR2(25 BYTE),
TERM_2 VARCHAR2(25 BYTE),
DES_LENGTH NUMBER(6,2),
TECH_PUBS_REMARKS VARCHAR2(500 BYTE),
WIRE_CODE VARCHAR2(25 BYTE),
W_CODE VARCHAR2(3 BYTE),
AWG VARCHAR2(3 BYTE),
COLOR VARCHAR2(4 BYTE),
GA VARCHAR2(6 BYTE),
END_IDENT_DESC_1 VARCHAR2(50 BYTE),
END_IDENT_DESC_2 VARCHAR2(50 BYTE),
TECH_PUBS_REMARKS_1 VARCHAR2(500 BYTE),
TECH_PUBS_REMARKS_2 VARCHAR2(500 BYTE),
IDENT_TYPE_ID_1 VARCHAR2(10 BYTE),
IDENT_TYPE_ID_2 VARCHAR2(10 BYTE),
BUS_NAME_1 VARCHAR2(20 BYTE),
PROPERTY_COLLECTION_ID_1 NUMBER(10,0),
BUS_NAME_2 VARCHAR2(20 BYTE),
PROPERTY_COLLECTION_ID_2 NUMBER(10,0),
X_1 NUMBER(8,3),
Y_1 NUMBER(8,3),
Z_1 NUMBER(8,3),
UOM_1 VARCHAR2(10 BYTE),
X_2 NUMBER(8,3),
Y_2 NUMBER(8,3),
Z_2 NUMBER(8,3),
UOM_2 VARCHAR2(10 BYTE),
COORD_CODE_1 VARCHAR2(10 BYTE),
COORD_CODE_2 VARCHAR2(10 BYTE),
UOM_DESC_1 VARCHAR2(50 BYTE),
UOM_DESC_2 VARCHAR2(50 BYTE),
PART_NO VARCHAR2(25 BYTE),
PART_DESC VARCHAR2(50 BYTE),
WIRE_GAUGE VARCHAR2(4 BYTE),
SPEC_REFERENCE VARCHAR2(60 BYTE),
MPS_NUM VARCHAR2(25 BYTE),
PPS_NUM VARCHAR2(25 BYTE),
INSERTION_TOOL VARCHAR2(25 BYTE),
EXTRACTION_TOOL VARCHAR2(25 BYTE)
);
/
We work with Oracle9i Enterprise Edition Release 9.2.0.6.0
Best regards,

I ran into a similar situation in a data warehousing environment at a past job.
Did your DBA increate pga_aggregate_target or _pga_max_size or both? Keep in mind that when the DBA increases pga_aggregate_target to 150MB that doesn't mean that your session would be able to grab all of that 150MB. Oracle will only allow a given session to take a small fraction of that space. Increasing pga_aggregate_target from 150MB to 200MB will only give your session a few extra megs of memory to play with for in-memory operations IIRC.
If your DB server has more available memory, you'll have to have your DBA increase both pga_aggregate_target and _pga_max_size, otherwise you'll have to look at using a GTT or creating a scratch table to dump your data into and then work on it from there.

Just wanted to add this tidbit in case it helps someone else. We suddenly started getting this error in our PL/SQL when the DBA set RESULT_CACHE_MODE to AUTO as a test for another process. We didnt know he did this until much later. Anyway, setting it back to MANUAL fixed this problem.

Related

SSIS Error: 0xC002F210 at Execute SQL Task, Execute SQL Task

I have 191 table and view creation scripts for Oracle DB. I thought it will be more efficient to use the Execute SQL task in SSIS. I set up my Execute SQL task and Foreach loop container. I have connection to my Oracle DB 11g but i keep getting error whn I run the task.
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "--------------------------------------------------..." failed with the following error: "ORA-00911: invalid character". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task
When I create a simple insert query and save to a .sql, the row gets inserted to the db so I know there's no issue with my connection to the DB.
One of my sql files looks like that.
--------------------------------------------------------
-- DDL for Table ACCOUNT
--------------------------------------------------------
CREATE TABLE "DBSCHEMA"."ACCOUNT"
( "MNT_IN_BO" CHAR(1 BYTE),
"ACCT_KEY" CHAR(34 BYTE),
"BRCH_MNM" CHAR(8 BYTE),
"CUS_SBB" CHAR(8 BYTE),
"CUS_MNM" CHAR(20 BYTE),
"ACC_TYPE" CHAR(10 BYTE),
"ACC_SEQNO" NUMBER,
"CATEGORY" CHAR(20 BYTE),
"CURRENCY" CHAR(3 BYTE),
"OTHER_CCY" CHAR(3 BYTE),
"CONTINGENT" CHAR(1 BYTE),
"INTRNAL" CHAR(1 BYTE),
"SHORTNAME" CHAR(15 BYTE),
"BO_ACCTNO" CHAR(34 BYTE),
"EXT_ACCTNO" CHAR(34 BYTE),
"IBAN" CHAR(34 BYTE),
"COUNTRY" CHAR(2 BYTE),
"DATEOPENED" DATE,
"DATECLOSED" DATE,
"DATEMAINT" DATE,
"DATE_DWNL" DATE,
"DESCR1" CHAR(35 BYTE),
"DESCR2" CHAR(35 BYTE),
"TYPEFLAG" NUMBER,
"TSTAMP" NUMBER
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 16384 NEXT 8724480 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM" ;
When I run the creation script against the Db directly, the table is created.
What could be the issue? How do I get the task to ignore errors and move to the next file whilst keeping a record of which files had errors.

Char and Varchar2 Columns showing Larger size in View

I have a table like:
Table
{
...
...
SETTLEMENTDAY VARCHAR2(10 CHAR)
ACCOUNT VARCHAR2(50 CHAR)
AMOUNT NUMBER(38,5)
CURRENCY VARCHAR2(3 CHAR)
...
...
}
When I am creating View using this table I am getting the following:
View
{
...
...
SETTLEMENTDAY VARCHAR2(40 CHAR)
ACCOUNT VARCHAR2(200 CHAR)
AMOUNT NUMBER(38,5)
CURRENCY VARCHAR2(12 CHAR)
...
...
}
There is no casting.
I am using Oracle 12.2.0.1.0.
I tried to use following alter query but not helping
alter session set nls_length_semantics=CHAR;
I am not able to understand why the size is getting multiplied by 4. Which variable in database could have affected that.
Thanks,

Where to put sql file in spring boot app for it to generate H2 database

It is not clear where to put the SQL file in order for my H2 database to be initialized.
in my application-h2.properties file I have:
# H2
spring.h2.console.enabled=true
spring.h2.console.path=/h2
# Datasource
#spring.datasource.url=jdbc:h2:file:~/test
spring.datasource.url=jdbc:h2:mem:testdb;Mode=Oracle
spring.datasource.platform=h2
spring.datasource.username=user
spring.datasource.password=user
spring.jpa.hibernate.ddl-auto=none
spring.datasource.continue-on-error=true
spring.datasource.initialization-mode=always
spring.datasource.driver-class-name=org.h2.Driver
spring.profiles.active=h2
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
My SQL file is pure oracle SQL generated from sqlDeveloper. I tried to cut and paste it in the H2 console but it didn't accept it. I am hoping this way will work.
------------------------update 1---------------------------
schema.sql
schema.sql]: CREATE SEQUENCE "foo"."ADDRESSID_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; nested exception is org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "CREATE SEQUENCE ""foo"".""ADDRESSID_SEQ"" MINVALUE[*] 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE"; SQL statement:
data.sql
data.sql]: CREATE SEQUENCE "foo"."ADDRESSID_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; nested exception is org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "CREATE SEQUENCE ""foo"".""ADDRESSID_SEQ"" MINVALUE[*] 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE"; SQL statement:
CREATE SEQUENCE "foo"."ADDRESSID_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE [42000-148]
Error
Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #3
This is the same sql file, I just renamed it. It has creates and inserts. However if I name it schema.sql or data.sql it still fails on the third line. It doesn't appear to fail when creating a user or schema.
------------------Update 2----------------
CREATE USER foo ifentified by foo;
CREATE SCHEMA foo;
CREATE TABLE foo.ADDRESS
(ADDRESS_ID NUMBER(22,0),
CUSTOMER_ID NUMBER(*,0),
COMPANY_NAME VARCHAR2(100 BYTE),
ADDITIONAL_ADDRESS_INFO VARCHAR2(100 BYTE),
STREET VARCHAR2(100 BYTE),
ADDITIONAL_STREET_INFO VARCHAR2(100 BYTE),
HOUSE_NUMBER VARCHAR2(20 BYTE),
ZIP VARCHAR2(20 BYTE),
CITY VARCHAR2(50 BYTE),
STATE VARCHAR2(20 BYTE),
COUNTRY_CODE CHAR(2 BYTE),
PHONE VARCHAR2(20 BYTE),
CREATED_AT TIMESTAMP (6) DEFAULT CURRENT_TIMESTAMP,
MODIFIED_AT TIMESTAMP (6) DEFAULT CURRENT_TIMESTAMP,
VALIDATED_AT TIMESTAMP (6),
VALIDATION_RESULT VARCHAR2(100 CHAR)
) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
COMMENT ON COLUMN foo.ADDRESS.ADDRESS_ID IS 'primary key for table address';
COMMENT ON COLUMN foo.ADDRESS.CUSTOMER_ID IS 'foreign key for table customer';
COMMENT ON COLUMN foo.ADDRESS.CREATED_AT IS 'initially created at';
COMMENT ON COLUMN foo.ADDRESS.MODIFIED_AT IS 'date of last modification';
Error
Syntax error in SQL statement "CREATE TABLE FOO.ADDRESS (ADDRESS_ID NUMBER(22,0), CUSTOMER_ID NUMBER(*[*],0), COMPANY_NAME VARCHAR2(100 BYTE), ADDITIONAL_ADDRESS_INFO VARCHAR2(100 BYTE), STREET VARCHAR2(100 BYTE), ADDITIONAL_STREET_INFO VARCHAR2(100 BYTE), HOUSE_NUMBER VARCHAR2(20 BYTE), ZIP VARCHAR2(20 BYTE), CITY VARCHAR2(50 BYTE), STATE VARCHAR2(20 BYTE), COUNTRY_CODE CHAR(2 BYTE), PHONE VARCHAR2(20 BYTE), CREATED_AT TIMESTAMP (6) DEFAULT CURRENT_TIMESTAMP, MODIFIED_AT TIMESTAMP (6) DEFAULT CURRENT_TIMESTAMP, VALIDATED_AT TIMESTAMP (6), VALIDATION_RESULT VARCHAR2(100 CHAR) ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING COMMENT ON COLUMN FOO.ADDRESS.ADDRESS_ID IS 'primary key for table address' "; expected "long"; SQL statement:
You should name the file data.sql and save it in src/main/resources folder. In this location the file will be detected and executed automatically. This, in the case that you want to leave default schema generation (as defined by your #Entity annotated classes).
If you want to generate also the schema manually you can create the file schema.sql where you put all the details for creating the schema.
edited answer after update 2.
you cannot use "
CREATE SEQUENCE "foo"."ADDRESSID_SEQ" ...
so try instead (foo is the schema-name)
CREATE SEQUENCE foo.ADDRESSID_SEQ START WITH 1 INCREMENT BY 1 MINVALUE 1 NOMAXVALUE NOCYCLE CACHE 20;
do'nt known if you can use NOORDER
use BIGINT instead of NUMBER(...) see ...expected "long"... in error.

sql*loader loading csv file with 3.5 million records

How can i load csv file with 3.5 million records into database table?
my csv file format:
code,doi,type,j_code,title,is_no,ib_no
"ETO072","10.10ISSN","J_ID","BEJ","ABCDEF","19-38","07-93"
"ETO073","10.11ISSN","J_ID","BEJ","NSKDJJ","19-39","07-94"
"ETO074","10.12ISSN","J_ID","BEJ","WEWDSD","19-40","07-95"
"ETO075","10.13ISSN","J_ID","BEJ","UOISDJ","19-41","07-96"
table structure:
CREATE TABLE CNTNT
( ID NUMBER,
code NUMBER,
TYPE VARCHAR2(255 BYTE),
is_no VARCHAR2(13 BYTE),
ib_no VARCHAR2(13 BYTE),
J_code VARCHAR2(255 BYTE),
TITLE VARCHAR2(1000 BYTE),
JCODE VARCHAR2(20 BYTE),
DOI VARCHAR2(255 BYTE),
PRIMARY KEY (ID),
);
control file:
load data
infile 'test.csv' "str '\n'"
append
into table CNTNT
fields terminated by ','
OPTIONALLY ENCLOSED BY '"' AND '"'
trailing nullcols
(
code,
DOI ,
TYPE,
J_CODE ,
TITLE ,
is_no,
ib_no,
ID "id_seq.nextval"
)
this is what i am using to run loader:
sqlldr CONTROL=test.ctl
LOG=test.log
BAD=test.bad
skip=1;
What are the changes i need to do in control file or sqlldr command to achieve this?

Invalid cast from Int32 to Decimal

I am using ODP.NET with EF in an MVC4 application. When performing the below operation,
_db.Set<User>().FirstOrDefault(x => x.Email == Email || x.DisplayName == DisplayName)
it throws exception
[Specified cast is not valid.] Oracle.DataAccess.Client.OracleDataReader.GetDecimal(Int32 i)
What I don't understand is that my User Object has no Int fields, I made them all decimal to smooth things over with Oracle DB.
My user table:
CREATE TABLE USERS (
USER_ID NUMBER(38) NOT NULL,
DISPLAY_NAME VARCHAR2(50 CHAR),
IS_LOCKED_OUT_FL VARCHAR2(1 CHAR),
IS_LOCKED_REASON VARCHAR2(256 CHAR),
IS_DELETED_FL VARCHAR2(1 CHAR),
EMAIL VARCHAR2(254 CHAR),
TITLE VARCHAR2(20 CHAR),
FIRSTNAME VARCHAR2(150 CHAR),
SURNAME VARCHAR2(150 CHAR),
DATECREATED DATE DEFAULT SYSDATE,
SCHEME_ID NUMBER(38),
STATUS VARCHAR2(20 CHAR) DEFAULT 'New',
PHONE VARCHAR2(20 CHAR) DEFAULT '',
PRODUCT_ID NUMBER(38) DEFAULT 0,
CONSTRAINT BCARD_USERS_PK PRIMARY KEY (USER_ID),
CONSTRAINT UK_BCARD_USERS UNIQUE (SCHEME_ID))
TABLESPACE SYSTEM
STORAGE (
INITIAL 64K
NEXT 1M
MAXEXTENTS UNLIMITED
)
I don't even know where to start debugging because the error is caused by ODP.NET and I can't step into the library. I should also mention that this doesn't happen on my 32-bit development machine, but the same code throws the exception on a 64-bit production machine
using the same 32-bit library. My project was built the target AnyCPU.
To be clear, the Int32 parameter of the GetDecimal method is the index of the column - it's throwing an error trying to convert column with index 'i'. It's not trying to convert anything to an int.
That said, my guess would be that your User object has a decimal field that's not nullable (decimal?), yet some of your columns like scheme_id and product_id allow nulls in the database.

Resources