hostnamectl set-hostname trisdb
vi /etc/hosts
在vi /etc/hosts中添加
192.168.44.171 trisdb
vi /etc/selinux/config
sudo setenforce 0
将此行SELINUX=enforcing修改为SELINUX=disabled
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
systemctl stop firewalld
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle
echo "123456" | passwd --stdin oracle && id oracle
vim /etc/sysctl.conf
#添加以下内容
# oracle11g configure
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1073741824
kernel.shmmni = 4096
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 = 1048576
#使内核新配置生效
/sbin/sysctl -p
vim /etc/security/limits.conf
#添加以下内容
# oracle11g configure
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
vim /etc/pam.d/login
#添加以下内容
# oracle11g configure
session required /lib64/security/pam_limits.so
session required pam_limits.so
vim /etc/profile
# 添加以下内容
# oracle11g configure
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
# 使之生效
source /etc/profile
mkdir -p /usr/local/oracle11g/oracle/product/11.2.0/dbhome_1
mkdir -p /usr/local/oracle11g/oracleapp
mkdir -p /usr/local/oracle11g/oracle/oracledata
mkdir -p /usr/local/oracle11g/oracle/oradata
chmod -R 775 /usr/local/oracle11g/oracleapp
chmod -R 775 /usr/local/oracle11g/oracle
chown -R oracle:oinstall /usr/local/oracle11g/oracle
chown -R oracle:oinstall /usr/local/oracle11g/oracleapp
cd /usr/local/oracle11g/oracleapp
unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip
su - oracle
vim ~/.bashrc
# oracle11g configure
export ORACLE_BASE=/usr/local/oracle11g/oracle
export ORACLE_HOME=/usr/local/oracle11g/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=$ORACLE_SID
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=american_america.AL32UTF8
# 使之生效
source ~/.bashrc
vim /usr/local/oracle11g/oracleapp/database/response/db_install.rsp
#设置以下内容
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=自己的主机名
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/usr/local/oracle11g/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/usr/local/oracle11g/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/usr/local/oracle11g/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
cd /usr/local/oracle11g/oracleapp/database
./runInstaller -silent -responseFile /usr/local/oracle11g/oracleapp/database/response/db_install.rsp -ignorePrereq
出现此界面即安装成功
使用root执行
sh /usr/local/oracle11g/oracle/inventory/orainstRoot.sh
sh /usr/local/oracle11g/oracle/product/11.2.0/dbhome_1/root.sh
egrep -v "(^#|^$)" /usr/local/oracle11g/oracleapp/database/response/netca.rsp
#以静默方式配置监听
su - oracle
cd /usr/local/oracle11g/oracleapp/database
netca /silent /responsefile /usr/local/oracle11g/oracleapp/database/response/netca.rsp
su - oracle
lsnrctl start
netstat -tunlp|grep 1521
#查看监听状态
lsnrctl status
#查看监听器配置文件 listener.ora
cat $ORACLE_HOME/network/admin/listener.ora
#查看监听服务名配置文件 tnsnames.ora
cat $ORACLE_HOME/network/admin/tnsnames.ora
vim /usr/local/oracle11g/oracleapp/database/response/dbca.rsp
设置以下参数
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "SYS 用户密码"
SYSTEMPASSWORD = "SYSTEM 用户密码"
SYSMANPASSWORD = "sysman"
DBSNMPPASSWORD = "dbsnmp"
DATAFILEDESTINATION =/usr/local/oracle11g/oracle/oradata
RECOVERYAREADESTINATION=/usr/local/oracle11g/oracle/fast_recovery_area
CHARACTERSET = "AL32UTF8"
TOTALMEMORY = "6144"
dbca -silent -responseFile /usr/local/oracle11g/oracleapp/database/response/dbca.rsp
#查看监听器配置文件 listener.ora
cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /usr/local/oracle11g/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = trisdb)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /usr/local/oracle11g/oracle
#查看监听服务名配置文件 tnsnames.ora
# cat /usr/local/oracle11g/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /usr/local/oracle11g/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = trisdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ps -ef | grep ora_ | grep -v grep
#查看 ORACLE_UNQNAME 环境变量
env|grep ORACLE_UNQNAME
以 sysdba 身份登录
sqlplus / as sysdba
启动 oralce 数据库
SQL> startup
显示连接成功
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。