Oracle clean audit trails - oracle

I am trying to clean the unified audit trails using the plsql below
DBMS_AUDIT_MGMT.clean_audit_trail(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,
use_last_arch_timestamp => TRUE);
END;
/
ORA-01578: ORACLE data block corrupted (file # 19, block # 299907)
ORA-01110: data file 19: /home/oracle/oradata_tbs/kamobile/sysaux01.dbf
The file id 19 is under table CLI_SWP$80370d01$2$1 under AUDSYS schema, i tried to repair using the dbms_repair package and file is marked as mark_corrupt=TRUE, Finally i made the skip corrupt block.
I am trying to clean up the audit trail, but i always get the above error
And also the audit trails is not storing under the sys.unified_audit_trail table from then onwards.

Related

Error while giving grant to USER from SYS in ORACLE

I am connected to SYSDBA. I want to give access to user 'OFFC' to read and write on directory E:\oracle\extract.So,what I tried is:
CREATE OR REPLACE DIRECTORY EXTRACT_DIR AS 'E:\oracle\extract';
GRANT READ, WRITE ON DIRECTORY EXTRACT_DIR TO OFFC;
GRANT EXECUTE ON UTL_FILE TO OFFC;
What i got as error is:
Directory created.
GRANT READ, WRITE ON DIRECTORY EXTRACT_DIR TO OFFC
Error at line 2
ORA-00604: error occurred at recursive SQL level 1
ORA-12899: value too large for column "OT"."SCHEMA_AUDIT"."OBJECT_CREATED" (actual: 16, maximum: 15)
ORA-06512: at line 2
Why is this error coming when I tried to gave the access?
You must have have created the schema level trigger which keeps log of the newly created object in OT.SCHEMA_AUDIT.
In this table column OBJECT_CREATED stores the schema.object_name and data type of the column is somewhat VARCHAR2(15) or similar.
In your case, you are creating the object OFFC.EXTRACT_DIR (length:16) which is causing the issue.
Either disable the trigger or increase the Length of the OBJECT_CREATED column to around (257)
Cheers!!

Recover Oracle system01.dbf

When i trying to start oracle db, it says
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/oradata/oracle/system01.dbf'
When I trying to recover using redo logs, i've got
SQL> recover database using backup controlfile;
ORA-00279: change 4925223599 generated at 02/05/2018 10:24:32 needed for thread
1
ORA-00289: suggestion :
/mnt/backup/oracle/ORACLE/archivelog/2018_02_05/o1_mf_1_186975_%u_.arc
ORA-00280: change 4925223599 for thread 1 is in sequence #186975
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/oracle/redo01.log
ORA-00310: archived log contains sequence 186973; sequence 1
86975 required
ORA-00334: archived log: '/u01/oradata/oracle/redo01.log'
So, in the redo log i only have 186973 sequence. How can i revert all the oracle world to 186973 sequence and forget about next 2 seqs? I need to bring up the db anyhow and some chunk of last data i can lose.
Problem is solved by running
recover automatic database;
Yeah! That simple, thank you all

Access bfile from other oracle database

I have two Oracle databases using Oracle Standard Edition Two 12.1, DB1 and DB2.
DB1 contains the following table a FILE_TABLE:
ColumnName DataType
File_Id Number
File_Ref Bfile
I am storing Bfile into File_Ref of a FILE_TABLE table.
I want to access the Bfile from FILE_TABLE table and show it in DB2.
I have tried it using the database link. Using database link, I tried to do so:
SELECT FILE_REF FROM FILE_TABLE#dblink;
but it's giving an error: ORA-22992: cannot use LOB locators selected from remote tables
I also tried the DBMS_FILE_TRANSFER but when I researched on it, I got to know that we can only transfer System data files but not Bfile.
Is it true?
This is the syntax I used to transfer file:
DBMS_FILE_TRANSFER.put_file(
source_directory_object => 'db1_dir',
source_file_name => 'db1test.html',
destination_directory_object => 'db2_dir',
destination_file_name => 'db2test.html');
destination_database => 'db1_to_db2',
END;
/
But I was getting an error:
ORA-19505: failed to identify file "/db1_dir/db1test.html"
ORA-27046: file size is not a multiple of logical block size
Additional information: 1
ORA-02063: preceding 3 lines from db1_to_db2
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 37
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 132
ORA-06512: at line 2
00000 - "failed to identify file \"%s\""
*Cause: call to identify the file returned an error
*Action: check additional messages, and check if the file exists
Is there any way to do it using database link? Are there any other solutions to move a Bfile from one Database to other?
The ora-27046 is generally a sign that during the file transfer the file has been changed. This can be caused by firewalls. Have you verified with that the file is the same.
In addition when you get ora-27046 its not the only error, you get an error stack of several errors. It would be good to post the complete error stack. Also you don't mention which oracle release you are using.

Oracle CREATE spatial INDEX fails with "too many values"

When trying to create a spatial index on any SDO_GEOMETRY column (tried from multiple users, including SYS), Oracle fails with this statement:
Error at line 1
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-00913: too many values
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
The database is quite old and creating spatial indexes worked in the past (there are already existing ones that work). A sample of creating an index we used:
CREATE TABLE TEST_SPATIAL_INDEX (FID NUMBER, GEOM SDO_GEOMETRY);
INSERT INTO USER_SDO_GEOM_METADATA
VALUES ( 'TEST_SPATIAL_INDEX', 'GEOM',
MDSYS.SDO_DIM_ARRAY(
MDSYS.SDO_DIM_ELEMENT('X', 601000, 619000, 0.1),
MDSYS.SDO_DIM_ELEMENT('Y', 6116000, 6142000, 0.1),
MDSYS.SDO_DIM_ELEMENT('Z', -200, 200, 0.1)),
NULL);
COMMIT;
create index TEST_SPATIAL_INDEX_1 on TEST_SPATIAL_INDEX(GEOM) indextype is mdsys.spatial_index;
Running statement:
select * from registry$history;
returns:
25-02-2015 11:54:06.449000
APPLY SERVER
11.2.0.3 0
Patchset 11.2.0.2.0
PSU
We have two instances (SIDs) under one server (same ORACLE HOME for both) and the other one works. We can't find any visible difference in NLS parameters or Oracle version etc that would set them apart. Any ideas what might be wrong?
It can be caused by 3rd party backup software - "IBM Tivoli Storage Manager for Databases". There is versions where after online backup database is left in invalid state.
However after restarting oracle service indexes can be created, until backup breaks it again.

How to solve Oracle 9i to 11g migration KOREAN_LEXER problems?

I currently work at migrating an Oracle 9i database (*.dmp file) to an Oracle 11g one.
To achieve this I use the exp and imp Oracle utilities command lines:
exp USERID=<user>/<password>#<database> FILE=<path> OWNER=<owner>
Then I create a skeleton.sql file which will create tables, index tables and finally indexes.
imp <user>/<password>#<database> FILE=<path> INDEXFILE="<path>\skeleton.sql" FROMUSER=<fromuser> TOUSER=<touser>
During this migration I am able to import most of the data correctly, and of course tablespaces are kept the same from one database to the other to avoid any conflicts.
But here comes the problem. In Oracle 11g, KOREAN_LEXER is no longer supported, instead you have to use the KOREAN_MORPH_LEXER. To do so I execute the following SQL commands:
call ctx_ddl.create_preference('korean_lexer','korean_morph_lexer');
call ctx_ddl.add_sub_lexer('global_lexer','korean','korean_lexer',null);
Then I import the skeleton.sql file in order to inject the data needed before the import:
sqlplus <user>/<password>#<database> #<path>\skeleton.sql
The creation of tables and index tables go smoothly until I get the following error for each of the 150+ indexes I created:
CREATE INDEX "<schema>"."WORKORDER_NDX16" ON "WORKORDER"
ERROR at line 1 :
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-10502: WORKORDER_NDX16 index does not exist
DRG-13201: KOREAN_LEXER is no longer supported
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 366
Indexes are still created, this message is just a warning.
I try to rebuild any of the broken indexes:
ALTER index WORKORDER_NDX16 REBUILD;
Which give me the following error again:
SQL Error : ORA-29874: warning in the execution of ODCIINDEXCREATE routine
ORA-29960: ligne 1,
DRG-10595: failure on ALTER INDEX WORKORDER_NDX16
DRG-50857: oracle error in drixmd.PurgeKGL
ORA-20000: Oracle Text error:
DRG-13201: KOREAN_LEXER is no longer supported
ORA-30576: ConText Option dictionary loading error
DRG-50610: internal error: kglpurge []
29874. 00000 - "warning in the execution of ODCIINDEXALTER routine"
*Cause: A waring was returned from the ODCIIndexAlter routine.
*Action: Check to see if the routine has been coded correctly
Check the user defined warning log tables for greater details.
In my skeleton.sql file, under the creation of each indexes, I have the following lines for each language:
ctxsys.driimp.set_object('LEXER','MULTI_LEXER',12);
...
ctxsys.driimp.set_sub_value('SUB_LEXER','8', NULL, NULL,'KO:KOREAN_LEXER:');
...
So far I am lost on what to do, this seems to be a simple issue to solve but my dba skills are too low to do this on my own.
If anyone could help me on this I would greatly appreciate it !
Thank you.
This looks like your database is using Oracle Text indexes, which are not the same as ordinary indexes. Have you followed completely Oracle Note 300172.1 (Obsolescence of KOREAN_LEXER Lexer Type)? It mentions this code below, which could help.
ALTER INDEX <[schema.]index> REBUILD
PARAMETERS('REPLACE LEXER ko_morph_lexer [MEMORY <size>]');
If all else fails, maybe consider trying to migrate your data into an Oracle 10g database and complete the korean_morph_lexer in 10g. If that works, it would be an easy Data Pump task to move it from 10g to 11g (or 12c).

Resources