ORA-20024: REST enablement for maintained schema disallowed - oracle

I have set in ORDS without APEX when I try to enable the schema, I get an error. What am I doing wrong?
BEGIN
ORDS.ENABLE_SCHEMA(p_enabled => TRUE,
p_schema => 'DEVUSER',
p_url_mapping_type => 'BASE_PATH',
p_url_mapping_pattern => 'devuser',
p_auto_rest_auth => FALSE);
commit;
END;
Error report -
ORA-20024: REST enablement for maintained schema disallowed : DEVUSER
ORA-06512: на "ORDS_METADATA.ORDS", line 183
ORA-06512: на "ORDS_METADATA.ORDS_INTERNAL", line 281
ORA-06512: на "ORDS_METADATA.ORDS_INTERNAL", line 688
ORA-06512: на "ORDS_METADATA.ORDS_INTERNAL", line 640
ORA-06512: на "ORDS_METADATA.ORDS_INTERNAL", line 779
ORA-06512: на "ORDS_METADATA.ORDS", line 167
ORA-06512: на line 3

The most probable cause is because the schema has been created as an Oracle Maintained user. An Oracle Maintained user cannot be enabled for ORDS based REST services.
In order to correct this problem, you must delete and recreate the target schema.
1.To drop the user:
alter session set "_ORACLE_SCRIPT"=true;
drop user DEVUSER;
alter session set "_ORACLE_SCRIPT"=false;
2.Recreate the user:
create user DEVUSER identified by <PASSWORD>;
grant create session to <SCHEMA>;
Perform any other grants needed for this user. If you have data to save, export it first ( using Datapump, for example ) and import it back again.

Related

Cannot create multi-column text index in Oracle

I'm trying to create a multi-column full-text index in Oracle but can't get it working. Here's what I have so far:
CREATE TABLE DOCS (
DOCS_ID NUMBER(32,0) NOT NULL,
COLA NVARCHAR2(100),
COLB NVARCHAR2(100),
COLC NVARCHAR2(100)
);
CALL ctx_ddl.create_preference('DOCS_MC_DATASTORE', 'MULTI_COLUMN_DATASTORE');
CALL ctx_ddl.set_attribute('DOCS_MC_DATASTORE', 'COLUMNS', 'COLA, COLB, COLC');
CREATE INDEX DOCSINDEX ON DOCS(COLA) INDEXTYPE IS ctxsys.context parameters ('DATASTORE DOCS_MC_DATASTORE sync(on commit)');
This return the following errors:
SQL Error [29855] [99999]: ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-11135: feature not generally available
ORA-06512: at "CTXSYS.DRUE", line 186
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 338
Update
Ignore the multi-column issue, can't even get the index to work:
CREATE INDEX DOCSINDEX ON DOCS(COLA) INDEXTYPE IS ctxsys.context;
Reports the exact same error. This is Oracle Express 21. Do I need to add something to the install?
In case anyone finds this. Can't use text indexing with Unicode NVARCHAR/NCHAR/NCLOB.

Oracle Text truncate words to 64 CHARS but token limit is 64 BYTES

I'm using Oracle 19c.
I have a table with a VARCHAR2(4000) column for which I'm creating a full-text index using Oracle Text.
The SQL creating the index is as follow:
begin
ctx_ddl.create_index_set('ix_iset');
ctx_ddl.create_preference('ix_pref', 'BASIC_LEXER');
ctx_ddl.set_attribute('ix_pref', 'skipjoins', '-');
ctx_ddl.set_attribute ( 'ix_pref', 'index_stems', 'portuguese');
ctx_ddl.set_attribute ( 'ix_pref', 'index_text', 'YES');
ctx_ddl.set_attribute ( 'ix_pref', 'base_letter', 'YES');
end;
CREATE INDEX ix_tx_column ON MYTABLE(tx_column)
INDEXTYPE IS CTXSYS.CTXCAT
PARAMETERS ('index set ix_iset lexer ix_pref');
Everything works very well, but when there is a word with more than 64 chars, an error is raised:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text Error:
DRG-50857: oracle error in dreii1fsh
ORA-12899: value too large for column "CAD"."DR$IX_TX_COLUMN$I"."DR$TOKEN" (actual: 65, maximum: 64)
ORA-06512: em "CTXSYS.DRUE", line 186
ORA-06512: em "CTXSYS.CATINDEXMETHODS", line 102
29855. 00000 - "error occurred in the execution of ODCIINDEXCREATE routine"
*Cause: Failed to successfully execute the ODCIIndexCreate routine.
*Action: Check to see if the routine has been coded correctly.
I've looked into the documentation and the only reference to this limitation is this item:
2.14 Token Limitations for Oracle Text Indexes
After some research I realized that probably the Oracle-Text internal functions are truncating the words to 64 CHARS, but the token limit is 64 BYTES.
The text word causing this error have Diacritical Characters within its first 64 chars like ç ã õ é and so on... Each char are 2 bytes in size.
I tried to set NLS_LENGTH_SEMANTICS=BYTE with no success.
As long as I researched, there is no way how to change the size of the index token.
Edit:
The result of SELECT * FROM v$nls_parameters is:

Oracle column in table mysteriously changing value

I have a server_password column in my table server_services.
I'm using a package to encrypt/decrypt the password.
This sometimes fails with an internal Oracle error message and is what I am investigating. I believe the error message is oracle's way of telling me the password or encrypted value is wrong.
The password is stored in a type VARCHAR2(100 BYTE) column; the encode/decode functions work with utl_raw.cast_to_raw and utl_raw.cast_to_varchar2 and take and give a varchar2.
When looking at the password, it is looking strange, with many boxes indicating non-printable characters.
Now my problem is that the decryption works, but then starts failing.
To investigate this, I calculated a hash of the encrypted password:
select rawtohex(
DBMS_CRYPTO.Hash (
UTL_I18N.STRING_TO_RAW (SERVER_PASSWORD, 'AL32UTF8'),
2)
)
FROM SERVER_SERVICES;
What is strange is that suddenly the hash changes, and there is no code that is supposed to do that. And I'm also not touching the table data manually.
-- doesn't work:
-- D40D0635FAC75F47DE5164F0EF50A2DB
-- regenerated password
-- works
-- 41136DFB85EFEDAC08150A8959923422
-- waited some time
-- doesn't work again
-- D40D0635FAC75F47DE5164F0EF50A2DB
Do you have any idea what is causing this and how to prevent it?
The oracle error message and code:
ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
ORA-06512: at "SYS.DBMS_CRYPTO", line 44
ORA-06512: at "XXX_CONFIGURATION.ENCRYPT_DECRYPT_PASSWORD", line 32
ORA-06512: at "XXX_CONFIGURATION.ENCRYPT_DECRYPT_PASSWORD", line 65
ORA-06512: at line 1
I tried to look at the package, but it is "wrapped":
"PACKAGE BODY dbms_crypto_ffi wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
b
228a 312
2L+V7+Eg9BLQ+XmmDXawGjt9NCkwg811r9yGfC9ArU6O79zKUmj9ScZSugr0ScKkyrBaaS8K
RM2eU4oiAJ+r4d4lezkNE6wQ5Yqan2461E6wiGvHZQEvOHHdBvzuJjQ/5PjBOr9CEvi243t6
Nusbvg7sjKYbTVZlssZ/s90CpB2h0dzVXMQpZhJcAfTFvlB+l117gW6UHTxdwaXcMgkKFOu+
jmGw/I+etGPJCcg2NqGIdnOS/tLPTjDD8Mmi7CKC2I91UUJNDFVV10G4Y6hD7Sg8Wr7jrWyr
bE19xjlMFdvDcopkNK4XDwXyXv0yShDNbaQwiWB79aHGzH6gOUhVWqS6eHvGPCrT/4GrTPbt
bFS90BT3RMN3Cybzt62xAVVModFTWF5e9WFZnFlmAVLRMZjPzFy8cOI1ypXYqRavEaSGDhQQ
As+M/5avOclUIBg7+k0ST18JEIgBSpxwlEG5dPir5MlGdwiukLMO3PDLfUdLorLyDnU5Zhjx
5d2qj6rP5MQ7zEeDPIV5bUC6ZsSkmw3mbXACrJSDJpQj2dBk3gJva4421V2iVZoGNvkdtRLJ
AsmiXJk/hZ5CMXWYICcL+Q81D/1dLpzrF4zPtSkWu5tRBDi4NNnc47Qz7zzLk/KnREgMmtCH
7hLnDweY0QjvUyF750ixx+IvKebAnUiJZwkHGqS1mP2lkvIwDTrxott1qzSiQTMvBlwez/KQ
VUhaBP1VHM7LGFfBfna8hnu0SiD311nbL4AmxR4+t70k2jD7+XS+Vg==
"

ORA-20010: DBMS_STATS INTERNAL ERROR in fill_cstats : both dmin/dmax and nmin/nmax are null for table SOA , column KEY , ssize 29892

ORA-20010: DBMS_STATS INTERNAL ERROR in fill_cstats : both dmin/dmax and nmin/nmax are null for table SOA, column KEY , ssize 29892
ORA-06512: at "MOSTI", line 165
ORA-06512: at line 1
The above error occurred in production, can someone please explain why it has occurred and solution?
It seems due to an oracle internal bug.
ORA-20010: DBMS_STATS INTERNAL ERROR In Fill_cstat During Analyze A
Table (文档 ID 2247315.1)
Getting following error when gathering the table statistics:
EXEC DBMS_STATS.gather_table_stats(ownname => 'S', tabname => 'TEST',
estimate_percent => 100, cascade => TRUE, granularity=> 'ALL', degree
=> 2, no_invalidate=>FALSE);
* ERROR at line 1: ORA-20010: DBMS_STATS INTERNAL ERROR in fill_cstats : both dmin/dmax and nmin/nmax are null for table S.TEST , column
FIRST_NAME , ssize 430241 ORA-06512: at "SYS.DBMS_STATS", line 34757
ORA-06512: at line 1
The bug is fixed in 12.2
Workaround for the bug is to delete statistics and re-gather statistics
If the above workaround does not work, another potential workaround is using parallel degree of 1:
SYS#EXEC DBMS_STATS.gather_table_stats(ownname => 'SCOTT', tabname => 'TEST', estimate_percent => 100, cascade => TRUE, degree => 1);
but it matches oracle 12.1

Associating job with job class

I'm attempting to create a job using DBMS_SCHEDULER in an Oracle 11g DB but having some trouble setting the job class attribute. I have already looked in the SYS schema and there is a job class named "SCHED$_LOG_ON_ERRORS_CLASS" that only outputs to the log if a job fails, which is what I want instead of having it log every time the job succeeds. Here is the script I am using to create the job:
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'DIRXML.CHECK_EVENTLOG',
job_type => 'STORED_PROCEDURE',
job_action => 'DIRXML.P_Check_Eventlog',
job_class => 'DIRXML.SCHED$_LOG_ON_ERRORS_CLASS',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=30',
enabled => TRUE
);
END;
/
The script will execute without errors if I remove the job_class attribute but when I add it I get the following error:
ORA-27476: "SYS.SCHED$_LOG_ON_ERRORS_CLASS" does not exist ORA-06512:
at "SYS.DBMS_ISCHED", line 124 ORA-06512: at "SYS.DBMS_SCHEDULER",
line 271 ORA-06512: at line 2
The only thing I could think of is that permissions aren't set up correctly for my user?
It looks like there wasn't a public execute grant on that specific job class, which explains why it wasn't finding it.

Resources