Samedi 9 juillet 2011 6 09 /07 /Juil /2011 13:05

 

IMPORTER SCHEMA dans un autre avec IMPDP et REMAP_SCHEMA.

Comment importer et déplacer un SCHEMA vers un nouveau SCHEMA dans Oracle ?.

Avec l'option REMAP_SCHEMA de l'utilitaire DATA PUMP IMPORT.

Nous allons voir ici comment importer un schéma vers un nouveau schéma avec l'option REMAP_SCHEMA de l'utilitaire IMPDP.

 

Importer le SCHEMA SCOTT vers un nouveau SCHEMA TEST avec IMPDP.

 
 
C:\>SET ORACLE_SID=DBTEST

C:\>impdp system/pwd schemas=SCOTT directory=DBTEST_EXPORT dumpfile=SCOTT.dmp 
logfile=ISCOTT.log REMAP_SCHEMA=scott:test

Import: Release 10.2.0.1.0 - Production on Saturday, 09 July, 2011 13:25:32

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Release 10.2.0.1.0 - Production
Master table "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01":  system/******** schemas=SCOTT directory=DBTEST_EXPORT
dumpfile=SCOTT.dmp logfile=ISCOTT.log REMAP_SCHEMA=scott:test
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_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 "TEST"."DEPT"                               5.656 KB       4 rows
. . imported "TEST"."EMP"                                7.578 KB       8 rows
. . imported "TEST"."NEW_EMP"                            7.585 KB       8 rows
. . imported "TEST"."SALGRADE"                           5.585 KB       5 rows
. . imported "TEST"."BONUS"                                  0 KB       0 rows
. . imported "TEST"."VEHICULE"                               0 KB       0 rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully completed at 13:25:49


C:\>

 

Connexion au nouveau SCHEMA test.

 
 
C:\>SET ORACLE_SID=DBTEST

C:\>SQLPLUS /NOLOG

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 9 13:34:51 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect TEST/tiger
ERROR:
ORA-01017: nom utilisateur/mot de passe non valide ; connexion refusee

On pourrait penser que le mot de passe du SCHEMA TEST est identique à celui de SCOTT mais ce n'est pas le cas.
Il faut initialiser un nouveau mot de passe pour le nouveau SCHEMA créé avec REMAP_SCHEMA avec un ALTER USER.

Changer le mot de passe de l'utilisateur test Oracle.

 
 
SQL> connect / as sysdba
Connected.
SQL> ALTER USER test IDENTIFIED BY tiger;

User altered.

SQL> connect TEST/tiger
Connected.
SQL>
SQL>

 

Voir les OBJECTS du nouveau SCHEMA Oracle.

 
 
SQL>
SQL> SELECT object_name, object_type FROM USER_OBJECTS;

OBJECT_NAME     OBJECT_TYPE
--------------- -------------------
BONUS           TABLE
SALGRADE        TABLE
NEW_EMP         TABLE
VEHICULE        TABLE
PK_DEPT         INDEX
UN_VEHICULE_ID  INDEX
DEPT            TABLE
EMP             TABLE

8 rows selected.

SQL>

 

Liens en rapport avec l'article et qui sont susceptibles de vous intéresser
• Import Oracle avec IMPDP Data Pump
• Export Oracle avec EXPDP Data Pump

• Create DIRECTORY Oracle pour Export / Import
• Import ORA-39142 incompatible version number in dump file
Par Daniel Roesch - Publié dans : IMPORT / EXPORT
Ecrire un commentaire - Voir les 0 commentaires
Retour à l'accueil

Rechercher Articles Oracle SQL sur ce Site.

Loading

À lire aussi…

Download PDF Oracle

Rechercher sur le site

Oracle 10G - DBA -

Syndication

  • Flux RSS des articles
Contact - C.G.U. - Rémunération en droits d'auteur - Signaler un abus - Articles les plus commentés