My user is owner of a simple schema in an instance of Oracle in my Job, let´s call my USER E, with some resctinct privileges.
Also I have an USER E_ETL, to receive information of another database with ETL techonology.
My user E is the owner of some tables and a procedure DO_TRUNCATE (E.DOCUMENT_TASKS and E.DO_TRUNCATE), and the user E_ETL uses every day the procedure E.DO_TRUNCATE to clean all data inside my E.DOCUMENT_TASKS and insert the flash new information. But I´m having problems to GRANT user E_ETL to execute immediate the function to truncate table E.DOCUMENT_TASKS, the code and the error is those:
E.DOCUMENT_TASKS
CREATE TABLE "E"."DOCUMENT_TASKS"
(
"DOCUMENT" VARCHAR2(20 BYTE),
"REVISION" VARCHAR2(5 BYTE),
"TITLE" VARCHAR2(300 BYTE),
"STATUS" VARCHAR2(50 BYTE),
"TASK" VARCHAR2(120 BYTE),
"ETL_DATE" TIMESTAMP (6) DEFAULT SYSDATE NOT NULL ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "E_D_01" ;
The E.DO_TRUNCATE procedure code is:
create PROCEDURE DO_TRUNCATE ( ptname in varchar2)
as
begin
execute immediate 'truncate table '||upper(ptname);
end;
I alread gave some grants for E_ETL user:
GRANT SELECT, DELETE, INDEX, INSERT, REFERENCES, UPDATE ON E.DOCUMENT_TASKS TO E_ETL;
GRANT EXECUTE ON DO_TRUNCATE TO E_ETL;
But I still have this error information:
Database driver error...
Function Name : executeDirect
SQL Stmt : call DO_TRUNCATE ('DOCUMENT_TASKS')
Oracle Fatal Error
Database driver error...
Function Name : ExecuteDirect
Thanks all!!!
The error Database driver error... suggests that you might have an error connecting to the database; if so then you will need to sort that (but since you have not provided the error message then we cannot make suggestions).
Other issues could be:
Change CALL to Oracle's BEGIN END syntax:
BEGIN DO_TRUNCATE ('DOCUMENT_TASKS'); END;
If you are not connecting as the E user who owns the procedure and tables then make sure you include the schema name:
BEGIN E.DO_TRUNCATE ('E.DOCUMENT_TASKS'); END;
This is not Oracle error. Also it is saying about "executeDirect". Please elaborate more about the error
I'm trying to introduce new audit tables for our project. In the deployment process we use redgate's Schema Compare for Oracle (version 4.0.8.420).
The table looks something like this:
create table MY_SCHEMA.MY_TEST_AUDT (
TEST_ID NUMBER(19),
-- all sorts of business fields, omitted for clarity
AUDT_CRT_DTM TIMESTAMP DEFAULT SYSTIMESTAMP,
AUDT_ACTN_CODE VARCHAR2(1),
AUDT_CRT_USR_NM VARCHAR2(128) DEFAULT USER,
AUDT_CLIENT_IDENTIFIER VARCHAR2(256),
AUDT_CLIENT_INFO VARCHAR2(256)
)
TABLESPACE MY_TABLESPACE
PCTFREE 0
INITRANS 10
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
COMPRESS FOR OLTP
NOCACHE
PARTITION BY RANGE (AUDT_CRT_DTM)
INTERVAL(interval '1' month)
(
PARTITION P0 VALUES LESS THAN (date '2018-11-01')
PCTFREE 0
INITRANS 10
)
/
The first time I ran it I got an error concerning the storage clause
Parsing failed with message SyntaxError. Unexpected token 'K'
When I got rid of the storage clause (since I can use the defaults) it started complaining about the partitioning clause and that's where I am not very happy with the software.
Parsing failed with message SyntaxError. Unexpected token 'PARTITION' (Line 35, Col 1) symbol Id
I tried turning all the storage options on and off, nothing worked. I tried the latest version 5.2 with a simple compare of files and it didn't work either. I tried to post it on the redgate forums and my post has been stuck as drafted for two days now.
I'm using the scripts folder comparison, the above mentioned file for source and no file for the target, Oracle 11g scripts.
I have managed to get it working without the partition. I had to replace the slash with a semicolon and switch the 8K and 1M to the full values. But I'm still not able to create partitions.
create table MY_SCHEMA.MY_TEST_AUDT (
TEST_ID NUMBER(19),
-- all sorts of business fields, omitted for clarity
AUDT_CRT_DTM TIMESTAMP DEFAULT SYSTIMESTAMP,
AUDT_ACTN_CODE VARCHAR2(1),
AUDT_CRT_USR_NM VARCHAR2(128) DEFAULT USER,
AUDT_CLIENT_IDENTIFIER VARCHAR2(256),
AUDT_CLIENT_INFO VARCHAR2(256)
)
TABLESPACE MY_TABLESPACE
PCTFREE 0
INITRANS 10
STORAGE (
INITIAL 65536
NEXT 1048576
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
COMPRESS FOR OLTP
NOCACHE;
Any help is very much appreciated.
Alain
For completeness here's my DatabaseInformation.xml file
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<ScriptsFolderInformation version="2" type="ScriptsFolderInformation">
<DatabaseVersion>ElevenG</DatabaseVersion>
</ScriptsFolderInformation>
I asked the redgate support and got a reply.
It seems to work just fine when you work with the schemas directly (haven't tried it myself). The problem only happens when you do the scripts folder to scripts folder comparison.
To get the partition working you have to drop the NOCACHE keyword. Then everything is working.
Redgate now has a bug report for the support of those keywords (OC-1026)
Here's the version that works:
create table MY_SCHEMA.MY_TEST_AUDT (
TEST_ID NUMBER(19),
-- all sorts of business fields, omitted for clarity
AUDT_CRT_DTM TIMESTAMP DEFAULT SYSTIMESTAMP,
AUDT_ACTN_CODE VARCHAR2(1),
AUDT_CRT_USR_NM VARCHAR2(128) DEFAULT USER,
AUDT_CLIENT_IDENTIFIER VARCHAR2(256),
AUDT_CLIENT_INFO VARCHAR2(256)
)
TABLESPACE MY_TABLESPACE
PCTFREE 0
INITRANS 10
STORAGE (
INITIAL 65536
NEXT 1048576
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
COMPRESS FOR OLTP;
I have exported a database schema from an oracle 10.2.0.5.0 database with expdp, logged in as the owner of the schema.
Now I have tried to import the data on an Oracle 12.1.0.2.0 database impdp, logged in as sys with role sysdba.
The expdp command:
expdp "owner/password#hostname/servicename" schemas=SCHEMA_NAME directory=EXPDIR dumpfile=SCHEMA_NAME.dmp logfile=SCHEMA_NAME.log
The impdp command:
impdp "sys/password#hostname/servicename as sysdba" schemas=SCHEMA_NAME directory=EXPDIR dumpfile=SCHEMA_NAME.dmp logfile=SCHEMA_NAME.log
The import gave me the error message:
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
ORA-39014: One or more workers have prematurely exited.
ORA-39029: worker 1 with process name "DW00" prematurely terminated
ORA-31671: Worker process DW00 had an unhandled exception.
ORA-01000: maximum open cursors exceeded
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.PUT_DDLS [INDEX:"SCHEMA_NAME"."UK$SOME$NAME"]
CREATE UNIQUE INDEX "SCHEMA_NAME"."UK$SOME$NAME" ON "SCHEMA_NAME"."TABLE_NAME" ("COLUMN_NAME") PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "TBLSPC" PARALLEL 1
ORA-31625: Schema SYS is needed to import this object, but is unaccessible
ORA-00604: error occurred at recursive SQL level 2
ORA-01000: maximum open cursors exceeded
ORA-06512: at "SYS.KUPW$WORKER", line 9193
ORA-06512: at "SYS.KUPW$WORKER", line 22449
ORA-31625: Schema SYS is needed to import this object, but is unaccessible
ORA-00604: error occurred at recursive SQL level 2
ORA-01000: maximum open cursors exceeded
ORA-01000: maximum open cursors exceeded
ORA-39014: One or more workers have prematurely exited.
ORA-39029: worker 2 with process name "DW00" prematurely terminated
ORA-31671: Worker process DW00 had an unhandled exception.
ORA-01000: maximum open cursors exceeded
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.PUT_DDLS [INDEX:"SCHEMA_NAME"."IDX$SOME$OTHER_NAME"]
CREATE INDEX "SCHEMA_NAME"."IDX$SOME$OTHER_NAME" ON "SCHEMA_NAME"."OTHER_TABLE_NAME" ("OTHER_COLUMN_NAME") PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "TBLSPC" PARALLEL 1
ORA-31625: Schema SYS is needed to import this object, but is unaccessible
ORA-00604: error occurred at recursive SQL level 2
ORA-01000: maximum open cursors exceeded
ORA-06512: at "SYS.KUPW$WORKER", line 9193
ORA-06512: at "SYS.KUPW$WORKER", line 22449
ORA-31625: Schema SYS is needed to import this object, but is unaccessible
ORA-00604: error occurred at recursive SQL level 2
ORA-01000: maximum open cursors exceeded
ORA-01000: maximum open cursors exceeded
Job "SYS"."SYS_IMPORT_SCHEMA_13" stopped due to fatal error at Fri Dec 1 14:09:07 2017 elapsed 0 00:02:05
I have tried to increase the maximum number of open cursors, but it did not help.
With the option EXCLUDE=INDEX, the import runs without errors, but I need them too.
What can I try next?
ORA-01000: Maximum Open Cursors Exceeded During DataPump Import (IMPDP) In 12c
(Doc ID 2283800.1)
Last updated on AUGUST 08, 2017
Invoking Data Pump Import
Do not invoke Import as SYSDBA, except at the request of Oracle
technical support. SYSDBA is used internally and has specialized
functions; its behavior is not the same as for general users.
ORA-01000: Maximum Open Cursors Exceeded During DataPump Job Execution In 12c (Doc ID 2283800.1)
Cause
The value of OPEN_CURSOR is not set high enough.
When doing a DataPump import, the number of cursors depends on various factors including number of objects, partitions, indexes, recursive SQLs involved, etc. Also, on 12c, the internal processing of impdp is more complex than 10g, so it may need a higher open_cursor in order to finish the import job.
Solution
Increase OPEN_CURSORS temporarily to a value high enough like 2000 and redo the DataPump job.
I made terrible mistake in SQL index creation:
create index IDX_DATA_TABLE_CUSECO on DATA_TABLE (CUSTOMER_ID, SESSION_ID, CONTACT_ID)
tablespace IDX_TABLESPACE LOCAL ;
As You can see I missed keyword "ONLINE" to create index without blocking PRODUCTION table with high usage with 600m+ records. Corrected SQL is:
create index IDX_DATA_TABLE_CUSECO on DATA_TABLE (CUSTOMER_ID, SESSION_ID, CONTACT_ID)
tablespace IDX_TABLESPACE LOCAL ONLINE;
I was done it under PL/SQL Developer. When I was trying to stop it program stop responding and crashed.
Production system not working for 9 hours now and my boss wanna explode. :D
Is there any chance to see how many seconds/minutes/hours Oracle 11g left to process this index creation ? Or maybe is there any chance to see does Oracle still working on this request? (PL/SQL Developer crashed).
For haters:
I know I should do this like mentioned here: (source)
CREATE INDEX cust_idx on customer(id) UNUSABLE LOCAL;
ALTER INDEX cust_idx REBUILD parallel 6 NOLOGGING ONLINE;
You should be able to view the progress of the operation in V$SESSION_LONGOPS
SELECT sid,
serial#,
target,
target_desc,
sofar,
totalwork,
start_time,
time_remaining,
elapsed_seconds
FROM v$session_longops
WHERE time_remaining > 0
Of course, in a production system, I probably would have killed the session hours ago rather than letting the DDL operation continue to prevent users from accessing the application.
i,
I have one Materialized view on one server which is created by DB link .
There is one job running on that Mview.(craeted with dbms_refresh.make earlier).
Now I have craeted 3 new fields in original table.
there was job running on the Mview, I dropped the job by DBMS_refresh.destroy.
Then dropped the Mview ( i forgot to drop Indexes on view)
Now when i am trying to create the Mview with SQL which i sxtracted before,
It is giving error as :-
Error starting at line 1 in command:
CREATE MATERIALIZED VIEW TTMU_LAVORAZIONE_TT
TABLESPACE "TTSTAT_DATA"
LOGGING
PCTFREE 10
PCTUSED 40
INITRANS 1
MAXTRANS 255
STORAGE
(
INITIAL 5M
NEXT 5M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
)
NOCACHE NOPARALLEL BUILD IMMEDIATE
USING INDEX
REFRESH ON DEMAND FAST
WITH ROWID
DISABLE QUERY REWRITE AS
SELECT T288.C1,C2,C3,C4,C5,C6,C7,C8,C536870915,C536870916,C536870917,
C536870918,C536870919,C536870920,C536870921,C536870922,C536870927,
C536870928,C536870929,C536870930,C536870931,C536870932,C536870933,
C536870937,C536870939,C536870940,C536870941,C536870942,C536870945,
C536870951,C536870952,C536870953,C536870954,C536870955,C536870956,
C536870957,C536870959,C536870961,C536870962,C536870965,C536871100
FROM T288#STAT2TTM.WORLD
Error at Command Line:1 Column:0
Error report:
SQL Error: ORA-00600: internal error code, arguments: [17113], [0x000000000],
[], [], [], [], [], []
00600. 00000 - "internal error code, arguments: [%s], [%s], [%s], [%s],
[%s], [%s], [%s], [%s]"
*Cause: This is the generic internal error number for Oracle program
exceptions. This indicates that a process has encountered an
exceptional condition.
*Action: Report as a bug - the first argument is the internal error number
Error starting at line 26 in command:
CREATE UNIQUE INDEX I_SNAP$_TTMU_LAVORAZIONE_T
ON TTMU_LAVORAZIONE_TT (M_ROW$$ ASC)
TABLESPACE "TTSTAT_DATA"
LOGGING
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE
(
INITIAL 5M
NEXT 5M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
)
Error at Command Line:26 Column:0
Error report:
SQL Error: Closed Connection
the action is pretty clear:
*Action: Report as a bug - the first argument is the internal error number
This is an internal error. Follow instructions from Note [ID 153788.1] Troubleshoot an ORA-600 or ORA-7445 Error Using the Error Lookup Tool on Oracle support site.
You must:
- drop the snapshot/mview
- drop the snapshot log on the master table
- create a new snapshot log on the master table
- recreate your mview and simplify your create statement to the following:
CREATE MATERIALIZED VIEW TTMU_LAVORAZIONE_TT
TABLESPACE "TTSTAT_DATA"
REFRESH FAST START WITH SYSDATE NEXT SYSDATE + 5/1440
WITH ROWID
AS
SELECT T288.C1,C2,C3,C4,C5,C6,C7,C8,C536870915,C536870916,C536870917,
C536870918,C536870919,C536870920,C536870921,C536870922,C536870927,
C536870928,C536870929,C536870930,C536870931,C536870932,C536870933,
C536870937,C536870939,C536870940,C536870941,C536870942,C536870945,
C536870951,C536870952,C536870953,C536870954,C536870955,C536870956,
C536870957,C536870959,C536870961,C536870962,C536870965,C536871100
FROM T288#STAT2TTM.WORLD;
The above will add a refresh dbms_job that brings the table up-to-date every 5 minutes. You can change it to meet your requirements.
After you create it you must run:
exec dbms_snapshot.refresh("TTMU_LAVORAZIONE_TT",'C');
exec dbms_snapshot.refresh("TTMU_LAVORAZIONE_TT",'F');
That should take care of it. You will need to use an alternate method if the table is massive. I don't know the size so i'm assuming not too big.
Check the alert log for the database for clues as to what may be happening in your database. That will likely point you at one or more trace files where more information on the problem can be found. Sometimes you can resolve the problem on your own.