标签:c++ process get proc tca taf 压缩 port permanent
我以 CentOS-7-x86_64-DVD-1511.iso 为例,简述Oracle 11g的安装过程。
由于是使用静默模式(silent)安装的,无需使用图形化界面,我选择了最小安装的服务器版的CentOS 7。
安装过程可参考 https://jingyan.baidu.com/article/fd8044fade8ac35031137a82.html
安装完成后,只有命令行界面。
Oracle官方网站
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/
根据操作系统的版本进行下载Oracle安装包,11.2.0.2.0 zlinux64版本的Oracle是安装在IBM服务器的,CentOS 7是无法安装的。
下载完成后,有两个压缩文件
安装依赖包之前,个人建议将yum源修改为aliyun源,下载速度快些,执行如下命令即可:
cd /etc mv yum.repos.d yum.repos.d.bak mkdir yum.repos.d wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all yum makecache
修改成功后,安装如下依赖包:
yum -y install 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
使用如下命令检查依赖是否安装完整
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"
发现 pdksh 没有安装
执行yum -y install pdksh,发现CentOS 7 没有相关安装包可用
通过wget命令直接下载pdksh的rpm包,我下载到了/tmp/
wget -O /tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
下载完成后,进入 /tmp/
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
再次检查依赖包是否安装完整
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"
到此依赖包安装完整
groupadd oinstall
groupadd dba
groupadd asmadmin
groupadd asmdba
useradd -g oinstall -G dba,asmdba oracle -d /home/oracle
添加完成后,查看oracle用户
id oracle
初始化oracle用户的密码
passwd oracle
vim /etc/hosts
192.168.154.154 centos-oracle
测试hostname
ping -c 3 centos-oracle
kernel.shmmax 参数设置为物理内存的一半
vim /etc/sysctl.conf
fs.aio-max-nr=1048576
fs.file-max=6815744
kernel.shmall=2097152
kernel.shmmni=4096
kernel.shmmax = 1073741824
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
使参数生效
sysctl -p
vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
vim /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
mkdir -p /db/app/oracle/product/11.2.0 mkdir /db/app/oracle/oradata mkdir /db/app/oracle/inventory mkdir /db/app/oracle/fast_recovery_area chown -R oracle:oinstall /db/app/oracle chmod -R 775 /db/app/oracle
su - oracle
vim .bash_profile
umask 022
export ORACLE_HOSTNAME=centos-oracle
export ORACLE_BASE=/db/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/
export ORACLE_SID=ORCL
export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
以上配置完成后,个人建议重启下系统
reboot
cd /tmp
unzip linux.x64_11gR2_database_1of2.zip -d /db
unzip linux.x64_11gR2_database_2of2.zip -d /db
解压完成后
mkdir /db/etc/
cp /db/database/response/* /db/etc/
vim /db/etc/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
DECLINE_SECURITY_UPDATES=true
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/db/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOSTNAME=centos-oracle
ORACLE_HOME=/db/app/oracle/product/11.2.0
ORACLE_BASE=/db/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
开始安装
su - oracle./runInstaller -silent -responseFile /db/etc/db_install.rsp -ignorePrereq
安装期间可以使用tail命令监看oracle的安装日志
tail -f /db/app/oracle/inventory/logs/installActions2017-07-12_03-48-29PM.log
安装完成,提示Successfully Setup Software.
根据提示完成配置
su root
sh /db/app/oracle/inventory/orainstRoot.sh
sh /db/app/oracle/product/11.2.0/root.sh
su - oracle
netca /silent /responsefile /db/etc/netca.rsp
查看监听端口
netstat -tnulp | grep 1521
TOTALMEMORY 设置为总内存的80%
vi /db/etc/dbca.rsp
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/db/app/oracle/oradata
RECOVERYAREADESTINATION=/db/app/oracle/fast_recovery_area
CHARACTERSET = "AL32UTF8"
TOTALMEMORY = "1638"
执行静默建库
dbca -silent -responseFile /db/etc/dbca.rsp
查看oracle实例进程
ps -ef | grep ora_ | grep -v grep
查看监听状态
lsnrctl status
登录sqlplus,查看实例状态
sqlplus / as sysdbaselect status from v$instance;
出现以下情况,解决方式如下:输入startup,根据提示信息,将$ORACLE_BASE/admin/数据库名称/pfile目录下的init.ora.xxx形式的文件copy到$ORACLE_HOME/dbs目录下initoracle.ora(根据startup提示)即可。
查看数据库编码
select userenv(‘language‘) from dual;
查看数据库版本信息
select * from v$version;
激活scott用户
alter user scott account unlock;alter user scott identified by tiger;select username,account_status from all_users;
开放1521端口
firewall-cmd --zone=public --add-port=1521/tcp --permanentfirewall-cmd --reload
官方网站
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
下载 instantclient-basic,解压压缩文件
下载Navicat
http://pan.baidu.com/s/1c2GP9U4
打开Navicat,工具→选项
打开OCI界面,在右侧OCI library一栏中选择instantclient-basic解压目录下的oci.dll,然后点击确定。
重启Navicat,点击连接,选中Oracle
IP为Oracle服务器的IP地址,服务名为Oracle的实例名,可忽略大小写
select instance_name from v$instance;
用户名使用刚激活的scott,密码为tiger,填完以上信息后点击连接测试
到此Navicat远程连接Oracle数据库成功。
vi /db/app/oracle/product/11.2.0/bin/dbstart
ORACLE_HOME_LISTNER=$ORACLE_HOME
vi /db/app/oracle/product/11.2.0/bin/dbshut
ORACLE_HOME_LISTNER=$ORACLE_HOME
vi /etc/oratab
`orcl:/db/app/oracle/product/11.2.0:Y
vi /etc/rc.d/init.d/oracle
#! /bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/db/app/oracle/product/11.2.0
ORACLE_USER=oracle
case "$1" in
‘start‘)
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
‘stop‘)
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
‘restart‘)
$0 stop
$0 start
;;
‘status‘)
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
开机启动oracle
systemctl enable oracle
oracle ORA-12547: TNS:lost contact
cd /db/app/oracle/product/11.2.0/bin/
chmod 6751 oracle
TNS-12555: TNS:permission denied
cd /var/tmp
chown -R oracle:oinstall .oracle
转载地址:https://blog.csdn.net/h8178/article/details/78251198
标签:c++ process get proc tca taf 压缩 port permanent
原文地址:https://www.cnblogs.com/yylyu/p/10662420.html