Question: How much time do you spend/lose?
Just click on the link named "Erman Arslan's Oracle Forum is available now.
Click here to ask a question", which is available on the main page of Erman Arslan's Oracle Blog
-- or just use the direct link:
-------------- "Erman Arslan's Oracle Forum is available now. Click here to ask a question. " --------------
Question: How much time do you spend/lose?
We have used online redefinition for moving big tables with big LOB columns from one tablespace to another and we have seen it in the previous post.
In this post, we will take a look at the datapump process that we used for moving the small sized tables ( LOB-free tables smaller than 10GBs -- )
Datapump is a tool that we use in logical migrations, some logical backups and in some other daily operations, sometimes for the upgrades and I think you all know that. So this blog post is written for telling you the story, the general process -- not the details of the well known datapump tool.
Let's start with an interesting event that we suddenly found ourself in.. That is, datapump export was very slow. We were exporting the data into an ACFS mount exported from an Exadata (using NFS --through a 10 gig network).. So it shouldn't be anywhere near slow.. But! suprisingly it was...
We saw datapump dump file I/O events in the parallel export sessions.. So we suspected from the ACFS.. We did a couple of dd tests on the server (HP UX in this case).. Pure sequential I/O to the NFS share was slow.. However; dd tests on Exadata side performed well.. Then we saw that a parallel & full rman backup was running on Exadata side. A backup software (through a rman channel) was transffering the blocks to a network storage.. There was no backup network there.. So it was the network bandwitdh causing the slowness.. Our ACFS I/O was based on NFS in the first place, so cancelled the backup and everything went fine! -- an interesting event, right?
Anyways, just for the quick info, we are moving tables from one tablespace to another just to get rid of an offline, unrecoverable datafile because it prevents us using XTTS for our main goal. That is, migrating one of our database from HPUX to Exadata X8-2M..
Let's tell this datapump part of the story like we're doing it right now;
We have a limited downtime, so the process should be quick.. This is a production and that's why the process should be complete & error-free as well..
Here is the process;
Some easy examples for the check queries:
select table_name from dba_tables where tablespace_name='ERMAN_TBS';
select count(*) from dba_tables where tablespace_name='ERMAN_TBS';
select index_name from dba_indexes where tablespace_name='ERMAN_TBS';
select count(*) from dba_indexes where tablespace_name='ERMAN_TBS';
select index_name from dba_indexes where table_name in (select table_name from dba_tables where tablespace_name='ERMAN_TBS');
select count(*) from dba_indexes where table_name in (select table_name from dba_tables where tablespace_name='ERMAN_TBS');
select trigger_name from dba_triggers where table_name in (select table_name from dba_tables where tablespace_name='ERMAN_TBS');
select count(*) from dba_triggers where table_name in (select table_name from dba_tables where tablespace_name='ERMAN_TBS');
select * from dba_tab_privs where table_name in (select table_name from dba_tables where tablespace_name='ERMAN_TBS');
select count(*) from dba_tab_privs where table_name in (select table_name from dba_tables where tablespace_name='ERMAN_TBS');
select owner, object_type, count (*) from dba_objects where status='INVALID' group by owner, object_type order by 1,2;In the previous post, I mentioned that we decided to move the objects residing in the problematic tablespace ( having an offline datafile) to a new tablespace and we decided on a hybrid method for accomplishing this task. We planned to move the big LOB tables using the Online Redefinition .. In addition to that, we decided to use datapump (expdp - impdp) to move the small sized tables to the new tablespace with a minimal downtime.
In this blog post, I will take a look at the Online Redefinition side of the work and give you the general information about the process.
First of all , we couldn't move tables online with the alter table move online clause, since the database version was 12.1.
We couldn't use expdp-impdp to move the big LOB tables, because it required a big downtime + the LOBs were Basicfile -- expdp can not leverage parallelism for the Basicfile lobs.
So, we decided to move those big lob tables (some of them were bigger than 1.5 TB) using online redefitinion and it almost perfectly worked!
Note that, no one needs to be afraid of the online redefinition as it is used with basic API calls and it is pretty straight forward. It is based on the materialized views (MVs) and refresh technology that we already have in Oracle Databases for a very long time..
What happens in the background is; a MV based refresh and alter table rename based switch operations..
So, a MV is created, then it is fully refreshed and then it is synched with the fast refreshes (by the help of the MV logs) and then the object names are switched -- just after the final last sync...
All of these are done via API. So you don't need to know the internals to do the work..
Let's go through the process with an example;
We first created our target/new tablespace with the CRATE TABLESPACE caluse;
CREATE TABLESPACE ERMAN_NEW DATAFILE '+ERM' SIZE 32767M AUTOEXTEND ON NEXT 1G MAXSIZE 32767M, '+ERM' SIZE 32767M AUTOEXTEND ON NEXT 1G MAXSIZE 32767M, '+ERM' SIZE 32767M AUTOEXTEND ON NEXT 1G MAXSIZE 32767MLOGGINGQuick intro; Already migrated the DWH to Exadata X8-2M and saw a dramatic increase in ETL performance without even touching anything, without even doing any migration improvements :)
Today's blog post is about a different topic though.. I mean it is related with this migration project, but it is not directly related with the migration operations. So this is something that prevented us migrating a database to Exadata X8-2M using XTTS method. (Remember; in this project, our source platform is HP-UX )
The reason preventing us implementing our migration method was an offline datafile.. It was added into an important tablespace years ago, but then it was taken offline somehow .. As you may guess, we could not make it back online as we didn't have the archivelogs generated years ago..
In short, we had an offline datafile in the customer's database and it could not be recovered.. So, we couldn't drop that datafile. It needed recovery..
That datafile was already empty and it was just an unnecessary blocker..
Anyways.. Because of this datafile, XTTS method was encountering the error ORA-20001: TABLESPACE(S) IS READONLY OR, OFFLINE JUST CONVERT, COPY.
Basically, XTTS didn't like that file (because it was in offline status) and that's why the perl scripts produced ORA-20001..
As you may guess, we modified the XTTS script.. (perl is my favorite language in these kinds of system programming tasks :) In order to do this we needed to update the XTTS perl scripts, the one named "xttprep.tmpl" specifically..So we told XTTS to ignore this file in the relevant tablespace and migrated all the other files without getting any errors. Ofcourse we did it in the TEST environment.
We updated the xttprep.tmpl and made it not to get the problematic datafile in the first place..
We did the update in the related part of the file as follows;
$ELSE
gv$datafile
$END d
, v$tablespace t
WHERE d.ts# = t.ts#
AND d.file# not in (90) "******* <-- WE ADDED the FILE NO OF THE PROBLEMATIC FILE"
AND d.inst_id = USERENV('INSTANCE')
AND t.name IN (
%%TABLESPACES%%
)
With this action, ORA-20001 was not produced and we could continue working.. However; we couldn't take the necessary action for accomplishing the last task of the XTTS method.. We just couldn't make the source datafile offline for the final sync.. So modifying the script didn't solve the issue completely..
--Note that we still tried to be aligned with the documentation and XTTS method and we just didn't feel good with this modification already.
We had also another workaround and it was focused on getting rid of this file:)
That workaround was based on an update to the internal tables;
<SQL>delete file$ where FILE#=65;Question: How much time do you spend/lose?
Question: How much time do you spend/lose?