Oracle 11g R1: How to create indexes automatically in tablespaces?
Hello,
Obviously, due to maintenance and performance reasons it is better to put indexes in own tablespaces, separated from the data.
I would like to know now whether there is a way under Oracle 11g R1 to create every index automatically in a tablespace?..or the indexes can only be created manually?
Unfortunately i wasn't able to find any hint in the documentation or by googlin' it.
Thanks in advance.
Regards,
Lars
Hi Lars
I wouldn't be quite so sure having a separate tablespace just for indexes is better for either performance or maintenance reasons if I were you ...
For your enjoyment, some reasons why this simply is not true:
http://richardfoote.wordpress.com/2008/04/16/separate-indexes-from-tables-some-thoughts-part-i-everything-in-its-right-place/
http://richardfoote.wordpress.com/2008/04/18/separate-indexes-from-tables-some-thoughts-part-ii-there-there/
http://richardfoote.wordpress.com/2008/04/28/indexes-in-their-own-tablespace-availabilty-advantages-is-there-anybody-out-there/
http://richardfoote.wordpress.com/2008/05/02/indexes-in-their-own-tablespace-recoverability-advantages-get-back/
Cheers
Richard Foote
http://richardfoote.wordpress.com/
Similar Messages
-
How to create indexes on ODS ?
Hello friends ,
Need some help .
Could any one please let me know how to create indexes on ODS ?
How Indexes are useful on ODS ?
Thanks in advance
RegardsDear Akshay,
Below is the information about indexes and there creation for ODS.
You can search a table for data records that satisfy certain search criteria faster using an index.
An index can be considered a copy of a database table that has been reduced to certain fields. This copy is always in sorted form. Sorting provides faster access to the data records of the table, for example using a binary search. The index also contains a pointer to the corresponding record of the actual table so that the fields not contained in the index can also be read.
The primary index is distinguished from the secondary indexes of a table. The primary index contains the key fields of the table and a pointer to the non-key fields of the table. The primary index is created automatically when the table is created in the database.
You can also create further indexes on a table in the ABAP Dictionary. These are called secondary indexes.Under Indexes, you can create secondary indexes by using the context menu in order to improve the load and query performance of the ODS object This is necessary if the table is frequently accessed in a way that does not take advantage of the sorting of the primary index for the access.
The database system sometimes does not use a suitable index for a selection, even if there is one. The index used depends on the optimizer used for the database system. You should therefore check if the index you created is also used for the selection (see How to Check if an Index is Used).).
Creating an additional index could also have side effects on the performance. This is because an index that was used successfully for selection might not be used any longer by the optimizer if the optimizer estimates (sometimes incorrectly) that the newly created index is more selective.
The indexes on a table should therefore be as disjunct as possible, that is they should contain as few fields in common as possible. If two indexes on a table have a large number of common fields, this could make it more difficult for the optimizer to choose the most selective index.
Leaving content frame.
With Regards,
Prafulla Singh -
How to create indexes using CREATE TABLE statement
Hi,
Can anyone please tell me how to create indexes using CREATE TABLE staement? This point is part SQL Expert exam (1Z0-047) and please guide me to use which books for this particular exam.
Thanks in advance.Can anyone please tell me how to create indexes using CREATE TABLE staement?e.g. creating a primary key or a unique constraint will generate indexes along with the create table syntax:
SQL> create table t (a integer primary key, b integer unique)
Table created.
SQL> select index_name, index_type, uniqueness
from user_indexes
where table_name = 'T'
INDEX_NAME INDEX_TYPE UNIQUENES
SYS_C0016575 NORMAL UNIQUE
SYS_C0016574 NORMAL UNIQUE
2 rows selected. -
How to reorganization index in new tablespace
How to reorganization index in new tablespace? for size? for? number of extents? or both?
What's Oracle version?
Why you want to reorg your index?
You could rebuild your index
alter index <index_name> rebuild tablespace <tablespace_name>check Jonathan's note regarding index rebuild,
http://jonathanlewis.wordpress.com/2008/02/09/index-rebuild-10g/ -
How to create an automatically increment column in Oracle DB Table?
Hi To All
Here I am trying to create a table in Oracle that creates an automatically increment column in Oracle DB Table. i searched almost all Forums.(Even in Oracle). They are saying that, that logic u must implement in Java Code.(*Takes Maximum no from table, add +1 to it, and store it back again)*. apart from this, while creating an table in Oracle, is there any facility like MySQL Database? please help me. Thanks in advance.Hi BalusC
Thanks for Your Response and clue. with that, i succeeded in my application. Thank you very much. here i am giving you the details which i did.
1. I Created a table named orders in Oracle like this.
CREATE TABLE ORDERS (ORDER_ID NUMBER, CUSTOMER_ID NUMBER, ISBN NUMBER,
DESCRIPTION NCHAR(5));
2. I created one sequence in Oracle like CREATE SEQUENCE SEQ01 INCREMENT BY 1 START WITH 1000 3. Then i have written jdbc program like this
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class SequenceTest {
public static void main(String[] args)throws Exception{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
String cols[] = {"ORDER_ID", "DESCRIPTION"};
PreparedStatement pstmt = con.prepareStatement("INSERT INTO ORDERS (ORDER_ID, CUSTOMER_ID, ISBN,DESCRIPTION) VALUES (SEQ01.NEXTVAL, 104, 966431505,?)", cols);
pstmt.setString(1,"Desc3");
pstmt.executeUpdate();
ResultSet rs=pstmt.getGeneratedKeys();
System.out.println("---- One Row Inserted ----");
} catch (Exception e) {
System.out.println("---- Failed Due To "+e);
4. When i ran above program 5 times, i got the following Data into my Oracle Table (select * from orders)
ORDER_ID CUSTOMER_ID ISBN DESCR
1000 101 966431502 Desc0
1001 102 966431503 Desc1
1002 103 966431504 Desc2
1003 104 966431505 Desc3
1004 104 966431505 Desc3
1005 105 966431506 Desc4
6 rows selected.
But i dont know how to do this type of program with out using prepared statements. i tried, and i got exception *"Missing Expression"* .
Once again Thank You very much for your clue. -
How to create index not unique at the time of the CREATE TABLE
Hi,
I am trying to find out how in Oracle create secondary indexes that can accept duplicated into the CREATE TABLE statement, without have to execute a CREATE INDEX separately.
As far I can see the only syntax accepted by Oracle 9i to create more than one index at the time of the table creation is:
CREATE TABLE test_tab (x INTEGER, y INTEGER, z INTEGER PRIMARY KEY(x,y), UNIQUE(z))
But, in my case I need to have the unicity only for the primary key, but not for the second index, that I would like to have not unique.
How to do that inside of the CREATE TABLE statement?
Any help?
Thanks a lot in advance.To create an index automatically (not constraint related) , you will need to have an 'event' trigger on the schema that will (IE: detecting a table create/drop matching ARCHIVE_%) , generate the appropriate SQL required (create index sql) and pass THAT to a DBMS_JOB.
Make sure you have job queue's enabled.
This was the ONLY way that I could re-create a view automatically as new tables were created that matched a criteria IE ARCHIVE_JAN06, ARCHIVE_FEB06 etc.
The application's "archiving" method created and was thus aware of these tables and permitted searching within 'archived' data, but 3rd party reporting applications needed to see a view encompassing all data, regardless of the tables involved. The view automatically created was a 'union_all' of all tables concerned. -
How to create index on a single parition
Hi,
I have a table which has got 7 partitons,I want to index only one partition how do it?
i am using oracle 11g.Also i want to know if it is possible to create an index within a o partiotn only fr some values..
Edited by: user8731258 on Jul 13, 2012 12:35 AMHi,
I've been thinking a bit about your requirement.
One way could be to use the fact that index do not "store" nulls.
Let's make a table with data :SQL> create table t
2 (
3 grp integer,
4 id integer,
5 val varchar2(10)
6 )
7 partition by range(grp)
8 (
9 partition p01 values less than (2)
10 ,partition p02 values less than (3)
11 ,partition p03 values less than (4)
12 ,partition pXX values less than (maxvalue)
13 );
Table created.
SQL> insert into t select 1+mod(level,4), level, dbms_random.string('a',10) from dual connect by level <= 200000;
200000 rows created.
SQL> select grp, count(*) cnt from t group by grp order by grp;
GRP CNT
1 50000
2 50000
3 50000
4 50000
SQL> select grp, count(*) cnt from t group by grp order by grp;
GRP CNT
1 50000
2 50000
3 50000
4 50000
SQL> begin
2 dbms_stats.gather_table_stats(
3 ownname => user,
4 tabname => 'T',
5 method_opt => 'for all columns size 1',
6 granularity => 'global and partition',
7 estimate_percent => null);
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> select table_name, partition_name, num_rows from user_tab_partitions where table_name='T' order by partition_name;
TABLE_NAME PARTITION_NAME NUM_ROWS
T P01 50000
T P02 50000
T P03 50000
T PXX 50000Now let's say you only want to index P01.
You could do it as follows :SQL> create index t_idx on t(decode(grp,1,id,null)) local;
Index created.The index would only have IDs from partition P01.
SQL> select INDEX_NAME, PARTITION_NAME, DISTINCT_KEYS
2 from user_ind_partitions
3 where index_name='T_IDX'
4 order by partition_name;
INDEX_NAME PARTITION_NAME DISTINCT_KEYS
T_IDX P01 50000
T_IDX P02 0
T_IDX P03 0
T_IDX PXX 0
SQL> select SEGMENT_NAME, PARTITION_NAME, BYTES
2 from user_segments
3 where SEGMENT_NAME='T_IDX'
4 order by partition_name;
SEGMENT_NAME PARTITION_NAME BYTES
T_IDX P01 1048576
T_IDX P02 65536
T_IDX P03 65536
T_IDX PXX 65536See, only the keys from P01 are here, and only the segment for P01 partition has grown <i>(the 65k segment for the others partitions come from default values of storage clause which I didn't specify)</i>.
Now you can query your table in the following way.
Instead of writing (for P01) : select * from t where grp=1 and id between 30 and 40;If you want to use the index on P01, you would do :SQL> select * from t where grp=1 and decode(grp,1,id,null) between 30 and 40;
GRP ID VAL
1 32 hSrmmTYXXW
1 36 xofKlsxORE
1 40 vazRGnWzWc
Execution Plan
Plan hash value: 1186642050
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 125 | 2375 | 3 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE SINGLE | | 125 | 2375 | 3 (0)| 00:00:01 | 1 | 1 |
|* 2 | TABLE ACCESS BY LOCAL INDEX ROWID| T | 125 | 2375 | 3 (0)| 00:00:01 | 1 | 1 |
|* 3 | INDEX RANGE SCAN | T_IDX | 225 | | 2 (0)| 00:00:01 | 1 | 1 |
Predicate Information (identified by operation id):
2 - filter("GRP"=1)
3 - access(DECODE("GRP",1,"ID",NULL)>=30 AND DECODE("GRP",1,"ID",NULL)<=40)The index is being used.
+(also note that the grp value is "given" twice in the query : once explicitly, the other one within the decode.)+
Now for a query like : SQL> select * from t where grp=2 and id between 30 and 40;
GRP ID VAL
2 33 bhFrCYCiDb
2 37 jnPauHJiyo
Execution Plan
Plan hash value: 2931986080
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 5 | 95 | 68 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE SINGLE| | 5 | 95 | 68 (0)| 00:00:01 | 2 | 2 |
|* 2 | TABLE ACCESS FULL | T | 5 | 95 | 68 (0)| 00:00:01 | 2 | 2 |
Predicate Information (identified by operation id):
2 - filter("ID"<=40 AND "ID">=30 AND "GRP"=2)The optimizer goes for a FULL TABLE (partition) SCAN.
<b>NOTE :</b> That would also work with a global index.
Of course, it remains a rather dirty tweak...
;-) -
Oracle 11g Installation How to select Database Character Set
Hi,
I am Installing oracle 11g R2. After installation I had verified the character set it was AL16UTF16 but I wants to set AL32UTF8 charater set at the time of oracle installation only. I can't see the character set setting opetion at the time of installation because I am selecting the installation option " Install database softerware only" and after installation of oracle software manually I am creating the database. Please help me how can I set the character set at the time of oracle installation or at the time of database creation.
My question is-
How can I set the AL32UTF8 character set in above scenario?
Why It is showing AL16UTF16 character set even I did not define any thing?But is there any choice to set the NLS_CHARACTERSET at the time of manually database creation. Actually For creating the database i am using one shell script for seting the parameter values in init.ora file so can I set the parameter at that level(at the time of creating init.ora using manually database creation). like
## Original init.ora file created by manual database creation tool on ${DATE}.
*.aq_tm_processes=0
*.background_dump_dest='$ORACLE_BASE/admin/$ORACLE_SID/bdump'
*.compatible='10.2.0'
*.control_files='/$db_file_loc/oradata/$ORACLE_SID/control01.ctl','/$db_file_loc/oradata/$ORACLE_SID/control02.ctl','/$db_file_loc/oradata/$ORACLE_SID/control03.ctl'
*.core_dump_dest='$ORACLE_BASE/admin/$ORACLE_SID/cdump'
*.db_block_size=8192
*.db_cache_size=104857600
*.db_domain='$server_name'
*.db_file_multiblock_read_count=8
*.db_name='$ORACLE_SID'
*.fast_start_mttr_target=300
*.instance_name='$ORACLE_SID'
*.java_pool_size=16777216
*.job_queue_processes=4
*.large_pool_size=16777216
*.log_archive_dest='/u05/oradata/$ORACLE_SID'
*.log_archive_format='$ORACLE_SID_%s_%t_%r.arc'
*.olap_page_pool_size=4194304
*.open_cursors=500
*.optimizer_index_cost_adj=50
*.pga_aggregate_target=536870912
*.processes=1500
*.query_rewrite_enabled='TRUE'
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=83886080
*.sort_area_size=1048576
*.sga_max_size=1048576000
*.sga_target=536870912
*.star_transformation_enabled='TRUE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='$ORACLE_BASE/admin/$ORACLE_SID/udump'
*.utl_file_dir='/export/home/oracle/utlfiles'
**.nls_characterset='AL32UTF8'*
EOF
Is it correct? -
How to create index file for pdf.
Hello,
I need to create a plugin which will read a list of pdf files and then create a full text index with catalog. I searched on net and came to know about the catalog plugin which does this work.In AV layer there is a catalog object but I am unable to find any example on net which uses the catalog object to create the pdx file and a support folder(contains idx files).
I also read the java script documentation but there was no example for creating index.We can build index but for that we need to retrieve the index object first.
Can somebody please giude me.
Thanks!Hi Irosenth,
Is it possible to use DOM/IAC to create index files. The example given in SDK(SearchPdfVB) allows us to add,remove,enable and disable index files. But there is no method given in example to create an index file.
I want to create index file and the supporting folder which contains .idx files automatically ie through code. Is it possible to do so??
I also looked into the AVCommands but couldn't understand how to create the index files using AVCommands.
Can you please guide me.
Thanks!! -
How to create index on XMLTYPE ordered collection table?
I am using Oracle 11.2.0.2.
Essentially, my XML documents have a 3-level hierarchy:
event
+---action [1:n]
+---- param [1:n]
I am trying to create indexes on ordered collection tables, but can not get the syntax right...
I have created a table with an object-relational XMLType column:
CREATE TABLE T_C_RMP_MNTRNG_XML_FULL_IL4 (
MESSAGE_ID NUMBER(22,0) NOT NULL ENABLE,
XML_EVAL_ID NUMBER(22,0),
VIN7 VARCHAR2(7 BYTE),
FLEET_ID VARCHAR2(50 BYTE),
CSC_SW_VERSION VARCHAR2(100 BYTE),
RECEIVED DATE,
XML_CONTENT SYS.XMLTYPE ,
DWH_LM_TS_UTC DATE NOT NULL ENABLE,
CONSTRAINT PK_C_RMP_MNTRNG_XML_FULL_IL4 PRIMARY KEY (MESSAGE_ID)
) NOLOGGING TABLESPACE CATALOG
VARRAY "XML_CONTENT"."XMLDATA"."action" STORE AS TABLE "T_OR_MON_ACTION" (
NOLOGGING TABLESPACE "CATALOG"
VARRAY "param" STORE AS TABLE "T_OR_MON_ACTION_PARAM" (
NOLOGGING TABLESPACE "CATALOG"
) RETURN AS LOCATOR
) RETURN AS LOCATOR
XMLTYPE XML_CONTENT STORE AS OBJECT RELATIONAL XMLSCHEMA "http://mydomain.com/cs.xsd" ELEMENT "monitoring";
I am running the following SELECT:
SELECT EVENT_ID, ACTION_SUB_ID, MESSAGE_ID, ACTION_TYPE, UNIXTS_TO_DATE(ACTION_TIMESTAMP) ACTION_TIMESTAMP
FROM T_C_RMP_MNTRNG_XML_FULL_IL4,
XMLTABLE(
'for $i1 in /monitoring ,
$i2 in $i1/action
return element r {
$i1/eventId,
$i2
PASSING XML_CONTENT COLUMNS
EVENT_ID VARCHAR(40) PATH 'eventId',
ACTION_SUB_ID INTEGER PATH 'action/actionSubId',
ACTION_TYPE VARCHAR2(100) PATH 'action/type',
ACTION_TIMESTAMP NUMBER(13,0) PATH 'action/time'
) T2
WHERE (
EVENT_ID IS NOT NULL AND ACTION_SUB_ID IS NOT NULL
The explain plan looks like this (sorry, don't know how to get this formatted any "eye-friendlier"):
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1609K| 6316M| | 6110K (1)| 20:22:11 |
|* 1 | HASH JOIN | | 1609K| 6316M| 111M| 6110K (1)| 20:22:11 |
| 2 | TABLE ACCESS FULL| T_C_RMP_MNTRNG_XML_FULL_IL4 | 582K| 104M| | 5241 (1)| 00:01:03 |
|* 3 | TABLE ACCESS FULL| T_OR_MON_ACTION | 32M| 117G| | 105K (2)| 00:21:08 |
Predicate Information (identified by operation id):
1 - access("NESTED_TABLE_ID"="T_C_RMP_MNTRNG_XML_FULL_IL4"."SYS_NC0001300014$")
filter(CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(SYS_XQEXTRACT(XMLCONCAT(SYS_XMLGEN("T_C_RMP_MNTRN
G_XML_FULL_IL4"."SYS_NC00017$",NULL,SYS_XMLCONV("T_C_RMP_MNTRNG_XML_FULL_IL4"."SYS_NC00012$",0,32,
'EC1EEF23FD023A27E04032A06D930A8D',3,3783,1)),SYS_MAKEXML('EC1EEF23FD023A27E04032A06D930A8D',3780,
"T_C_RMP_MNTRNG_XML_FULL_IL4"."SYS_NC00008$","SYS_ALIAS_0"."SYS_NC_ROWINFO$")),'/eventId',NULL),0,
0,20971520,0),50,1,2) AS VARCHAR(40) ) IS NOT NULL)
3 - filter(CAST(TO_NUMBER(TO_CHAR("SYS_ALIAS_0"."actionSubId")) AS INTEGER ) IS NOT NULL)
Note
- dynamic sampling used for this statement (level=2)
- Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)
The XML schema looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:storeVarrayAsTable="true" oraxdb:flags="2105639" oraxdb:schemaURL="http://mydomain.com/cs.xsd" oraxdb:schemaOwner="MYUSER" oraxdb:numProps="23">
<xs:element name="monitoring" oraxdb:propNumber="3785" oraxdb:global="true" oraxdb:SQLName="monitoring" oraxdb:SQLType="monitoring755_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:defaultTable="monitoring757_TAB" oraxdb:defaultTableSchema="MYUSER">
<xs:complexType oraxdb:SQLType="monitoring755_T" oraxdb:SQLSchema="MYUSER">
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="action" oraxdb:propNumber="3780" oraxdb:global="false" oraxdb:SQLName="action" oraxdb:SQLType="action752_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false" oraxdb:SQLCollType="action756_COLL" oraxdb:SQLCollSchema="MYUSER"/>
<xs:element ref="reservationType" oraxdb:propNumber="3781" oraxdb:global="false" oraxdb:SQLName="reservationType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
<xs:element ref="softwareVersion" oraxdb:propNumber="3782" oraxdb:global="false" oraxdb:SQLName="softwareVersion" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
<xs:element ref="eventId" oraxdb:propNumber="3783" oraxdb:global="false" oraxdb:SQLName="eventId" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
<xs:element ref="vin" oraxdb:propNumber="3784" oraxdb:global="false" oraxdb:SQLName="vin" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="action" oraxdb:propNumber="3790" oraxdb:global="true" oraxdb:SQLName="action" oraxdb:SQLType="action752_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:defaultTable="action754_TAB" oraxdb:defaultTableSchema="MYUSER">
<xs:complexType oraxdb:SQLType="action752_T" oraxdb:SQLSchema="MYUSER">
<xs:sequence>
<xs:element ref="type" oraxdb:propNumber="3786" oraxdb:global="false" oraxdb:SQLName="type" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
<xs:element maxOccurs="unbounded" ref="param" oraxdb:propNumber="3787" oraxdb:global="false" oraxdb:SQLName="param" oraxdb:SQLType="param749_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false" oraxdb:SQLCollType="param753_COLL" oraxdb:SQLCollSchema="MYUSER"/>
<xs:element ref="actionSubId" oraxdb:propNumber="3788" oraxdb:global="false" oraxdb:SQLName="actionSubId" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
<xs:element ref="time" oraxdb:propNumber="3789" oraxdb:global="false" oraxdb:SQLName="time" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="type" type="xs:string" oraxdb:propNumber="3791" oraxdb:global="true" oraxdb:SQLName="type" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="type751_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="param" oraxdb:propNumber="3794" oraxdb:global="true" oraxdb:SQLName="param" oraxdb:SQLType="param749_T" oraxdb:SQLSchema="MYUSER" oraxdb:memType="258" oraxdb:defaultTable="param750_TAB" oraxdb:defaultTableSchema="MYUSER">
<xs:complexType oraxdb:SQLType="param749_T" oraxdb:SQLSchema="MYUSER">
<xs:sequence>
<xs:element minOccurs="0" ref="value" oraxdb:propNumber="3792" oraxdb:global="false" oraxdb:SQLName="value" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
<xs:element ref="key" oraxdb:propNumber="3793" oraxdb:global="false" oraxdb:SQLName="key" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:MemInline="false" oraxdb:SQLInline="true" oraxdb:JavaInline="false"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="value" type="xs:string" oraxdb:propNumber="3795" oraxdb:global="true" oraxdb:SQLName="value" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="value748_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="key" type="xs:string" oraxdb:propNumber="3796" oraxdb:global="true" oraxdb:SQLName="key" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="key747_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="actionSubId" type="xs:integer" oraxdb:propNumber="3797" oraxdb:global="true" oraxdb:SQLName="actionSubId" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:defaultTable="actionSubId746_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="time" type="xs:integer" oraxdb:propNumber="3798" oraxdb:global="true" oraxdb:SQLName="time" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:defaultTable="time745_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="reservationType" type="xs:string" oraxdb:propNumber="3799" oraxdb:global="true" oraxdb:SQLName="reservationType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="reservationType744_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="softwareVersion" type="xs:string" oraxdb:propNumber="3800" oraxdb:global="true" oraxdb:SQLName="softwareVersion" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="softwareVersion743_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="eventId" type="xs:string" oraxdb:propNumber="3801" oraxdb:global="true" oraxdb:SQLName="eventId" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="eventId742_TAB" oraxdb:defaultTableSchema="MYUSER"/>
<xs:element name="vin" type="xs:string" oraxdb:propNumber="3802" oraxdb:global="true" oraxdb:SQLName="vin" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:defaultTable="vin741_TAB" oraxdb:defaultTableSchema="MYUSER"/>
</xs:schema>
How can I create an index on these ordered collection tables in order to improve performance?
I found the example at http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb_rewrite.htm#ADXDB5859 but am not able to apply it to this particular case...
Thank you in advance...If the schema is not annotated then xs:integer and xs:string are mapped to NUMBER and VARCHAR2(4000) datatypes, so you have to use those in your query in order to avoid unnecessary typecasting operations.
You should also use chained XMLTABLEs when accessing a parent/child relationship instead of a FLWOR expression, otherwise the CBO may not rewrite the XQuery correctly (maybe it's fixed in the latest release).
If you make those changes, the plan should show cleaner predicates :
SQL> SELECT EVENT_ID, ACTION_SUB_ID, MESSAGE_ID, ACTION_TYPE, ACTION_TIMESTAMP
2 FROM test_table,
3 XMLTABLE('/monitoring'
4 PASSING XML_CONTENT COLUMNS
5 EVENT_ID VARCHAR2(4000) PATH 'eventId',
6 actions XMLTYPE PATH 'action'
7 ) T1,
8 XMLTABLE('/action'
9 PASSING actions COLUMNS
10 ACTION_SUB_ID NUMBER PATH 'actionSubId',
11 ACTION_TYPE VARCHAR2(4000) PATH 'type',
12 ACTION_TIMESTAMP NUMBER PATH 'time'
13 ) T2
14 WHERE EVENT_ID IS NOT NULL
15 AND ACTION_SUB_ID IS NOT NULL
16 ;
Execution Plan
Plan hash value: 1763884463
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 109 | 220K| 6 (17)| 00:00:01 |
| 1 | MERGE JOIN | | 109 | 220K| 6 (17)| 00:00:01 |
|* 2 | TABLE ACCESS BY INDEX ROWID| TEST_TABLE | 11 | 352 | 2 (0)| 00:00:01 |
| 3 | INDEX FULL SCAN | SYS_C007567 | 11 | | 1 (0)| 00:00:01 |
|* 4 | SORT JOIN | | 109 | 216K| 4 (25)| 00:00:01 |
|* 5 | TABLE ACCESS FULL | T_OR_MON_ACTION | 109 | 216K| 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter("TEST_TABLE"."SYS_NC00012$" IS NOT NULL)
4 - access("SYS_ALIAS_0"."NESTED_TABLE_ID"="TEST_TABLE"."SYS_NC0000800009$")
filter("SYS_ALIAS_0"."NESTED_TABLE_ID"="TEST_TABLE"."SYS_NC0000800009$")
5 - filter("SYS_ALIAS_0"."actionSubId" IS NOT NULL)
Note
- dynamic sampling used for this statement (level=2)
Now, if still necessary, it all boils down to choosing a technique to index NULL values :
- composite index with a not null or constant column
- FBI
- bitmap
Pick one that best fits your data, selectivity and activity on the tables. -
In sql*plus i do as follows:
sql>create table xmltable(id number primary key,xml_text varchar2(2000));
sql>insert into xmltable values(1,'c:\temp\a1.xml');
sql>insert into xmltable values(2,'c:\temp\a2.xml');
sql>insert into xmltable values(3,'c:\temp\a3.xml');
The contents of file "a1.xml" located at directory "c:\temp" are:
<Order>
<tradeType>2</tradeType>
<tradeAmount>-2000.0</tradeAmount>
<webSiteCode>dangdang</webSiteCode>
<sellerCode>dangdang</sellerCode>
<orderNumber>A20021</orderNumber>
<tradeDate>2001-12-12</tradeDate>
<currencyType>156</currencyType>
</Order>
now if I want to create index what should I do?
I have created index in interMedia text manager (I don't know how to set the index options)
but when I executed the following statement:
sql>select id from xmltable
where contains(xml_text,'156 within currencyType')>0;
I find the error:ORA-20000: interMedia Text error: currencyType is not existed
why?????In order to index XML files located in the file system, you have to define some indexing parameters. First, create a preference for the datastore type:
begin
ctx_ddl.create_preference('COMMON_DIR','FILE_DATASTORE');
ctx_ddl.set_attribute('COMMON_DIR','PATH','c:\temp');
end;
Then, define a XML section group, e.g.:
begin
ctx_ddl.create_section_group('XML_GROUP','xml_section_group');
ctx_ddl.add_zone_section('XML_GROUP', 'Order', 'Order');
ctx_ddl.add_zone_section('XML_GROUP', 'currencyType', 'currencyType');
end;
Now you can create the index:
create index myindex on xmltable(xml_text)
indextype is ctxsys.context
parameters ('datastore COMMON_DIR section group XML_GROUP');
Your select statement should work fine now. For more information about indexing, I recommend taking a look at the Oracle Text Reference.
Roman -
I want information in practical sceario how to create indexes?
hi,
i want complete information about indexes? how create indexes in real time?" Secondary Database
First it must be stated that table design is a more logical work while index design is rather technical. In table design it might make sense to place certain fields (client, company code, ...) in the beginning. In index design, this is not advisable. Very important for an index is that it contains very selective fields in the beginning. Those are fields like object numbers. Not selective are client, company code, ...
Indexes should be small (few fields). The Database optimizer can combine two or more indexes to execute a query.
Indexes of one table should be disjoint (have few common fields), in order not to confuse the optimizer which index to use.
Note that each index slows the inserts into the table down. Updates are only slowed down if indexed fields are updated. In general, heavy inserted tables should have only few indexes while heavy selected tables might have more.
" Creating Secondary Indexes
Procedure
1.In the maintenance screen of the table, choose Indexes.
If indexes already exist on the table, a list of these indexes is displayed. Choose .
2.In the next dialog box, enter the index ID and choose
The maintenance screen for indexes appears.
3.Enter an explanatory text in the field Short text.
You can then use the short text to find the index at a later time, for example with the R/3 Repository Information System.
4.Select the table fields to be included in the index using the input help for the Field name column.
The order of the fields in the index is very important. See What to Keep in Mind for Secondary Indexes.
5.If the values in the index fields already uniquely identify each record of the table, select Unique index.
A unique index is always created in the database at activation because it also has a functional meaning (prevents double entries of the index fields).
6.If it is not a unique index, leave Non-unique index selected.
In this case you can use the radio buttons to define whether the index should be created for all database systems, for selected database systems or not at all in the database.
7.Select for selected database systems if the index should only be created for selected database systems.
Click on the arrow behind the radio buttons. A dialog box appears in which you can define up to 4 database systems with the input help. Select Selection list if the index should only be created on the given database systems. Select Exclusion list if the index should not be created on the given database systems. Choose .
8.Choose activate.
" Result
The secondary index is automatically created in the database during activation if the corresponding table was already created there and index creation was not excluded for the database system.
You can find information about the activation flow in the activation log, which you can call with Utilities ® Activation log. If errors occurred when activating the index, the activation log is automatically displayed.
" How to Check if an Index is Used
Procedure
1.Open a second session and choose System -> Utilities ->Performance trace.
The Trace Requests screen appears.
2.Select Trace on.
The SQL trace is activated for your user, that is all the database operations under your user are recorded.
3.In the first window, perform the action in which the index should be used.
If your database system uses a cost-based optimizer, you should perform this action with as representative data as possible. A cost-based optimizer tries to determine the best index based on the statistics.
4.In the second session, choose Trace off and then Trace list.
Result
The format of the generated output depends on the database system used. You can determine the index that the database used for your action with the EXPLAIN function for the critical statements (PREPARE, OPEN, REPOPEN).
" What to Keep in Mind for Secondary Indexes
How well an existing index supports data selection from a table largely depends on whether the data selected with the index represents the data that will ultimately be selected. This can best be shown using an example.
' Example :
An index is defined on fields FIELD1, FIELD2, FIELD3 and FIELD4 of table BSPTAB in this order. This table is accessed with the SELECT statement:
SELECT * FROM BSPTAB WHERE FIELD1 = X1 AND FIELD2 = X2 AND FIELD4= X4.
Since FIELD3 is not specified more exactly, only the index sorting up to FIELD2 is of any use. If the database system accesses the data using this index, it will quickly find all the records for which FIELD1 = X1 and FIELD2 = X2. You then have to select all the records for which FIELD4 = X4 from this set.
The order of the fields in the index is very important for the accessing speed. The first fields should be those which have constant values for a large number of selections. During selection, an index is only of use up to the first unspecified field.
Only those fields that significantly restrict the set of results in a selection make sense for an index.
Reward points if it is usefull.....
Girish -
How to create index category for TREX in ECC for E-recruiting
Hi guys,
i have finished the settings in SKPR07 transaction for SSR and attached to the HR_KW the SSR id.
But i don't know how to create or generate the index category.
From the posts of this forum someone told me to regenerate the index in SKPR07 , but i failed.
Can anyone show me the way?
Thanks in advance.
sheeryThe solution is so simple you want to kick yourself....
You need to upload a document. The index catagory is created automatically. I recommend simply adding an attachment to a candidates profile.
;p) -
How to create index for a column of a view
Hi,
I have created view for a table and then i am trying to create index for a column of that view. i am using the query "CREATE INDEX index_name ON view_name (col)". but Mysql is showing error like "view_name is not a base table".
How can i do that......As mentioned this is a java forum not a mysql forum, but as I know the answer - you can't create an index directly on a view in mysql.
-
Oracle 11g xe Failed to create the required folder
Hi all...
I had installed RHEL 4.. Actually i am installing oracle 11g XE in linux..
but i got an error message and displayed that below
[root@localhost Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-xe ########################################### [100%]
Executing post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.
[root@localhost Disk1]# su -
[root@localhost ~]# /etc/init.d/oracle-xe configure
Oracle Database 11g Express Edition Configuration
This will configure on-boot properties of Oracle Database 11g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press <Enter> to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration:
Confirm the password:
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
Starting Oracle Net Listener...Done
Configuring database...grep: /u01/app/oracle/product/11.2.0/xe/config/log/*.log: No such file or directory
grep: /u01/app/oracle/product/11.2.0/xe/config/log/*.log: No such file or directory
Done
/bin/chmod: cannot access `/u01/app/oracle/diag': No such file or directory
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
Regards
delphiYes ,. Me too got the same problem after running /etc/init.d/ oracle-xe configure.
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:
Starting Oracle Net Listener...Done
Configuring database...grep: /u01/app/oracle/product/11.2.0/xe/config/log/*.log: No such file or directory
grep: /u01/app/oracle/product/11.2.0/xe/config/log/*.log: No such file or directory
Done
/bin/chmod: cannot access `/u01/app/oracle/diag': No such file or directory
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
when i check the location manually the the diag folder and the log file is not created. also no .dbf files in oradata folder!!
Anyone have resolution for this??
Maybe you are looking for
-
Can I change my iPhone 5 for a new one if it's still under warranty??
Hey guys, I am with AT&T since november 2012...I am on a 2 year contract and got an iPhone 5...I am really enjoying the phone and iOS in general. I have a question if I can exchange my current iPhone 5 for a brand new iPhone 5...I am still under 1 ye
-
Activation of new fields in Vendor Master
Hi Experts, Fields "Acct clk tlf", "Clerk's fax" and "Clrk's internet" are made available (activated) for editing in Vendor Master - maintained at company code level in Correspondane tab. Would like to know whether availability of this fields will a
-
How to change label color in LabelGraphics script?
I am using ID CS4 and running the LabelGraphics script to label several images in a large document. When I run thre script, the box with the file name is transparent with black type. I would like the box to be white with black type. Is there any way
-
Can't open the mail application since updating to 10.6.6
Hi, Since I updated to 10.6.6 I can no longer open my mail application. I get a message stating that "You have version 4.3 (1081/1082) of mail. It can not be used with the Mac OS X Version 10.6.6." When I was updating my mail was not in the applicati
-
Has anyone seen an app shimmering?
Unfortunately I didn't manage to get a screenshot, but I went to the app store to download xcode, and it said it was already installed. I opened the app launcher and scrolled through to find it. When I found it, it was shimmering. Like it had little