Overblog
Editer l'article Suivre ce blog Administration + Créer mon blog
16 juillet 2013 2 16 /07 /juillet /2013 10:34

Hello !!

Et c'est donc parti avec la très attendue 12c. Dans les nouveautés de la 12c, il y en quelques unes qui m'ont fait plaisir non pas que les autres ne me plaisent pas, mais juste parce que sur les versions antérieures, il m'est arrivé de me dire "Et si je pouvais faire cela simplement....".

Dans la série de ces nouveautés, il y a par exemple la possibilité d'effectuer un import en ne générant pas d'archives log... 

La preuve par l'exemple...

Histoire d’illustrer cette nouvelle fonctionnalité, il convient évidemment:

-1/ Ca va de soit, mais ca va mieux en le disant... La base doit être en archivelog !
-2/ D'avoir un schema de test avec quelques données... histoire de générer des archives lors d'un import
Je vais donc commmencer par faire un export de mon schema de test (lao).

 expdp parfile=exp.par Export: Release 12.1.0.1.0 - Production on Sun Jul 21 20:57:11 2013 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** parfile=exp.par Estimate in progress using BLOCKS method... Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 368 MB Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type SCHEMA_EXPORT/STATISTICS/MARKER . . exported "LAO"."T" 133.2 MB 14999990 rows . . exported "LAO"."T1" 133.2 MB 14999990 rows Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is: /ORADB/dump/exp.dmp Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Sun Jul 21 20:57:42 2013 elapsed 0 00:00:28 

 

Pour la petite histoire, le contenu du fichier exp.par

 userid=system/****** schemas=lao directory=exports dumpfile=exp.dmp 

 

Maintenant que nous avons notre fichier d'export, nous allons commencer par faire un import. J'ai choisi d'importer dans un nouveau schema via la clause remap_schemas

 impdp parfile=imp.par Import: Release 12.1.0.1.0 - Production on Sun Jul 21 21:03:03 2013 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/******** parfile=imp.par Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA . . imported "LAO_IMP"."T" 133.2 MB 14999990 rows . . imported "LAO_IMP"."T1" 133.2 MB 14999990 rows Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type SCHEMA_EXPORT/STATISTICS/MARKER Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Sun Jul 21 21:03:45 2013 elapsed 0 00:00:40 

 

De la même façon, ci-dessous le contenu du fichier imp.par

 userid=system/******* remap_schema=lao:lao_imp directory=exports dumpfile=exp.dmp 

 

Ne perdons pas de vue, l'objectif de la démonstration, et allons jeter un œil ou sont stockés mes archives logs.

 ls -lht /ORADB/arch/ total 358M -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_258_820855098.arc -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_257_820855098.arc -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_256_820855098.arc -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_255_820855098.arc -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_254_820855098.arc -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_253_820855098.arc -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_252_820855098.arc -rw-r-----. 1 oracle oinstall 45M Jul 21 21:03 1_251_820855098.arc 

 

Ma base étant en archivelog, c'est tout à fait normalement que mon import a généré son lot d'archives. 8 pour être précis, soit un total de 358 MO. Nous allons maintenant refaire la même manipulation en supprimant au préalable le user lao_imp utilisé pour ce premier import et ajoutant dans le fichie imp.par la ligne suivante: transform=disable_archive_logging:y

 sqlplus /nolog SQL*Plus: Release 12.1.0.1.0 Production on Sun Jul 21 21:11:05 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. SQL> connect / as sysdba Connected. SQL> drop user lao_imp cascade; User dropped. 

 

Histoire de pouvoir plus facilement controler la différence, je vais également supprimer les archives logs présentes

 rm /ORADB/arch/*.arc 

 

ou plus proprement et plus secure...

 rman target / Recovery Manager: Release 12.1.0.1.0 - Production on Sun Jul 21 21:15:15 2013 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. connected to target database: ORADB (DBID=2574119866) RMAN> delete archivelog all; using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=369 device type=DISK List of Archived Log Copies for database with db_unique_name ORADB ===================================================================== Key Thrd Seq S Low Time ------- ---- ------- - --------- 216 1 251 A 21-JUL-13 Name: /ORADB/arch/1_251_820855098.arc 217 1 252 A 21-JUL-13 Name: /ORADB/arch/1_252_820855098.arc 218 1 253 A 21-JUL-13 Name: /ORADB/arch/1_253_820855098.arc 219 1 254 A 21-JUL-13 Name: /ORADB/arch/1_254_820855098.arc 220 1 255 A 21-JUL-13 Name: /ORADB/arch/1_255_820855098.arc 221 1 256 A 21-JUL-13 Name: /ORADB/arch/1_256_820855098.arc 222 1 257 A 21-JUL-13 Name: /ORADB/arch/1_257_820855098.arc 223 1 258 A 21-JUL-13 Name: /ORADB/arch/1_258_820855098.arc Do you really want to delete the above objects (enter YES or NO)? yes deleted archived log archived log file name=/ORADB/arch/1_251_820855098.arc RECID=216 STAMP=821394190 deleted archived log archived log file name=/ORADB/arch/1_252_820855098.arc RECID=217 STAMP=821394191 deleted archived log archived log file name=/ORADB/arch/1_253_820855098.arc RECID=218 STAMP=821394195 deleted archived log archived log file name=/ORADB/arch/1_254_820855098.arc RECID=219 STAMP=821394197 deleted archived log archived log file name=/ORADB/arch/1_255_820855098.arc RECID=220 STAMP=821394204 deleted archived log archived log file name=/ORADB/arch/1_256_820855098.arc RECID=221 STAMP=821394207 deleted archived log archived log file name=/ORADB/arch/1_257_820855098.arc RECID=222 STAMP=821394211 deleted archived log archived log file name=/ORADB/arch/1_258_820855098.arc RECID=223 STAMP=821394213 Deleted 8 objects 

 

Et c'est reparti pour un import ! (n'oubliez pas de modifier votre fichier imp.par et y ajouter transform=disable_archive_logging:y)

 impdp parfile=imp.par Import: Release 12.1.0.1.0 - Production on Sun Jul 21 21:16:55 2013 Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/******** parfile=imp.par Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA . . imported "LAO_IMP"."T" 133.2 MB 14999990 rows . . imported "LAO_IMP"."T1" 133.2 MB 14999990 rows Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type SCHEMA_EXPORT/STATISTICS/MARKER Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Sun Jul 21 21:17:15 2013 elapsed 0 00:00:18 

 

Et dans la foulée, une petite vérification au niveau des mes archives log...

 ls -lht /ORADB/arch/ total 0 

 

Comme attendu, plus aucune archive générée.... On notera également que la durée d'import a été diminué de moitie... Ce qui n'est pas négligeable.

Un monde parfait.... pas tout à fait !

En débutant mes tests, je m'étais dis tout betement que j'allais faire un remap_table pour mon import... et à ma grande surprise, j'ai constaté qu'en utilisant la clause remap_table, l'atttribut disbale_archive_logging n'avait aucun effet... Normal, bug, ai je raté quelque chose... A ce stade, je n'ai pas la réponse.

Quid de disable_archive_logging et dataguard ?

Normalement (c'est un prérequis), dans un environnement dataguard, la base de données est en mode "FORCE LOGGING" et par conséquent, cette nouvelle fonctionnalité de la 12c ne vous sera d'aucune utilité dans un environnement dataguard !

ATTENTION !!!

Si les données importées sont importantes et persistantes, il ne faudrait pas trop tarder à faire un backup full de votre base....

 

@ Bientôt, LAO

Partager cet article
Repost0

commentaires

G
Bonjour.<br /> J'ai constaté aujourd'hui le même problème. Depuis 2 ans, a-t-on eu une explication ? Je n'en trouve nulle part...<br /> Merci !
Répondre
T
<br /> Avant d'écrire des archivelogs Oracle écrit des Redo... et ce sont ces redos qui sont copié en arch. Il aurait été plus pertinent de verifier v$systat "redo blocks written", "redo writes"<br /> <br /> <br /> PS: la feature ne fonctionne pas d'apres mes tests<br /> <br /> <br /> @+<br />
Répondre
L
<br /> <br /> Bonjour "toto";<br /> <br /> <br /> Merci pour cette remarque pertinente. J'en prends note. Je viens de retester.  En ce qui me concerne ca fonctionne, à la remarque près que j'ai émise en fin d'article. A savoir que cele ne<br /> fontionne pas avec l'option remap_table<br /> <br /> <br /> @+<br /> <br /> <br /> <br />