Windows下安装Oracle Database 12c Release 1(12.1.0.2.0)
最近因需要在Oracle 数据库上建立ODI的资料档案库,需要安装Oracle Database 12c Release 1(12.1.0.2.0) - Enterprise Edition 。
软件下载
安装过程
软件更新配置,跳过:
选择安装方式,安装并配置一个数据库实例
选择系统类型,桌面类
指定Windows用户
典型安装:配置安装路径、存储器类型、全局数据库名和数据库密码、容器数据库名称
先决条件检查
安装概要
开始安装
安装过程中创建数据库
指定口令
安装完成
安装完成,可通过https://localhost:5500/em登入Enterprise Manager,查看数据库和实例的信息。如下端示:
ORA-01219可插入数据库未打开
安装完成后,用navicat测试连接orcl成功
测试pdborcl失败
参考文章http://www.xifenfei.com/4432.html,解决办法如下
设置Oracle 12c pdb自动启动
CREATE TRIGGER open_all_pdbs AFTER STARTUP ON DATABASE BEGIN EXECUTE IMMEDIATE 'alter pluggable database all open' ; END open_all_pdbs ;
tnsnames.ora
此时tnsnames.ora内容
# tnsnames.ora Network Configuration File: C:\app\ORACLE\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
可以把pdborcl的也添加进tnsnames.ora
# tnsnames.ora Network Configuration File: C:\app\ORACLE\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
PDBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
tnsping命令测试、连接就都能成功了
也可以不在tnsnames.ora中添加pdborcl,通过登陆了cdb后
alter session set container=pdborcl