Bugra Canbakal's Oracle Blog

  • Home
  • Contact
  • SITE MAP
You are here: Home / Oracle / User Schemasının index yapısını çıkartmak

User Schemasının index yapısını çıkartmak

12:40 PM By Bugra Canbakal Leave a Comment

1.AMAÇ VE KAPSAM

Bir user schemasının butun ozellikleriyle index yapisini cikartmaya yarar.

2.UYGULAMA

2.1 Sqlscriptimizi yaratiyoruz.

vi /home/oracle/Desktop/olanindexlerigoster.sql

rem ———————————————————————–
rem # Sqlplus / as sysdba olarak giriyoruz
rem # Hangi schemanin index yapisini ogrenmek istiyorsak o schemayi sordugunda
rem # yazıyoruz script sizin uygulamayi calistirdiginiz klasorde
rem # ind_.lst isminde bir klasor yaratacaktir
rem ———————————————————————–

set arraysize 1
set echo off
set heading off
set feedback off
set verify off
set pagesize 0
set linesize 79
define 1 = &&SCHEMA_NAME
spool ind_&&SCHEMA_NAME
set termout off
col y noprint
col x noprint
col z noprint
select ‘rem **** Create Index DDL for ‘||chr(10)||
‘rem **** ‘||username||””||’s tables’||chr(10)||chr(10)
from dba_users
where username = upper (‘&&1’)
/
select table_name z,
index_name y,
-1 x,
‘create ‘ || rtrim(decode(uniqueness,’UNIQUE’,’UNIQUE’,null))
|| ‘ index ‘ ||
rtrim(index_name)
from dba_indexes
where table_owner = upper(‘&&1’)
union
select table_name z,
index_name y,
0 x,
‘on ‘ ||
rtrim(table_name) ||
‘(‘
from dba_indexes
where table_owner = upper(‘&&1′)
union
select table_name z,
index_name y,
column_position x,
rtrim(decode(column_position,1,null,’,’))||
rtrim(column_name)
from dba_ind_columns
where table_owner = upper(‘&&1’)
union
select table_name z,
index_name y,
999999 x,
‘)’ || chr(10)
||’unrecoverable ‘ || chr(10)
||’STORAGE(‘ || chr(10)
||’INITIAL ‘ || initial_extent || chr(10)
||’NEXT ‘ || next_extent || chr(10)
||’MINEXTENTS ‘ || ‘1’ || chr(10)
||’MAXEXTENTS ‘ || max_extents || chr(10)
||’PCTINCREASE ‘|| ‘0’ ||’)’ || chr(10)
||’INITRANS ‘ || ini_trans || chr(10)
||’MAXTRANS ‘ || max_trans || chr(10)
||’PCTFREE ‘ || ‘0’ || chr(10)
||’TABLESPACE ‘ || tablespace_name ||chr(10)
||’PARALLEL (DEGREE ‘ || DEGREE || ‘) ‘ || chr(10)
||’/’||chr(10)||chr(10)
from dba_indexes
where table_owner = upper(‘&&1’)
order by 1,2,3
/

2.2 Sysdba olarak bağlanıp scripti çalıştırmamız gerekiyor, script calıstırıldıktan sonra hangi userın schemasını inceliyeceksek onu yazıyoruz.

[oracle@localhost ~]$ sqlplus / @/home/oracle/Desktop/olanindexlerigoster.sql

SQL*Plus: Release 11.1.0.6.0 – Production on Tue Jun 15 00:16:34 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Enter value for schema_name: schemanin_ismi
SQL> exit

2.3 Sqlplusa bağlanmadan önceki klasorunuzde otomatik olarak ind_.lst isimli bir dosya olusacaktir

Share this:

  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on X (Opens in new window) X

Filed Under: Oracle Tagged With: schema index, table index, user schema

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About Me



Language:

  • English
  • Turkish

Categories

  • Oracle
    • RAC – Real Application Cluster
    • RMAN
    • Single Node
    • Standby – Dataguard
  • OS
    • Linux

Blogroll

  • Emre Baransel
  • Gökhan Atıl
  • H. Tonguc Yılmaz
  • Kamil Türkyılmaz
  • Tanel Poder
  • Turkce Oracle
  • Turkish Oracle User Group
  • Uwe Hesse
  • Zekeriya Beşiroğlu

Archives

  • April 2014
  • March 2014
  • August 2013
  • June 2013
  • March 2013
  • January 2013
  • December 2012
  • November 2012
  • July 2012
  • June 2012
  • May 2012
  • January 2012
  • November 2011
  • October 2011
  • August 2011
  • July 2011
  • June 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • June 2010
OCP
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

[footer_backtotop]

Copyright © 2010-2014 Bugra Canbakal. All rights reserved.