- 0x00 Centos7安装Oracle11g
- 0x01 Oracle11g安装配置入坑记
0x00 Centos7安装Oracle11g
环境准备:
VM12 + centos7 x86_64_minimal.iso #最小化安装的Centos7
Oracle Version: Oracle Database 11g Release 2 (11.2.0.1.0)
#要求:
RAW Swap
1G至2G 1.5倍
2G至16G 同RAW相等
16G以上 16G
#虚拟机配置:
- 60G 硬盘
- 4G ram + 2G swap
#项目实施:
IP:192.168.136.128
hostname: oracle11
账号密码:root/oracel
sySTEM@2019!
SID: orcl
服务名称:orcl.db1
密码:sySTEM@2019!
安装流程与步骤:
#Step1.建立虚拟机导入centos7,minimal镜像并启动
关键点1:系统语言选择要将English勾选上
关键点2:磁盘分区进行手动分区,将交换分区进行调整;
$lsb_release -a #查看版本信息
CentOS Linux release 7.6.1810 (Core)
3.10.0-957.el7.x86_64
#Step2.系统环境调整
步骤1.开启sshd服务并且允许root进行登录
sed -i 's/#PermitRootLogin/PermitRootLogin/g' /etc/ssh/sshd_config
systemctl restart sshd
步骤2.安装必要的软件包源和软件与环境调整
# ( 关闭安全措施)
sed -i.bak '/SELINUX/s/enforcing/disabled/' /etc/sysconfig/selinux
echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted " >> /etc/selinux/config
setenforce 0
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service #重启机器(注意)
# 软件源更新
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache
yum update -y && yum upgrade -y
yum install -y nano vim net-tools tree wget dos2unix unzip ntpdate
# From Public Yum or ULN
yum -y install autoconf \
automake \
binutils \
binutils-devel \
bison \
cpp \
gcc \
gcc-c++ \
lrzsz \
python-devel \
compat-db* \
compat-gcc-34 \
compat-gcc-34-c++ \
compat-libcap1 \
compat-libstdc++-33 \
compat-libstdc++-33.i686 \
glibc-* \
glibc-*.i686 \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
libXpm-*.i686\
libXp.so.6 \
libXt.so.6 \
libXtst.so.6 \
libXext \
libXext.i686 \
libXtst \
libXtst.i686 \
libX11 \
libX11.i686 \
libXau \
libXau.i686 \
libxcb \
libxcb.i686 \
libXi \
libXi.i686 \
libXtst \
libstdc++-docs \
libgcc_s.so.1 \
libstdc++.i686 \
libstdc++-devel \
libstdc++-devel.i686 \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
ksh \
libXp \
libaio-devel \
numactl \
numactl-devel \
make \
sysstat \
unixODBC \
unixODBC-devel \
elfutils-libelf-devel-0.97 \
elfutils-libelf-devel \
elfutils-libelf \
elfutils-libelf-devel \
libgcc \
expat
#检查依赖是否安装完整:
rpm -q \
binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
expat \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
pdksh \
sysstat \
unixODBC \
unixODBC-devel | grep "not installed"
#系统语言与java环境设置
echo "export LANG=en_US.UTF8" >> ~/.bash_profile
source ~/.bash_profile
#系统hosts绑定
hostname oracle11 #在/etc/hosts文件中将hostname与回环IP地址对应上就解决了。
echo "192.168.136.128 oracle11"
# Java SE Development Kit 8u211
$tar -zxvf jdk-8u211-linux-x64.tar.gz -C /usr/local/
$vi /etc/profile
#Java Env
export JAVA_HOME=/usr/local/jdk1.8.0_211/
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar;
export PATH=$PATH:$JAVA_HOME/bin
#更新环境变量
$source /etc/profile
$java -version #验证安装
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
步骤3.建立oracle应用账号与组
/usr/sbin/groupadd -g 60001 oinstall
/usr/sbin/groupadd -g 60002 dba
/usr/sbin/groupadd -g 60003 oper
/usr/sbin/groupadd -g 60004 backupdba
/usr/sbin/groupadd -g 60005 dgdba
/usr/sbin/groupadd -g 60006 kmdba
/usr/sbin/useradd -u 61002 -g oinstall -G dba,backupdba,dgdba,kmdba,oper oracle #oracle用户
passwd oracle #设置weiyiegeek@2019
步骤4.使用oracle提供的环境配置工具(速度感人,还是手动调整内核参数)
# wget http://public-yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repo
# wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
# yum install oracle-rdbms-server-11gR2-preinstall -y
步骤5.建立数据库目录安装
#oracle安装的目录&授权
#/opt/oracle/product/11.2.0.1/db1 家目录
#/opt/oracle/oraInventor 数据库创建及使用过程中的日志目录
#/opt/oracle/oradata 数据目录
#/opt/oracle/tmp 临时目录
#/opt/oracle/recovery_data //数据恢复目录
mkdir -pv /opt/oracle/product/11.2.0.1/db1 /var/oracle /opt/oracle/oraInventor /opt/oracle/oradata /opt/oracle/tmp
chown -R oracle:oinstall /var/oracle /opt/oracle/
chmod -R 755 /var/oracle /opt/oracle/
chmod a+wr /opt/oracle/tmp
#配置oracle系统配置文件&授权
cat >> /etc/oraInst.loc <<EOF
inventory_loc=/opt/oracle/oraInventor
inst_group=oinstall
EOF
chown oracle:oinstall /etc/oraInst.loc && chmod 664 /etc/oraInst.loc
步骤6.调整内核参数(优化配置)
$vi /etc/security/limits.conf
#ORACLE SETTING
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 65536
grid hard nofile 65536
grid soft stack 32768
grid hard stack 32768
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft stack 32768
oracle hard stack 32768
oracle hard memlock 6000000
oracle soft memlock 6000000
echo "session required pam_limits.so" >> /etc/pam.d/login
echo "session required /lib64/security/pam_limits.so" >> /etc/pam.d/login
cat /etc/pam.d/login #查看上面即可
vi /etc/sysctl.conf
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
kernel.panic_on_oops = 1
kernel.shmmax = 2033164800 #kernel.shmmax 参数设置为物理内存的一半
kernel.shmall = 1228800
kernel.shmmni = 4096
vm.nr_hugepages = 1000 #注意实际环境值,系统8G内存的大内存页参数(2500)
$sysctl -p #执行查看保存后生效命令
步骤7.查看内核配置文件是否存在和grup配置
$cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
$cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
$vi /etc/rc.d/rc.local #更改自启判断文件是否存在
if test -f /sys/kernel/mm/transparent_hugepage/enabled;then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
$chmod +x /etc/rc.d/rc.local
$vi /etc/default/grub
numa=off #(在auto rhgb quiet 后面加上numa=off)
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet" numa=off
mkdir -pv /opt/oracle/product/11.2.0.1/db1 /var/oracle /opt/oracle/oraInventor /opt/oracle/oradata /opt/oracle/tmp
配置用户环境:
步骤8.配置用户环境shell
$su - oracle #使用Oracle用户登陆:
$vi .bash_profile
umask 022
export PS1="[`whoami`@`hostname`:"'$PWD]$'
export LANG=en_US
# +--------------------------+
# | SETUP ORACLE ENVIRONMENT |
# +--------------------------+
export TMP=/opt/oracle/tmp
export TMPDIR=$TMP
ORACLE_HOSTNAME=oracle11
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.1/db1
ORACLE_SID=orcl
ORACLE_TERM=xterm;
PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
#THREADS_FLAG=native; export THREADS_FLAG
export ORACLE_HOSTNAME ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_TERM PATH NLS_DATE_FORMAT NLS_LANG
$source .bash_profile #执行生效
#配置环境变量shell
$vi /etc/profile #增加下面行:
if [ $USER = "oracle" ] || [ $USER = "grid" ] ; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
$source /etc/profile
下载Oracle的Linux版本(并进行解压):
下载地址:https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
#采用迅雷下载也可以
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip
#建VM立共享然后解压oracle安装程序到自定目录
unzip linux.x64_11gR2_database_1of2.zip -d /home/oracle/
unzip linux.x64_11gR2_database_2of2.zip -d /home/oracle/
chown -R oracle:oinstall /home/oracle/ #防止权限问题
配置db_install.rsp(自动安装应答文件)
#将解压目录中的reponse进行备份
cp -r /home/oracle/database/response/ /home/oracle
mkdir -pv /opt/oracle/product/11.2.0.1/db1 /var/oracle /opt/oracle/oraInventor /opt/oracle/oradata /opt/oracle/tmp
#配置安装响应文件db_install.rsp文件 这里配置参数先下载到本地 用记事本根据自己情况修改 在上传过去
$cat /root/response/db_install.rsp | grep -E -v "^#" | tr -s '\n'
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_AND_CONFIG
#机器名称和组
ORACLE_HOSTNAME=oracle11
UNIX_GROUP_NAME=oinstall
#前面设置的目录
INVENTORY_LOCATION=/opt/oracle/oraInventor
SELECTED_LANGUAGES=zh_CN,en
#oracle环境基础设置
ORACLE_HOME=/opt/oracle/product/11.2.0.1/db1
ORACLE_BASE=/opt/oracle/product/
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
#服务名
oracle.install.db.config.starterdb.globalDBName=orcl.db1
#实例名称
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
#根据系统实际情况设置我这里分2G给他
oracle.install.db.config.starterdb.memoryLimit=1880
oracle.install.db.config.starterdb.installExampleSchemas=true
oracle.install.db.config.starterdb.enableSecuritySettings=true
#密码默认设置不设置安装时会提示
oracle.install.db.config.starterdb.password.ALL=Oracle@123
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/opt/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
静默安装数据库
#安装 Oracle11g
/home/oracle/database/runInstaller -silent -ignorePrereq -responseFile /home/oracle/db_install.rsp
# Starting Oracle Universal Installer...
# Checking Temp space: must be greater than 120 MB. Actual 53477 MB Passed
# Checking swap space: must be greater than 150 MB. Actual 2047 MB Passed
# Preparing to launch Oracle Universal Installer from /opt/oracle/tmp/OraInstall2019-06-21_01-28-41AM.
# Preparing to launch Oracle Universal Installer from /opt/oracle/tmp/OraInstall2019-06-21_01-37-00AM. Please wait ...[oracle@oracle11:/home/oracle]$You can find the log of this install session at:
/opt/oracle/oraInventor/logs/installActions2019-06-21_01-37-00AM.log
#新建立一个终端查看安装信息:
$tail -f /opt/oracle/oraInventor/logs/installActions2019-06-21_01-37-00AM.log
# INFO: Installation in progress
# INFO: Extracting files to '/opt/oracle/product/11.2.0.1/db1'.
# INFO: Extracting files to '/opt/oracle/product/11.2.0.1/db1'.
# INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_exp_1.xml'.
# INFO: Performing fastcopy operations based on the information in the file 'racfiles.jar'.
# INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_dirs.lst'.
# INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_filemap.jar'.
# INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_1.xml'.
# INFO: Performing fastcopy operations based on the information in the file 'setperms1.sh'.
# INFO: Number of threads for fast copy :1
# INFO: Validating state <finish>
# WARNING: Validation disabled for the state finish
# INFO: Completed validating state <finish>
# INFO: Terminating all background operations
# INFO: Terminated all background operations
# INFO: Successfully executed the flow in SILENT mode
# INFO: Finding the most appropriate exit status for the current application
# INFO: Exit Status is 3
# INFO: Shutdown Oracle Database 11g Release 2 Installer #代表安装成功
# INFO: Unloading Setup Driver
#切换到root账号
/opt/oracle/product/11.2.0.1/db1/root.sh
#Check /opt/oracle/product/11.2.0.1/db1/install/root_oracle11_2019-06-21_20-58-13.log for the output of root script
数据库的启动&关闭
[root] #修改oracle服务启动配置
vi /etc/oratab
orcl:/opt/oracle/product/11.2.0.1/db1:Y # //把“N”改成“Y”
[oracle] #切换用户
#启动oracle
#因为修改了/etc/oratab N->y 所以启动服务也会同时启动实例的情况不,会同时启动实例
#sqlplus sqlplus登录会提示 an idle instance --> startup启动实
#(1)启动/停止监听
$lsnrctl start
$lsnrctl stop #停止监听x
#(2)通过dbstart 启动此实例,监听器
# dbstart $ORACLE_HOME
# #关闭( oracle的进程关闭,监听器也停止)
# dbshut $ORACLE_HOME
#(3)切换用户[#oracle]
#启动oracle
#因为修改了/etc/oratab N->y 所以启动服务也会同时启动实例的情况不,会同时启动实例
#sqlplus sqlplus登录会提示 an idle instance --> startup启动实
$lsnrctl status #查看oracle状态
# LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-JUN-2019 19:49:15
# Copyright (c) 1991, 2009, Oracle. All rights reserved.
# Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
# STATUS of the LISTENER
# ------------------------
# Alias LISTENER
# Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
# Start Date 21-JUN-2019 19:24:44
# Uptime 0 days 0 hr. 24 min. 30 sec
# Trace Level off
# Security ON: Local OS Authentication
# SNMP OFF
# Listener Parameter File /opt/oracle/product/11.2.0.1/db1/network/admin/listener.ora
# Listener Log File /opt/oracle/diag/tnslsnr/oracle11/listener/alert/log.xml
# Listening Endpoints Summary...
# (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
# (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle11)(PORT=1521)))
# Services Summary...
# Service "orcl.db1" has 1 instance(s).
# Instance "orcl", status READY(这才是正常状态), has 1 handler(s) for this service...
# Service "orclXDB.db1" has 1 instance(s).
# Instance "orcl", status READY, has 1 handler(s) for this service...
# The command completed successfully
#远程连接oracle
$sqlplus sys/passoracle@192.168.138.136:1521/orcl.db1 as sysdba #ORCL.LAN是服务名 不是sid
$sqlplus sys/passoracle#123@127.0.0.1:1521/orcl.db1 as sysdba
$sqlplus sys/passoracle#123@oracle:1521/orcl.db1 as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jun 21 21:04:53 2019
> conn sys/passoracle@192.168.100.131:1521/ORCL.LAN as sysdba #登录后才能使用
#初次登录配置
$ sqlplus /nolog
$ sqlplus / as sysdba #是系统用户登录的方式
# 进入系统管理用户
SQL> conn / as sysdba
Connected to an idle instance.
# 启动oracle实例
SQL> startup;
SQL> show user
SQL> select INSTANCE_NAME,HOST_NAME from v$instance;
# 停止oracle实例
SQL> shutdown immediate
建库实例:
#静默dbca建库编辑应答文件(与上面的db_install对应):
[oracle@oracle ~]$ vi /etc/dbca.rsp
GDBNAME="orcl.oracle"
SID="orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
CHARACTERSET="AL32UTF8"
NATIONALCHARACTERSET="UTF8"
# 执行至此完成数据库实例的创建。
[oracle@oracle ~]$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp
#删除实例:
[oracle@oracle ~]$ dbca -silent -deleteDatabase -sourcedb orcl
#配置监听程序:
# [oracle@oracle bin]$ /opt/oracle/product/11.2.0.1/db1/netca /silent /responseFile /home/oracle/etc/netca.rsp
防火墙调整
#防火墙 放行1521端口
firewall-cmd --zone=public --add-port=1521/tcp --permanent
#重新加载防火墙规则
firewall-cmd --reload
开机自启
描述:默认以安装ORACLE环境作为演示CentOS7
#Step1.查看ORACLE_HOME是否设置并且编辑/etc/oratab文件设置服务自动启动
echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
#dbca建库时都会自动创建/etc/oratab文件
#将orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N #将N转换成为Y
#Step2.编辑dbstart 数据库自带启动脚本
vim +80 /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
#编辑 dbstart 将 ORACLE_HOME_LISTNER=$1 修改成 ORACLE_HOME_LISTNER=$ORACLE_HOME 前提是$ORACLE_HOME环境设置正确
#Step3.将下数据库自启动命令放入/etc/rc.d/rc.local中
$vim /etc/rc.d/rc.local
su oracle -lc "/opt/oracle/product/11.2.0.1/db1/bin/lsnrctl start"
su oracle -lc /opt/oracle/product/11.2.0.1/db1/bin/dbstart
#Step4.查看数据库是否处于open状态
select status from v$instance
0x01 Oracle11g安装配置入坑记
问题日志:
#dbstart日志
/opt/oracle/product/11.2.0.1/db1/startup.log
#监听器日志
/opt/oracle/diag/tnslsnr/oracle11/listener/alert/log.xml
问题1:libnjni11.so包导致java.lang.UnsatisfiedLinkError
#netca配置静默监听出错
java.lang.UnsatisfiedLinkError: /db/app/oracle/product/11.2.0/lib/libnjni11.so: libclntsh.so.11.1
#解决方法:
cp $ORACLE_HOME/inventory/Scripts/ext/lib/libclntsh.so.11.1 $ORACLE_HOME/lib/
问题2:安装oracle11g时候错误信息INFO: Oracle Net Services configuration failed. The exit code is 1
INFO: Oracle Net Configuration Assistant failed.
INFO: Oracle Net Configuration Assistant failed.
#解决方法:
查看/etc/hosts中是否添加该主机的机器名和回环地址
问题3:错误信息:ORA-12162: TNS:net service name is incorrectly specified
[oracle@oracle bin]$ ./sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat May 25 00:20:45 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
# 解决方式:
1、系统当前的ORACLE_HOME和ORACLE_SID环境变量
2、给出ORACLE_SID,重新尝试登录:
问题4.ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
报错信息:oracle 11g ORA-12514:TNS:监听程序当前无法识别连接描述符中请求的服务
解决方法1:
vim /opt/oracle/product/11.2.0.1/db1/network/admin/listener.ora
#添加SID名称
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl.db1)
(ORACLE_HOME = /opt/oracle/product/11.2.0.1/db1/)
(SID_NAME = orcl)
)
)
#HOST指定后需要查看对应的/etc/hosts中IP是否正确
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle11)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/oracle
解决方法二:
登录数据库:
$sqlplus / as sysdba
显示服务名:
SQL>show parameter service_names
强制注册服务:
SQL>alter system register;
查看监听状态:
$lsnrctl status
问题5.Instance "orcl", status UNKNOWN, has 1 handler(s) for this service.
实例化status UNKNOWN 没有正常的启动成功,需要dbstart后才分配内存
/opt/oracle/product/11.2.0.1/db1/bin/dbstart $ORACLE_HOME