RE: Using DBMS_METADATA/DBMS_REDFINITION to move all objects to another TS

From: Patterson, Joel <jpatterson_at_entint.com>
Date: Mon, 24 Jun 2013 13:31:12 -0400
Message-ID: <C1117B1AA0340645894671E09A7891F715123A54EA_at_EIHQEXVM2.ei.local>



I was wondering after you have moved everything to the new tablespace, if you cannot simply rename the tablespace? And of course rename the datafiles on disk and in the database as well?

It seems to be faster -- so just wondering if there is some benefit not already gained.

Joel Patterson
Database Administrator
904 928-2790

--

Joel Patterson
Sr. Database Administrator | Enterprise Integration Phone: 904-928-2790 | Fax: 904-733-4916
http://www.entint.com/

http://www.entint.com/

http://www.facebook.com/pages/Enterprise-Integration/212351215444231 http://twitter.com/#!/entint http://www.linkedin.com/company/18276?trk=tyah http://www.youtube.com/user/ValueofIT

This message (and any associated files) is intended only for the use of the addressee and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient, you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company. [v.1.1]

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Powell, Mark Sent: Thursday, June 20, 2013 1:02 PM
To: oracle-l_at_freelists.org
Subject: RE: Using DBMS_METADATA/DBMS_REDFINITION to move all objects to another TS

Why not just issue Alter table move t_a tablespace new_t followed by alter index i_1 rebuild tablespace new_1 ? This would be good for any tables without long and long raw columns though this would take a down window. Otherwise using dbms_redefiniton for online moves should work but it is a lot more work.

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Rich Jesse Sent: Thursday, June 20, 2013 12:26 PM
To: oracle-l_at_freelists.org
Subject: Using DBMS_METADATA/DBMS_REDFINITION to move all objects to another TS

Howdy,

In 11.2.0.3, we're archiving a good portion of data from Production ERP DB to Production Archive DB. All tables are in one tablespace, all indexes in another, as designed by 3rd party ERP. In order to recover the 100s of GB of disk post-archive, my plan is to:

  1. Create new TS big enough to handle all tables and indexes.
  2. Use DBMS_METADATA to create new tables and indexes in new TS
  3. Use DBMS_REDEFINITION to online move data to new TS
  4. Drop/recreate old TS
  5. Use DBMS_METADATA to create new tables and indexes in original TSs
  6. Use DBMS_REDEFINITION to online move data to original TSs
  7. Drop new TS

The reason I need to use DBMS_METADATA is for the requirement to move the tables and indexes to a new TS. DBMS_REDEFINITION will not do that.

The problem I'm having is how to remap each index name to a new name in DBMS_METADATA. Basically, I'm trying to use this to grab the remapped DDL for each index on a given table:

v_idx_handle := DBMS_METADATA.OPEN('INDEX'); DBMS_METADATA.SET_FILTER(v_idx_handle, 'BASE_OBJECT_SCHEMA', v_schema); DBMS_METADATA.SET_FILTER(v_idx_handle, 'BASE_OBJECT_NAME', v_source_table); v_ddl_xform := DBMS_METADATA.ADD_TRANSFORM(v_idx_handle,'MODIFY'); DBMS_METADATA.SET_REMAP_PARAM(v_ddl_xform, 'REMAP_TABLESPACE', v_source_idx_ts, v_dest_ts); --DBMS_METADATA.SET_REMAP_PARAM(v_ddl_xform, 'REMAP_NAME', ???, ???||'_NEW'); v_ddl_xform := DBMS_METADATA.ADD_TRANSFORM(v_idx_handle,'DDL'); LOOP
        v_ddl := DBMS_METADATA.FETCH_DDL(v_idx_handle); ...

But how does one remap the name in the transform (commented out) when it's not known until it's DDL is fetched? Or am I looking at some regexp in the post-FETCH_DDL?

Thanks!
Rich

--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l Received on Mon Jun 24 2013 - 19:31:12 CEST

Original text of this message