?
Solved

compute statistics using index Tablespace

Posted on 2004-08-18
6
Medium Priority
?
1,377 Views
Last Modified: 2008-01-09
Creating this index using oracle 9i

create unique index FLOG_PREFIX_DATE_inx on FAX_LOG
 (SUBSTR(FLAG_CONFIRM,5,10))
   compute statistics using index Tablespace tsdix;

And getting the following error:

ERROR at line 3:
ORA-02158: invalid CREATE INDEX option
0
Comment
Question by:bolicat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 18

Expert Comment

by:JR2003
ID: 11829868
create unique index FLOG_PREFIX_DATE_inx on FAX_LOG
 (SUBSTR(FLAG_CONFIRM,5,10))
Tablespace tsdix;

I've never seen compute statistic put there before!
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 11829902
using index syntax does not belong here either.
It's used to create index when you create constraints like Primary key or Unique key.

JR's suggestion should work.
0
 
LVL 1

Accepted Solution

by:
JanMah earned 1000 total points
ID: 11830207
JR2003:
You can use Compute Statistics while Creating Index

Use the following:
create unique index FLOG_PREFIX_DATE_inx on FAX_LOG
 (SUBSTR(FLAG_CONFIRM,5,10))
   compute statistics;

If you want to create the index on tablespace tsdix then

create unique index FLOG_PREFIX_DATE_inx on FAX_LOG
 (SUBSTR(FLAG_CONFIRM,5,10)) tablespace QSA_INDEX
   compute statistics;


JanMah
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 1

Expert Comment

by:JanMah
ID: 11830213
The QSA_INDEX to be changed to tsdix, sorry

JanMah
0
 
LVL 48

Expert Comment

by:schwertner
ID: 11830518
To create the tablespace use JRs sugestion.
 

To create statistics on index analyze the table as follow:
   
 ANALYZE TABLE fax_log COMPUTE STATISTICS;

or

exec DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => NULL, TABNAME => ' fax_log', CASCADE => TRUE);
0
 
LVL 35

Expert Comment

by:johnsone
ID: 11831073
I agree with schwerner's suggestion.

Analyze the table after the index has been created.  This is because the optimizer will not understand the correct cost until the table has been re-analyzed.  Not sure if an enhancement has come through to address this, but that has definitely been the case.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question