项目背景oracle11g, 已经非常老了, 2017年的左右;谨慎参考
W11直接搜索就行
dbca
唯一需要注意的地方就是一定一定一定要以管理身份运行,否则会提示各种因为文件权限问题报的错误
然后弹出程序提示,图形化开始操作了;
然后一直下一步
比如
ORCL2
你已经有1了,什么SID,全局数据库名称简单一点,不懂选是就行;
可能有的你还没有, 不要着急,
首先有两个文件你一定要注意,甚至会背!!!很关键;
D:\oracleApp\product\11.2.0\dbhome_1\NETWORK\ADMIN
listener.ora
tnsnames.ora
什么TNS错误和没有监听到错误全是这个,下面讲如何配置!!!!, ip不对,写自己的,这个文件是生成的,手动没有更改的权限
我的为例, tnsnames.ora文件
# tnsnames.ora Network Configuration File: D:\oracleApp\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL2 =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.292.60)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
LISTENER_ORCL1 =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.292.60)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL2)
)
)
ORCL1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl1)
)
)
listener.ora文件
# listener.ora Network Configuration File: D:\oracleApp\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER5 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = Oracle8)
(SID_NAME = ORCL1)
)
(SID_DESC =
(GLOBAL_DBNAME = Oracle8)
(SID_NAME = ORCL2)
)
)
ADR_BASE_LISTENER5 = D:\oracleApp
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.292.60)(PORT = 1521))
)
)
ADR_BASE_LISTENER = D:\oracleApp
LISTENER5 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.292.60)(PORT = 1521))
)
!!!!!!!!!!!!!重点!!!!!!!!!!!!!!!!!!
net configuration assistant
//配置监听
net manager
更改配置、删除监听、数据库创建、实例创建、映射ip
点高级,可以配置名称,全局数据库名称, 例如ORCL2 ORCL2
Oracle8改成自己的,都要改,全局数据库和SID指定正确,我一帮用一样的如都是ORCL1等,然后你可以配本地的localhost,和自己的ip, 同事可以连接。配置完之后,上面给的那两个文件的名字会相应的发生变化,也就是通过程序是该那两个文件,否则会提示不让改,你用txt记事本打开。记得配置完成监听之后要重新启动你的listener服务!!!
大家在导入库的时候的命令需要先做目录映射
- 登录
sqlplus sys/123456789@ORCL2 as sysdba
SELECT directory_name,directory_path FROM all_directories WHERE directory_name='V3';
//查看有没有映射
CREATE DIRECTORY V3 AS 'D:\copydata_v3';
//创建映射,好像navicat创建映射还有一点问题
以上是sql执行
!!!!!!!!!!!导入数据泵之前一定要先创建用户!!!!,用户相当于mysql中的库,而oracle竟然可以在一个机器上装多个服务,是不是很牛!!!,虽然会有报错,但是如果是老系统保存关键表的数量就可以了
//开始导入数据库,数据泵,cmd执行
impdp system/123456789@ORCL2 directory= v3 dumpfile=prqu131241015.dmp transform=segment_attributes:N
transform=segment_attributes:N 这个参数是因为如果我不加的话表或者视图太多,他就会表空间不足,高达99%
CREATE USER tpmeaccount IDENTIFIED BY 1234567890;
GRANT CONNECT, RESOURCE TO tpmeaccount;
CREATE DIRECTORY V_account AS 'D:\database_v_open_account';
SELECT directory_name,directory_path FROM all_directories WHERE directory_name='V_ACCOUNT';
//有结果
SELECT directory_name,directory_path FROM all_directories WHERE directory_name='V_account';
//没有结果