redhat7.7 (centOS7) installed ORACLE 11g a pit tutorials and problem solving and summary

EDITORIAL:

Environmental recommendations: VM 15.5, because 15.5 fixes a lot of bug, you can save a lot of trouble during the installation process

Add a new virtual machine installation redhat7.7

Ready redhat7.7 installation package ... let Baidu cloud upload Oooo, here put the name of the iso: rhel-server-7.7-x86_64-dvd.iso

 

 

redhat images may not be installed in the interface, that is automatically selected as VM easy installation, the installation GUI Reference:

https://www.cnblogs.com/renzmin/p/12057667.html

Configured linux virtual machine, and then you can begin to install the ORACLE .....

 

(1) First, you have to have ORACLE installation package, here attach linux oracle Baidu cloud of links 64

Link: https: //pan.baidu.com/s/1bIR9R-JWVDhs2xXR2umZbg
extraction code: 8bzf

Link: https: //pan.baidu.com/s/1vTabCeNGdLVwOgzyr0v-2A
extraction code: 82bx

 

(2) Configuration source yum

Because oracle behind during installation, you need to import the corresponding dependencies. yum based RPM packages can be automatically downloaded from the server specified RPM package and installed automatically handle dependencies and install all dependent packages, again without cumbersome download, install.

Here the main source configuration 163yum and epel source. After completion, the installation can subsequently rely yum install command by

a: Configuration 163yum Source

  • Management into the source directory cd /etc/yum.repos.d
  • Create a new file vim 163.repo 163.repo
  • 163.repo document reads as follows
[163]
name=163
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1
         

Here we must note that, baseurl this one, you want to http://mirrors.163.com/centos here, go find your corresponding redhat version of the directory, then os, and then point x86_64 (generally), then replace the above baseurl use the URL displayed on your address bar on the line

b: Configuration epel Source

Run rpm -vih https://dl.fedoraproject.org/pub/epel/7Server/x86_64/Packages/e/epel-release-7-12.noarch.rpm

Note that my redhat is 7server, so if your version is not 7server, then you go to http://dl.fedoraproject.org/pub/epel find your corresponding version of the rpm package, then download using the above command, this command simply generate epel source in /etc/yum.repos.d directory.

(3) turn off the firewall

// temporarily turn off the firewall, will re-open automatically after restart 
systemctl restart firewalld
 // check the status of the firewall 
Firewall-cmd - State 
Firewall -cmd --list- All
 // Disable Firewall 
systemctl STOP firewalld.service 
systemctl disable firewalld 
systemctl STOP firewalld 
systemctl firewalld Status 
// the enable Firewall 
systemctl enable firewalld 
systemctl Start firewalld 
systemctl Status firewalld

Recommendations directly off, otherwise the 95% will get stuck in oracle

============================================================================================================================================================================

Here started the installation ORACLE:

(A): dependent libraries installed

yum install -y compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel
yum install -y ksh libaio-devel numactl-devel
yum install -y unixODBC unixODBC-devel oracleasm oracleasmlib oracleasm-support

Perform the following installation is complete, the package to check whether all the required installation:

rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel  
rpm -q gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers  
rpm -q ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat

If prompted XXXX not install

To package compat-libstdc ++ - 33 is not installed, for example

Execution yum list | grep compat-libstdc

 

 

Execution yum install compat-libstdc ++ - 33.x86_64 to

(B) Create the Oracle user groups and user accounts (root user)

    # groupadd oinstall
    # groupadd dba
    # useradd -g oinstall -G dba oracle
    # passwd oracle

执行时去掉#

(三)配置内核参数(root用户)

1.修改文件/etc/sysctl.conf vim /etc/sysctl.conf

内容如下:

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 536870912

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

net.ipv4.tcp_wmem = 262144 262144 262144

 net.ipv4.tcp_rmem = 4194304 4194304 4194304

执行命令: /sbin/sysctl -p 使参数生效。

2. 修改文件/etc/security/limits.conf vim /etc/security/limits.conf
文件内容如下:

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240
oracle              hard   stack    32768
oracle              hard   memlock    134217728
oracle              soft   memlock    134217728
      

(四)创建Oracle的安装目录(root用户)

mkdir -p /u01/app/
chown -R oracle:oinstall /u01/app/
chmod -R 775 /u01/app/

(五)编辑Oracle用户环境(Oracle用户)

在root用户下输入 su oracle 进入oracle用户环境

编辑.bash_profile文件 vim /home/oracle/.bash_profile
.bash_profile文件内容如下:

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
#For Oracle
export DISPLAY=:0.0
export TMP=/tmp;
export TMPDIR=$TMP;
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;
export ORACLE_SID=orcl;
export ORACLE_TERM=xterm;
export PATH=/usr/sbin:$PATH;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

重新启动Linux,选择oracle用户环境的时候,系统会根据环境变量进行配置,后边的oracle命令才能正常执行。
输入 echo $ORACLE_HOME 查看环境变量是否配置成功,如果正常输出了配置的路径,则成功,如果输出为空白,可以在本次手动执行 source /home/oracle/.bash_profile 执行环境变量的加载。但是仅在当前终端窗口有效。
(六)安装ORACLE数据库(oracle用户)

电脑重启完之后,当前为Oracle用户,

1.首先cd到包含oracle文件的盘,

解压缩:

unzip linux.x64_11gR2_database_1of2
unzip linux.x64_11gR2_database_2of2

利用unzip命令解压缩的时候,出现-bash: unzip: command not found的错误。
unzip——命令没有找到,其原因肯定是没有安装unzip。利用一句命令就可以解决了。

yum install -y unzip zip

2.键入vncserver 如果提示command not found,则在root用户下使用 yum install tigervnc-server -y进行安装

3.执行 ./runInstaller 进入安装界面

(1).取消沟-----下一步------yes(提示没有填写邮箱)

 

 

 

(2)选择“Create and configure a database”,点击“Next”

 

 

 (3)选择“Desktop Class”,点击“Next”

 

 

(4)在配置页面上,输入管理员密码,比如“password”,点击“Next”

 

 (5)验证先决条件

 

 (6)预检查通常会报很多fail

 

 

 关于swap空间不足,可以采用以下方式修复

1、使用dd命令创建一个swap分区

          2、#dd if=/dev/zero of=/home/swap bs=1024 count=16400000

          3、格式化刚才创建的分区

          4、# mkswap /home/swap

          5、再使用swapon命令把这个文件分区变成swap分区

          6、#swapon /home/swap

          7、(关闭SWAP分区的命令为:#swapoff /home/swap)

          8、再用free -m 查看已经扩容的了swap分区。

          9、为了能够让swap自动挂载,需要修改etc/fstab文件,用vi /etc/fstab

          10、在文件末尾加上 /home/swap swap swap default 0 0

          11、这样就算重启系统,swap分区也不用手动挂载了

          12、但是我感觉好像我重启了系统 swap就没有了,然后我又百度了一下,要执行下面一段命令  #echo   "swapon  /home/swap" >> /etc/inittab 

          13、然后在看 vi 看下 /etc/inittab

          14、最后一行是swapon  /home/swap,这样就万事大吉了。

 

 

 其他的诸如黄框框中的错误,采用(一)依赖安装中的方式进行修复,由于本机是64位,对于i386的包可以予以忽略

修复需要的安装包之后,如部分i386的没有安装,就直接点击右上角的ignore All 进行下一步即可

(七).显示的安装进度信息:

 

 进行到68%时会报两个错误

第一个:Error in invoking target 'install' of makefile '/home/oracle/app/oracle/product/11.2.0/dbhome_1/ctx/lib/ins_ctx.mk'. See '/home/oracle/oraInventory/logs/installActions2014-05-21_02-20-57PM.log' for details.

 解决方案:

编辑创建脚本:

# Fix ctx/lib/ins_ctx.mk
 
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
 
cat << __EOF__ > /tmp/memcpy_wrap.c
#include <stddef.h>
#include <string.h>
 
asm (".symver wrap_memcpy, memcpy@GLIBC_2.14");
void *wrap_memcpy(void *dest, const void *src, size_t n) {
return memcpy(dest, src, n);
}
__EOF__
 
if [[ -e "${ORACLE_HOME}/ctx/lib/ins_ctx.mk" ]]; then
sed -i -e 's/\$(INSO_LINK)/\$(INSO_LINK) -Wl,--wrap=memcpy_wrap \$(ORACLE_HOME)\/ctx\/lib\/memcpy_wrap.o/g' ${ORACLE_HOME}/ctx/lib/ins_ctx.mk
gcc -c /tmp/memcpy_wrap.c -o ${ORACLE_HOME}/ctx/lib/memcpy_wrap.o && rm /tmp/memcpy_wrap.c
fi

运行脚本 并点击retry

下载路径及傻瓜式操作步骤下载链接:

第二个:Error in invoking target 'agent nmhs' of makefile '/u01/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk'. See '/u01/app/oraInventory/logs/installActions2015-04-23_01-23-30PM.log' for details.

解决方案:

编辑创建脚本:

# Fix sysman/lib/ins_emagent.mk
 
ORACLE_SRC_INSTALL_DIR=/media/sf_uxora_share/database
cd ${ORACLE_SRC_INSTALL_DIR}/stage/Components
 
jar_file=
for i_file in $( ls ./oracle.sysman.agent/*/1/DataFiles/filegroup*.jar ); do
unzip -l ${i_file} sysman/lib/ins_emagent.mk 2>&1 1>/dev/null
[[ $? -eq 0 ]] && jar_file=${i_file} && break
done
 
unzip ${jar_file} sysman/lib/ins_emagent.mk 2>&1 1>/dev/null
if [[ $? -eq 0 ]]; then
sed -i -e 's/\$(MK_EMAGENT_NMECTL)/\$(MK_EMAGENT_NMECTL) -lnnz11/g' sysman/lib/ins_emagent.mk
jar -uvf  ${jar_file} sysman/lib/ins_emagent.mk
fi

运行脚本 并点击retry

下载路径及傻瓜式操作步骤下载链接:

第三个:执行以上两个脚本时会出现的问题

解决linux的-bash: ./xx: Permission denied

 

-bash: ./xx.sh: Permission denied
解决:
chmod 777 xx.sh

 

Linux chmod +755和chmod +777 各是什么意思呢?

 

755 代表用户对该文件拥有读,写,执行的权限,同组其他人员拥有执行和读的权限,没有写的权限,其他用户的权限和同组人员权限一样。
777代表,user,group ,others ,都有读写和可执行权限。

 

(八)安装最后步骤按提示在root用户下执行脚本.

cd /u01/app/oraInventory/
sh orainstRoot.sh
cd /u01/app/oracle/product/11.2.0/dbhome_1/
sh root.sh

最后点击OK即可,

至此完成了oracle的安装,以下开始配置监听器等,

 

==================================================================================================================================================================================

写在前面:

首先将安装完成后生成的listener.ra及tnsname.ora改个名字(不要删除,建议重命名为init_XXXX.ora),这样做的目的是后续需要使用netca自己根据需要配置这两个文件

(九)oracle安装成功后需要配置监听器,直接键入 netca命令,如果提示bash:netca:command not found ,手工执行source /home/oracle/.bash_profile,就可以进入配置监听器的用户界面了,根据需要配置监听器。

首先配置tnsnames.name

直接键入 netca命令

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

打开tnsnames.ora进行进一步的修改

 

 

 

 

orcl =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.195.128)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

 

 ==========================================================================

配置listener.ora

直接键入 netca命令

 

 

 协议选择TCP之后一路下一步即可。

打开listener.ora进行进一步的修改

 

 

 

SID_LIST_LISTENER =
(SID_LIST =
  (SID_DESC =
  (GLOBAL_DBNAME = orcl)
  (ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
  (SID_NAME = orcl)
  )
)


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.195.128)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

 

(十)测试监听命令

lsnrctl stop
lsnrctl start

在这个过程中,可能一般会报错,错误为:

Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

此时采用如下方式进行修复:

(1)设置主机hosts映射,root下更改 vi /etc/hosts

使用hostname命令查看主机名

 

 

 

 (2)执行以下命令,注册数据实例

[oracle@localhost ~]$ sqlplus / as sysdba
SQL>shutdown immediate
SQL> startup
SQL> alter system register;
SQL> quit

(3)查看结果

 lsnrctl status

输出:
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-MAY-2014 10:19:18

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.121)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                13-MAY-2014 10:13:32
Uptime                    0 days 0 hr. 5 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/gpdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.121)(PORT=1521)))
Services Summary...
Service "orcl" has 2 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

说明已经修复好了哦,至此所有配置已经完结。

==============================================================================================================================================================================

以下进行测试

#sqlplus / as sysdba
//输出:

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 20 00:52:02 2019

Copyright (c) 1982, 2009, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

执行:

SQL>select * from tab;

若有一大堆输入,则说明是正确的啦

以下,对安装时默认锁定的用户进行解锁,例如将scott用户解锁,密码设置为11,

具体操作步骤如下:
C:> sqlplus
请输入用户名:sys
输入口令:sys as sysdba //注意:在口令这里输入的密码后面必须要跟上 as sysdba 才可以。
SQL> alter user scott account unlock;
     用户已更改.
SQL> commit;
     提交完成.
SQL> conn scott/tiger
更改scott口令
新口令:tiger
重新键入新口令:tiger
口令已更改
已连接。
测试一下:

 

 恭喜!!!所有操作已完成。。。

前后折腾了两三天,特此记录,以备后用



Guess you like

Origin www.cnblogs.com/renzmin/p/12073791.html