作者:kerra璐56_609 | 来源:互联网 | 2023-10-10 14:42
实现一个功能即从本地Oracle导出数据表,文件名为.dmp,然后将该dmp文件导入到另一台主机的oracle表中。感受颇深。主要还是不了解oracle各文件的作用。
首先要更改tnsnames.ora(oracle安装目录中D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora)文件内容:
ORA10G = //本地oracle标识(文件已有内容)
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora10g)
)
)
ORA10G2 = //***远程电脑oracle标识(需添加的)***
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.3.43.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora10g)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PL***tProc)
(PRESENTATION = RO)
)
)
通过导入导出命令:
exp ckkh/ckkh@ora10g file= c:\datanewsmgnt.dmp tables=(ckkh_account,ckkh_account_tmp)
//将本地标识为ora10g的数据库的表数据导出到c盘
imp ckkh/ckkh@ora10g2 file=c:\datanewsmgnt.dmp full=y
//将导出的dmp文件导入到标识为ora10g2的数据库中。