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

  • From: Kevin Jernigan <kevin.jernigan@xxxxxxxxxx>
  • To: Andrew Kerber <andrew.kerber@xxxxxxxxx>
  • Date: Thu, 20 Jun 2013 13:21:33 -0700

We have found that the reasons for "archiving" data are often driven by 
a lack of understanding of what's possible with existing Oracle Database 
functionality. For example, customers often believe that they need to 
remove data from their production database in order to address 
performance issues with reports or batch jobs, when they can often 
resolve those issues with a combination of partitioning, compression, 
and plain old SQL tuning. So, rather than introducing the complexities 
of a separate system for storing and accessing archived data, it usually 
makes more sense to keep all the data in one place, where it's much 
easier to access and manage.
So if he is going to do the work to figure out which parts of his data 
are "safe" to archive, and then to move that data, then he should 
perhaps consider moving it from monolithic tables into partitioned 
tables within the same database - and if they are already partitioned, 
then maybe there is much less work to do than originally thought?

-Kevin J

P.S. Thanks for reminding me to update my sig - I had done that on some 
of my email clients but not others. My apologies if my laziness offended 
you - my only intent was / is to ensure full disclosure on my part as to 
my role within Oracle.

Kevin Jernigan
+1 650 607.0392 (office) | +1 415 710.8828 (mobile)
Senior Director, Product Management, Data Layer
Compression (ACO & HCC) | Resource Management (DBRM & IORM)
Database Smart Flash Cache | Temporal SQL and CQN
SecureFiles and filesystems (dNFS & DBFS & CloneDB)
Database Development, Oracle

On 6/20/2013 1:06 PM, Andrew Kerber wrote:
> Well, no doubt he could, but he would still have to move the tables.  
> Would you please cut down the size of your signature block when 
> posting to this group?  It looks to me like you are posting here 
> primarily so we can see all the nice things you work on, but it doesnt 
> really impress anyone here, and it does look kind of noisy.
>
>
> On Thu, Jun 20, 2013 at 3:00 PM, Kevin Jernigan 
> <kevin.jernigan@xxxxxxxxxx <mailto:kevin.jernigan@xxxxxxxxxx>> wrote:
>
>     Question: why are you moving data from your production database to
>     another database? Could you use Partitioning + Compression + read-only
>     tablespaces etc to accomplish the same goals?
>     -KJ
>
>     *<SNIP>
>
>     On 6/20/2013 9:26 AM, Rich Jesse wrote:
>     > 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
>     >
>     > --
>     > //www.freelists.org/webpage/oracle-l
>     >
>     >
>
>
>
>     --
>     //www.freelists.org/webpage/oracle-l
>
>
>
>
>
> -- 
> Andrew W. Kerber
>
> 'If at first you dont succeed, dont take up skydiving.'



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


Other related posts: