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;
Related
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 am facing this error, and due to this error, the whole system seems to be going down. After checking logs and all, I found out that one destination tables might be the problem.
This is the error:
MERGE INTO vacations vac
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [kdtigetrow-2], [25], [40], [39],
[], [], [], [], [], [], [], []
This is the source table:
create table TEMP_VACATIONS
(
idd VARCHAR2(10),
start_date VARCHAR2(10),
end_date VARCHAR2(10),
day_count VARCHAR2(10),
vac_type VARCHAR2(10),
arrival_date DATE
)
This is the destination table:
create table VACATIONS
(
user_id NUMBER(10) not null,
start_date DATE not null,
end_date DATE not null,
days_count NUMBER(3) not null,
vacation_type INTEGER,
arrival_date VARCHAR2(20),
idd NUMBER(10)
)
alter table SPENT_VACATIONS
add constraint SPENT_VACATIONS$PK primary key (USER_ID, START_DATE)
using index
tablespace ARCV25
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 320K
next 1M
minextents 1
maxextents unlimited
);
and this is the script:
MERGE INTO vacations vac
USING temp_vacations tmpvac
ON (vac.user_id = TO_NUMBER(tmpvac.idd) AND vac.start_date = TO_DATE(tmpvac.start_date, 'dd.mm.yyyy') AND vac.end_date = TO_DATE(tmpvac.end_date, 'dd.mm.yyyy'))
WHEN NOT MATCHED THEN
INSERT (vac.user_id, vac.start_date, vac.end_date, vac.days_count, vac.vacation_type, vac.arrival_date)
VALUES (TO_NUMBER(tmpvac.idd), TO_DATE(tmpvac.start_date, 'dd.mm.yyyy'), TO_DATE(tmpvac.end_date, 'dd.mm.yyyy'), tmpvac.day_count, tmpvac.vac_type, TO_CHAR(tmpvac.arrival_date, 'dd.mm.yyyy'))
LOG ERRORS INTO stara.migration_err('File: STARA_EHR.SPOLO.TXT => merge operation => annual_vacations') REJECT LIMIT UNLIMITED;
COMMIT;
The oracle version is:
Oracle Database 11g Release 11.2.0.2.0
Is it possible that this error comes during type conversation (char => date or char => number) ?
How can I fix that internal error as well? Do I need to rollback the database to previous backup?
Thanks in advance.
ORA-00600 is Oracle's generic code for signalling unexpected internal behaviour (i.e. bugs). The standard advice is to contact Oracle Support, as by the nature of these things, they tend to be very specific to database version, platform and a whole host of other variables. There is a distinct possibility that you need a patch to fix this problem, or perhaps just an upgrade to the latest version.
Of course, if you don't have a Support contract that advice is not very useful. Unfortunately it's hard for us to be more helpful. There should be further information in the Alert Log, and there may be a trace file too. You'll probably have to ask a DBA to help you with it.
Otherwise you can try searching the internet. The first parameter indicates the specific event i.e. [kdtigetrow-2]. I did find this article on a blog but the writer's scenario appears to be very different from your own.
We have upgraded the Oracle db to 11.2.0.3 with latest patch 21. Now all is working good :-)
This sounds like an index corruption. Disable the constraint, drop the index, recreate the index and enable the constraint again.
I would like to use parallel execution on LET_TESTATE_LETTURE without forcing the full table scan, I want to use force the parallelism on index.
How can I solve?
alter session enable parallel dml;
CREATE TABLE netatemp.let_testate_letture1
AS
SELECT /* parallel(tele 32) full(tele) */
tele.TELE_DATA_LETTURA,
tele.tele_storico_id
FROM let_testate_letture tele
WHERE tele.prov_provenienza_lettura_id = '*1ENI01BCAMBIO'
AND tele.spwkf_stato_pubblico_id != '*1UNICOANN';
Size 56,1 GB
Number Extents 1.081
OWNER SIUMETERING
TABLE_NAME LET_TESTATE_LETTURE
TABLESPACE_NAME SIUMETERING_DATITD
CLUSTER_NAME
IOT_NAME
STATUS VALID
PCT_FREE 10
PCT_USED
INI_TRANS 30
MAX_TRANS 255
INITIAL_EXTENT 80 KB
NEXT_EXTENT 1 MB
MIN_EXTENTS 1
MAX_EXTENTS 2.147.483.645
PCT_INCREASE
FREELISTS
FREELIST_GROUPS
LOGGING YES
BACKED_UP N
NUM_ROWS 456.635.338
BLOCKS 3.340.120
EMPTY_BLOCKS 0
AVG_SPACE 0
CHAIN_CNT 0
AVG_ROW_LEN 385
AVG_SPACE_FREELIST_BLOCKS 0
NUM_FREELIST_BLOCKS 0
DEGREE 1
INSTANCES 1
CACHE N
TABLE_LOCK ENABLED
SAMPLE_SIZE 456.635.338
LAST_ANALYZED 29/12/2012 13:03:15
PARTITIONED NO
IOT_TYPE
TEMPORARY N
SECONDARY N
NESTED NO
BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
ROW_MOVEMENT DISABLED
GLOBAL_STATS YES
USER_STATS NO
DURATION
SKIP_CORRUPT DISABLED
MONITORING YES
CLUSTER_OWNER
DEPENDENCIES DISABLED
COMPRESSION ENABLED
COMPRESS_FOR OLTP
DROPPED NO
READ_ONLY NO
SEGMENT_CREATED YES
RESULT_CACHE DEFAULT
you have to alter the index to parallel. ie
alter index xxx parallel;
or
alter index xxx parallel <n>;
as the parallel hint only applies to tables.
Try
/*+ parallel_index(tele, let_tele_letb_prov_fk_idx, 32) */
Notice the "+" after the asterisk. Without it Oracle will ignore the hint.
Also, you may want to create the table in parallel as well depending on the nr of rows returned, like:
CREATE TABLE netatemp.let_testate_letture1 parallel 32 as
select /*+ ...
You posted a lot of useful information, which is very refreshing. So in addition to answering your question, I can provide
other advice for improving performance:
Statement-level hint.
Since you are on 11gR2 (based on the existence of the column SEGMENT_CREATED), you should use a
statement-level parallel hint, instead of an object-level. Use /*+ parallel(32) */, and then Oracle will parallelize everything in the query, regardless of the access method or the alias names.
Old stats or old data?
Last Analyzed on 2012-12-29 seems kind of old. If your table is very active, then you should re-gather statistics. If it really doesn't change very often, you may want to consider re-creating it, ordered by prov_provenienza_lettura_id. That may significantly improve the performance of your index. Although it could decrease performance of other indexes.
Compression.
Your table uses compression, but is your index also compressed? If you really have 9 million entries for the same value, index compression could save a huge amount of space, and make index reads much faster. Also, a bitmap index may be a good fit here.
Full table scans.
The optimizer thinks you're going to read about 2% of your rows. Even 2% may be enough to warrant a full table scan, depending on things such as the clustering factor. You may not want to try to force a specific access method - first let Oracle try to pick. If Oracle gets it wrong, then you should try to help it by providing more useful information, such as better statistics and maybe a histogram.
The advice from DazzaL and Ronnis should also be helpful.
I've traced a bug in my Java EE application to the Oracle database: there is a materialized view which is not refreshing correctly. If I do a query against the MV, it gives me foreign keys which are bad and appear to be old.
So how can I fix or replace this materialized view? Any thoughts are welcome.
I tried refreshing manually, like this:
DBMS_MVIEW.REFRESH('PRODUCTDESCRIPTIONS', 'C');
I got the error "ORA-00942: table or view does not exist". I don't understand this, because when I run the MV's subquery by hand, it looks fine.
The Apex Web interface indicates that the MV has not refreshed for over a year, so this is not a new problem.
I looked for any logging from the refresh process, but couldn't find the file refresh.log.
I've tried replacing the materialized view with a simple query, but it's too slow. I'd be happy to rewrite/reconfigure/reinstall the MV somehow.
Database and OS version:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
uname -a:
Linux <server name> 2.6.9-78.0.22.ELsmp #1 SMP Thu Apr 30 19:14:39 EDT 2009 i686 i686 i386 GNU/Linux
Source code for the materialized view:
CREATE MATERIALIZED VIEW "PRODUCTDESCRIPTIONS"
ORGANIZATION HEAP 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)
TABLESPACE "USERS"
BUILD IMMEDIATE
USING INDEX
REFRESH COMPLETE ON DEMAND
USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS SELECT prdcts.primarykey AS product,
prdcts.upcid AS productupcid,
prdcts.description AS productdescription,
prdctctgrs.primarykey AS productcategory,
prdctctgrs.id AS productcategoryid,
prdctctgrs.name AS productcategoryname,
prdctpkgs.primarykey AS productpackage,
prdctpkgs.name AS productpackagename FROM prdctctgrs,
prdcts,
prdctpkgs,
prdctctgrstoprdcts,
prdctstoprdctpkgs
WHERE
prdctctgrstoprdcts.productcategory = prdctctgrs.primarykey
AND prdctctgrstoprdcts.product = prdcts.primarykey
AND prdctstoprdctpkgs.product = prdcts.primarykey
AND prdctstoprdctpkgs.productpackage = prdctpkgs.primarykey
AND bitand(prdctctgrs.metaflags, 1)+0 = 0
AND bitand(prdcts.metaflags, 1)+0 = 0
AND bitand(prdctpkgs.metaflags, 1)+0 = 0
AND bitand(prdctctgrstoprdcts.metaflags, 1)+0 = 0
AND bitand(prdctstoprdctpkgs.metaflags, 1)+0 = 0
/
When you run the refresh procedure, are you executing it as the owner of the tables you're selecting from? Are all of the tables you're accessing directly granted to you? If the tables are granted to you via roles, then the refresh procedure won't be able to see them.
Just to confirm my comment on the original question: dropping and recreating the MV fixed the problem.
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.