The remote database user test has a t table.
- SQL> showUser
- USERIs"TEST"
- SQL>Select*FromTab;
- TNAME TABTYPE CLUSTERID
- -----------------------------------------------
- TTABLE
- SQL>! Cat/etc/hosts
- # DoNotRemove the following line,OrVarious programs
- # That require network functionality will fail.
- 127.0.0.1 linux localhost. localdomain localhost
- : 1 localhost6.localdomain6 localhost6
- 10.10.10.7 linux localhost. localdomain localhost
The local database user ing does not have a t table.
- SQL> showUser
- USERIs"ING"
- SQL>Select*FromTabWhereTname ='T';
- Unselected row
- SQL>! Cat/etc/hosts
- # DoNotRemove the following line,OrVarious programs
- # That require network functionality will fail.
- 127.0.0.1 linux localhost. localdomain localhost
- : 1 localhost6.localdomain6 localhost6
- 10.10.10.8 linux localhost. localdomain localhost
- 10.10.10.8 linux
- 10.10.10.8 localhost
Now, we need to import all objects under user test to user ing.
1. Create a database link object and link it to the database server of 10.10.10.7.
- SQL> conn system/Oracle
- Connected.
- SQL> showUser
- USERIs"SYSTEM"
- SQL>Create DatabaseLink link7Connect ToTest identifiedByTest using'10. 10.10.7/orcl';
- The database link has been created.
- SQL>Select Count(*)FromTest. t @ link7;
- COUNT(*)
- ----------
- 50027
2. the user test of the Remote Data 10.10.10.7 must have the exp_full_database permission.
- SQL> conn/AsSysdba
- Connected.
- SQL> showUser
- USERIs"SYS"
- SQL>GrantExp_full_databaseToTest;
- Authorization successful.
3. Execute export on the 10.10.10.8 server.
- [Oracle @ linux exp] $ expdp system/oracle @ orcl network_link = link7 directory = exp schemas = test
- Export: Release 10.2.0.4.0-ProductionOnWednesday, October, 2011 19:48:57
- Copyright (c) 2003,200 7, Oracle.AllRights reserved.
- Connect to: OracleDatabase10g Enterprise Edition Release 10.2.0.4.0-Production
- WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options
- Start"SYSTEM"."SYS_EXPORT_SCHEMA_01": System/******** @ orcl network_link = link7 directory = exp schemas = test
- Using the BLOCKS Method for estimation...
- Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
- Total estimation using the BLOCKS method: 6 MB
- 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/PRE_SCHEMA/PROCACT_SCHEMA
- Processing object type SCHEMA_EXPORT/TABLE/TABLE
- .. Exported"TEST"."T"4.667 MB 50027 rows
- The master table is successfully loaded/uninstalled."SYSTEM"."SYS_EXPORT_SCHEMA_01"
- **************************************** **************************************
- The dump file set of SYSTEM. SYS_EXPORT_SCHEMA_01 is:
- /U01/exp/expdat. dmp
- Job"SYSTEM"."SYS_EXPORT_SCHEMA_01"Completed successfully at 19:50:10
4. Run the import command on the 10.10.10.8 server.
- [Oracle @ linux exp] $ impdp system/oracle @ orcl directory = exp dumpfile = expdat. dmp remap_schema = test: ing
- Import: Release 10.2.0.4.0-ProductionOnWednesday, October, 2011 19:51:24
- Copyright (c) 2003,200 7, Oracle.AllRights reserved.
- Connect to: OracleDatabase10g Enterprise Edition Release 10.2.0.4.0-Production
- WithThe Partitioning, OLAP, Data MiningAnd RealApplication Testing options
- The master table is successfully loaded/uninstalled."SYSTEM"."SYS_IMPORT_FULL_01"
- Start"SYSTEM"."SYS_IMPORT_FULL_01": System/******** @ orcl directory = exp dumpfile = expdat. dmp remap_schema = test: ing
- Processing object type SCHEMA_EXPORT/USER
- ORA-31684: object type.USER:"ING"Already exists-- This user is not automatically created here.
- 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/PRE_SCHEMA/PROCACT_SCHEMA
- Processing object type SCHEMA_EXPORT/TABLE/TABLE
- Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
- .. Imported"ING"."T"4.667 MB 50027 rows
- Job"SYSTEM"."SYS_IMPORT_FULL_01"Completed, but there is an error (completed at 19:51:28)
5. Check the user ing on 10.10.10.8.
- SQL> conn ing/ing
- Connected.
- SQL> showUser
- USERIs"ING"
- SQL>Select*FromTabWhereTname ='T';
- TNAME TABTYPE CLUSTERID
- -----------------------------------------------
- TTABLE
- SQL>Select Count(*)FromT;
- COUNT(*)
- ----------
- 50027
Note: The imported users have unlimited power to use the table space: alter user ing quota unlimited on users; the system users here certainly have this power. This can be done for a small database because it depends on the network. For large databases, export data from the data source and copy the data to the target database for import.