I. Environmental description
SOURCE database:
IP Address: 192.168.137.100
Sid:catalog
User name: Rman
Password: Rman
Target database:
IP Address: 192.168.137.101
Sid:orcl
User name: Rman
Password: Rman
Create a tnsname to the source database on the target database
Login to target database with ORACLE user, modify $ORACLE _home/network/admin/tnsnames.ora file, add the following
Copy Code code as follows:
Catalog =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 192.168.137.100) (PORT = 1521))
)
(Connect_data =
(SID = catalog)
)
)
After modifying this file, execute the following command to test whether the Tnsname is created correctly
$ tnsping Catalog
If the end of the return result is OK (0 msec), it proves that Tnsname was created successfully and that the next step is done
third, create Dblink
The statement that creates the Dblink is
CREATE DATABASE link <database link name> CONNECT to <remote DATABASE user name> identified by <remote data Base password> USING ' <tnsname connect to remote> '
Log on to the target database server as an Oracle user and perform the following actions
Copy Code code as follows:
$ sqlplus Rman/rman
sql> CREATE DATABASE LINK dmp_link CONNECT to Rman identified by Rman USING ' catalog ';
*************************************
If you appear
Copy Code code as follows:
ERROR at line 1:
Ora-01031:insufficient Privileges
You need to use SYSDBA identity, execute the following statement, grant the user the right to create Dblink, and then execute the statement above to create the Dblink again
Grant CREATE database link to Rman;
*************************************
Then execute the following statement to test whether the Dblink was created successfully and return the results to prove that Dblink was created successfully
Copy Code code as follows:
Sql> select Tname from Tab@dmp_link;
Sql> exit;
iv. Creating directory objects on the target database
Log on to the target database with an Oracle user
1, create a directory, assumed to be/oracle/dmp, and ensure that this directory Oracle users can read and write
2. Log in to the database as SYSDBA, create directory objects, and give this object read and write access
3, and then log on to the database, execute the following statement:
Copy Code code as follows:
$ sqlplus/as SYSDBA
sql> Create or replace directory Dmp_dir as '/oracle/dmp ';
Sql> Grant Read,write on directory Dmp_dir to public;
Sql> exit;
v. Execute the IMPDP command on the target database and import the data
IMPDP RMAN/RMAN/ORCL Network_link=dmp_link Remp_schema=source_schema:target:shcema remap_tablespace=source_ Tablespace:target:tablespace
If you want to import a database directly without generating the DMP file, use the IMPDP band Network_link directly, so that you can impdp directly, bypassing the EXPDP steps.