dbTalk Databases Forums  

Renaming Partitions

comp.databases.oracle.server comp.databases.oracle.server


Discuss Renaming Partitions in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Adrian
 
Posts: n/a

Default Renaming Partitions - 02-17-2011 , 03:54 PM






Oracle 11.1.? on Linux

We are using partitioned tables, partitioning by interval, so partitions
are automatically created as we need them. Part of the loading process
renames the partitions from SYS_xxxx to a more meaningful name (ALTER
TABLE x RENAME PARTITION FOR y TO z).

So far so good. Is there a similar way to alter the partition names for
the local indexes (I'm looking in user_ind_partitions). Something like
ALTER INDEX x RENAME PARTITION FOR y TO z.

I know I can use ALTER INDEX x RENAME PARTITION y TO z, but to do that I
have to work out what partition SYS_xxxx really is.


TIA

Adrian
--
To Reply :
replace "bulleid" with "adrian" - all mail to bulleid is rejected
Sorry for the rigmarole, If I want spam, I'll go to the shops
Every time someone says "I don't believe in trolls", another one dies.

Reply With Quote
  #2  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: Renaming Partitions - 02-17-2011 , 04:47 PM






On Thu, 17 Feb 2011 21:54:58 +0000, Adrian wrote:


Quote:
I know I can use ALTER INDEX x RENAME PARTITION y TO z, but to do that I
have to work out what partition SYS_xxxx really is.
I was just about to point you to the documentation which says that:

http://tinyurl.com/4hstv83

There is even a simple example:

Renaming an Index Partition: Example The following statement renames an
index partition of the cost_ix index (created in "Creating a Range-
Partitioned Global Index: Example"):

ALTER INDEX cost_ix
RENAME PARTITION p3 TO p3_Q3;

You apparently know this. I don't understand what the question is?
--
http://mgogala.byethost5.com

Reply With Quote
  #3  
Old   
Adrian
 
Posts: n/a

Default Re: Renaming Partitions - 02-18-2011 , 01:29 PM



In message <pan.2011.02.17.22.47.37 (AT) email (DOT) here.invalid>, Mladen Gogala
<no (AT) email (DOT) here.invalid> writes
Quote:
On Thu, 17 Feb 2011 21:54:58 +0000, Adrian wrote:


I know I can use ALTER INDEX x RENAME PARTITION y TO z, but to do that I
have to work out what partition SYS_xxxx really is.

I was just about to point you to the documentation which says that:

http://tinyurl.com/4hstv83

There is even a simple example:

Renaming an Index Partition: Example The following statement renames an
index partition of the cost_ix index (created in "Creating a Range-
Partitioned Global Index: Example"):

ALTER INDEX cost_ix
RENAME PARTITION p3 TO p3_Q3;

You apparently know this. I don't understand what the question is?

The question is how do I identify what the partition should be called.
We are partitioning by date. When the partition is created, I can run
an alter table command that says, for the table my_table rename the
partition for February 18 2011 to my_table_110218. I don't need to find
out that it is created as SYS_123 and then run "ALTER TABLE table_name
RENAME PARTITION SYS_123 TO my_table_110218. What I would like to be
able to do is something similar for the indexes. Is this possible, and
if so how (without going to PL/SQL) ?


Adrian
--
To Reply :
replace "bulleid" with "adrian" - all mail to bulleid is rejected
Sorry for the rigmarole, If I want spam, I'll go to the shops
Every time someone says "I don't believe in trolls", another one dies.

Reply With Quote
  #4  
Old   
onedbguru
 
Posts: n/a

Default Re: Renaming Partitions - 02-19-2011 , 07:43 PM



On Feb 18, 2:29*pm, Adrian <bull... (AT) ffoil (DOT) org.uk> wrote:
Quote:
In message <pan.2011.02.17.22.47... (AT) email (DOT) here.invalid>, Mladen Gogala
n... (AT) email (DOT) here.invalid> writes









On Thu, 17 Feb 2011 21:54:58 +0000, Adrian wrote:

I know I can use ALTER INDEX x RENAME PARTITION y TO z, but to do thatI
have to work out what partition SYS_xxxx really is.

I was just about to point you to the documentation which says that:

http://tinyurl.com/4hstv83

There is even a simple example:

Renaming an Index Partition: Example The following statement renames an
index partition of the cost_ix index (created in "Creating a Range-
Partitioned Global Index: Example"):

ALTER INDEX cost_ix
* RENAME PARTITION p3 TO p3_Q3;

You apparently know this. I don't understand what the question is?

The question is how do I identify what the partition should be called.
We are partitioning by date. *When the partition is created, I can run
an alter table command that says, for the table my_table rename the
partition for February 18 2011 to my_table_110218. *I don't need to find
out that it is created as SYS_123 and then run "ALTER TABLE table_name
RENAME PARTITION SYS_123 TO my_table_110218. *What I would like to be
able to do is something similar for the indexes. *Is this possible, and
if so how (without going to PL/SQL) ?

Adrian
--
To Reply :
replace "bulleid" with "adrian" - all mail to bulleid is rejected
Sorry for the rigmarole, If I want spam, I'll go to the shops
Every time someone says "I don't believe in trolls", another one dies.

What is your problem with PL/SQL? look at high_value in
dba_tab_partitions. this is a "long" field, so you will need to do
some parsing. I have a "get_high" procedure I use to find this value,
but not here at home. Once you create the procedure and grant it to
public or whatever your security model is, you should have no
problems.

Reply With Quote
  #5  
Old   
Adrian
 
Posts: n/a

Default Re: Renaming Partitions - 02-20-2011 , 02:06 PM



In message
<41ee1a5b-59d7-4791-a201-27418d92b061 (AT) o10g2000vbg (DOT) googlegroups.com>,
onedbguru <onedbguru (AT) yahoo (DOT) com> writes
Quote:
What is your problem with PL/SQL? look at high_value in
dba_tab_partitions. this is a "long" field, so you will need to do
some parsing. I have a "get_high" procedure I use to find this value,
but not here at home. Once you create the procedure and grant it to
public or whatever your security model is, you should have no
problems.

The "problem" with using PL/SQL is that I would prefer to use a
nutcracker to crack a nut. Technically or otherwise, there is no reason
why I can't do, but I was hoping that there might be a one liner (as
there is via alter table).


Adrian
--
To Reply :
replace "bulleid" with "adrian" - all mail to bulleid is rejected
Sorry for the rigmarole, If I want spam, I'll go to the shops
Every time someone says "I don't believe in trolls", another one dies.

Reply With Quote
  #6  
Old   
John Hurley
 
Posts: n/a

Default Re: Renaming Partitions - 02-20-2011 , 04:06 PM



Adrian:

Quote:
The question is how do I identify what the partition should be called.
We are partitioning by date. *When the partition is created, I can run
an alter table command that says, for the table my_table rename the
partition for February 18 2011 to my_table_110218. *I don't need to find
out that it is created as SYS_123 and then run "ALTER TABLE table_name
RENAME PARTITION SYS_123 TO my_table_110218. *What I would like to be
able to do is something similar for the indexes. *Is this possible, and
if so how (without going to PL/SQL) ?
Why don't you have your logic that is renaming the original partitions
maintain information somewhere ( hey let's be original and keep it in
a table ) so that when you need to generate your index rename
statements it can look up and translate and then generate the sql that
you need.

You can spool out the generated sql if you so wish and then just
execute the generated sql.

Sql that generates other sql ... that's been going on in the Oracle
database world for 20 odd years give or take ...

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.