Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get the creation statement of index in ORACLE

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to get the index creation statement in ORACLE, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Set pagesize 0

Set long 90000

Set feedback off

Set echo off

Spool all_index.sql

SELECT DBMS_METADATA.GET_DDL ('INDEX',u.index_name)

FROM USER_INDEXES UtterSpool off; finally find an editor to replace the table space name, adding a

Then let ORACLE execute it slowly.

In fact, you can get a lot of things by calling the external procedure DBMS_METADATA.GET_DDL to create a DLL statement.

This is the creation DLL of all users.

SELECT DBMS_METADATA.GET_DDL ('USER',U.username)

FROM DBA_USERS U

This is the DLL of all the watches.

SELECT DBMS_METADATA.GET_DDL ('TABLE',u.table_name)

FROM USER_TABLES u

DLL for all tablespaces

SELECT DBMS_METADATA.GET_DDL ('TABLESPACE', TS.tablespace_name)

FROM DBA_TABLESPACES TS

Combine all the table and index stored procedures

SELECT DBMS_METADATA.GET_DDL (U.OBJECT_TYPE, u.object_name)

FROM USER_OBJECTS u

Where U.OBJECT_TYPE IN ('TABLE','INDEX','PROCEDURE'); another related statement generates a statement that deletes all indexes of a user

After reading the above, do you have any further understanding of how to get the index creation statement in ORACLE? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report