赞
踩
[oracle12c linux安装教程
],安装后还需要对数据库进行其他设置。
oracle用户下
cd $ORACLE_HOME/network/admin
vim listener.ora
添加如下内容
SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /home/oracle/app/oracle/product/12.2.0/dbhome_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orclpdb)
(ORACLE_HOME = /home/oracle/app/oracle/product/12.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
同样也是 $ORACLE_HOME/network/admin 目录下修改 tnsnames.ora文件,
添加入内容:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
lsnrctl stop
lsnrctl start
lsnrctl status
重启使用 lsnrctl reload 也开业
看到是有一个unknown,unknown是动态监听可以不用管。
使用tnsping 检测是否正常ping上新配置的监听
tnsping orclpdb
正常ping通。
找到本地TNS_ADMIN 配置路径
修改 tnsnames.ora。
添加如下内容
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.66)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
本地打开dos命令窗口,使用sqlplus 可以正常连接orclpdb
conn sys/密码@192.168.8.66:1521/orclpdb as sysdba
2.1 dbstart配置
oracle 用户 下
cd $ORACLE_HOME/bin
vim dbstart
将 ORACLE_HOME_LISTNER=$1改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
切换到root用户,
vim /etc/oratab
添加如下内容
orcl:/home/oracle/app/oracle/product/12.2.0/dbhome_1:Y
cd /etc/rc.d
vim rc.local
添加如下内容
su oracle -lc /home/oracle/app/oracle/product/12.2.0/dbhome_1/bin/dbstart
su oracle -lc "/home/oracle/app/oracle/product/12.2.0/dbhome_1/bin/lsnrctl start"
第二个命令需要引号, 中命令有空格。
授予执行权限
chmod 755 rc.local
手动执行
./rc.local
看到能启动成功
重启后,
sqlplus /nolog
conn /as sysdba
select global_name from global_name;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。