- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Extract Index Definition from Oracle
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2006 09:50 PM
тАО09-17-2006 09:50 PM
how do I extract the exact "CREATE INDEX" Statement for a function based index ?
I tried this:
select substr ( INDEX_NAME||':'||COLUMN_NAME,1,60),DESCEND
from DBA_IND_COLUMNS where INDEX_NAME like '&index_like_value%'
order by INDEX_NAME,COLUMN_POSITION;
Which runs like:
SQL> select substr ( INDEX_NAME||':'||COLUMN_NAME,1,60),DESCEND
from DBA_IND_COLUMNS where INDEX_NAME like '&index_like_value%'
order by INDEX_NAME,COLUMN_POSITION;
Enter value for index_like_value: /BIC/AY04_WP_I00%
old 2: from DBA_IND_COLUMNS where INDEX_NAME like '&index_like_value%'
new 2: from DBA_IND_COLUMNS where INDEX_NAME like '/BIC/AY04_WP_I00%%'
/BIC/AY04_WP_I0004:SOURSYSTEM ASC
/BIC/AY04_WP_I0004:/BIC/Y04GRANST ASC
/BIC/AY04_WP_I0004:/BIC/Y04HESYS ASC
/BIC/AY04_WP_I0004:/B20/S_C43CLACC ASC
/BIC/AY04_WP_I0004:/B20/S_C41FINST ASC
/BIC/AY04_WP_I00~0:SOURSYSTEM ASC
/BIC/AY04_WP_I00~0:/B20/S_C30POS ASC
/BIC/AY04_WP_I00~0:/BIC/AO_VER_VF ASC
/BIC/AY04_WP_I00~0:/BIC/AO_SYS_VF ASC
/BIC/AY04_WP_I00~0:/BIC/AO_VAL_VF ASC
/BIC/AY04_WP_I00~ZV8:SOURSYSTEM ASC
/BIC/AY04_WP_I00~ZV8:/BIC/AO_PACKNO ASC
/BIC/AY04_WP_I00~ZV8:/B20/S_C41FINST ASC
/BIC/AY04_WP_I00~ZV8:SYS_NC00029$ DESC
/BIC/AY04_WP_I00~ZV9:SOURSYSTEM ASC
/BIC/AY04_WP_I00~ZV9:/BIC/AO_PACKNO ASC
/BIC/AY04_WP_I00~ZV9:SYS_NC00029$ DESC
17 rows selected.
Elapsed: 00:00:00.16
SQL>
Now I like to identify my reverse ordered columns by name, i.E "SYS_NC00029$"
I scaned a lot of DBA_ Tables, but did not find it yet ?
Volker
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2006 10:03 PM
тАО09-17-2006 10:03 PM
Re: Extract Index Definition from Oracle
unless a script is absolutely required, you could use TOAD.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2006 10:52 PM
тАО09-17-2006 10:52 PM
Re: Extract Index Definition from Oracle
Toad will surely work, but I am not permitted to install it right here.
Got a (not so good) solution meanwhile:
Doing an export of the table with
rows=n
indexes=y
constraints=n
grants=n
triggers=n
gives the complete CREATE INDEX statement in the dump, allthough it is a bit garbled.
Since I do not like to use EXP all the time in production, still a rabit to win for the dictionary table that contains the required information.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2006 11:25 PM
тАО09-17-2006 11:25 PM
Re: Extract Index Definition from Oracle
I had another snoop and found:
http://oracle.ittoolbox.com/code/archives.asp?d=2117&a=s&i=10
Notes:
Check what your utl_file_dir is.
Customize the select by replacing schema_name and adding your index_name
I had to run as sys
connect / as sysdba
@c1.sql
exec CREATE_SQL_FOR_INDICES
Produced a script like:
CREATE UNIQUE INDEX APPLY$_ERROR_HANDLER_UNQ ON APPLY$_ERROR_HANDLER(RESOLUTION_ID) TABLESPACE SYSTEM;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2006 11:42 PM
тАО09-17-2006 11:42 PM
Re: Extract Index Definition from Oracle
thanks, but this script is way too poor.
It does not care about
- multi-column-indexes
-- order of multi-column index-columns
- ascending/descending columns
I searched half of google before I asked here. Lots of stuff out there, but also a lot of faulty or at least incomplete stuff.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 02:29 AM
тАО09-18-2006 02:29 AM
SolutionFor example.
create table pdj_test(fld number );
create index pdj_test_f1 on pdj_test (to_char(fld));
select dbms_metadata.GET_DDL('INDEX','PDJ_TEST_F1','SYSTEM') from dual;
---- Handles function based indexes. ---
CREATE INDEX "SYSTEM"."PDJ_TEST_F1" ON "SYSTEM"."PDJ_TEST" (TO_CHAR("FLD"))
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 16384 NEXT 16384 MINEXTENTS 1 MAXEXTENTS 505
PCTINCREASE 50 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSTEM"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 06:59 AM
тАО09-18-2006 06:59 AM
Re: Extract Index Definition from Oracle
that pretty much seems to nail it perfectly!
Will try out tomorrow morning !
Good night
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 06:02 PM
тАО09-18-2006 06:02 PM
Re: Extract Index Definition from Oracle
exp system/manager indexfile=myindexes.txt owner = scott
This will produce a better formatted output file containing all the create index statements.
Cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 08:14 PM
тАО09-18-2006 08:14 PM
Re: Extract Index Definition from Oracle
Closing thread.
Volker