oracle 单实例DG(搭建篇一)

一,介绍

  lodding...

二,安装前环境配置

   01,依赖包的安装:

yum install binutils-*
yum install compat-libstdc++-*
yum install elfutils-libelf-*
yum install elfutils-libelf-devel-*
yum install elfutils-libelf-devel-static-*
yum install gcc-*
yum install gcc-c++-*
yum install glibc-*
yum install glibc-common-*
yum install glibc-devel-*
yum install glibc-headers-*
yum install kernel-headers-*
yum install ksh-*
yum install libaio-*
yum install libaio-devel-* 
yum install libgcc-*
yum install libgomp-*
yum install libstdc++-* 
yum install libstdc++-devel-*
yum install make-*
yum install sysstat-*
yum install unixODBC-*
yum install unixODBC-devel-*

    依赖包检查:

 1 rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})
' binutils 
 2 compat-libstdc++ 
 3 elfutils-libelf-devel 
 4 elfutils-libelf-devel-static 
 5 gcc 
 6 gcc-c++ 
 7 glibc 
 8 glibc-common 
 9 glibc-devel 
10 glibc-headers 
11 kernel-headers 
12 ksh 
13 libaio 
14 libaio-devel 
15 libgcc 
16 libgomp 
17 libstdc++ 
18 libstdc++-devel 
19 make 
20 sysstat 
21 unixODBC 
22 unixODBC-devel 
23 libXp
View Code

    02,创建对应的用户,及管理用户

1 /usr/sbin/groupadd oinstall
2 /usr/sbin/groupadd dba
3 /usr/sbin/useradd -g oinstall -G dba oracle
4 
5 echo oracle | passwd --stdin oracle
View Code

    03, 修改内核参数 

 1 vim /etc/sysctl.conf
 2 
 3 fs.aio-max-nr = 1048576
 4 fs.file-max = 6815744
 5 kernel.shmall = 2097152
 6 kernel.shmmax = 536870912
 7 kernel.shmmni = 4096
 8 kernel.sem = 250 32000 100 128
 9 net.ipv4.ip_local_port_range = 9000 65500
10 net.core.rmem_default = 262144
11 net.core.rmem_max = 4194304
12 net.core.wmem_default = 262144
13 net.core.wmem_max = 1048586
14 
15 sysctl -p
View Code

     04,修改系统限制

1 vim /etc/security/limits.conf
2 oracle           soft    nproc   2047
3 oracle           hard    nproc   16384
4 oracle           soft    nofile  1024
5 oracle           hard    nofile  65536
View Code

    05,修改认证 

/etc/pam.d/login
1 session    required     pam_limits.so
View Code

    06,修改profile

1 if [ $USER = "oracle" ]; then
2         if [ $SHELL = "/bin/ksh" ]; then
3               ulimit -p 16384
4               ulimit -n 65536
5         else
6               ulimit -u 16384 -n 65536
7         fi
8 fi
View Code

    07,创建需要的目录

 1 #创建必须目录:
 2 #ORACLE_BASE:存放各类日志
 3 mkdir -p /u01/app/oracle
 4 #ORACLE_HOME:存放程序的目录
 5 mkdir -p /u01/app/oracle/product/11.2.0/db_1
 6 
 7 #更改权限:
 8 chown -R oracle:oinstall /u01/
 9 chmod -R 775 /u01/
10 chown -R oracle:oinstall /oradata
View Code

     08, 更改环境变量

1 su - oracle
2 vim .bash_profile
3 export ORACLE_BASE=/u01/app/oracle
4 export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
5 export ORACLE_SID=orcl
6 export PATH=$ORACLE_HOME/bin:$PATH
7 
8 source .bash_profile
View Code

三,安装运行

    ./runInstaller

    进入环境配置页面

报错提示:  

 1 [oracle@oracle01 grid]$ ./runInstaller
 2 Starting Oracle Universal Installer...
 3 
 4 Checking Temp space: must be greater than 120 MB.   Actual 39866 MB    Passed
 5 Checking swap space: must be greater than 150 MB.   Actual 2047 MB    Passed
 6 Checking monitor: must be configured to display at least 256 colors
 7     >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<
 8 
 9 Some requirement checks failed. You must fulfill these requirements before
10 
11 continuing with the installation,
12 
13 Continue? (y/n) [n] y
14 
15 
16 >>> Ignoring required pre-requisite failures. Continuing...
17 Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-02-19_02-07-59AM. Please wait ...[oracle@oracle01 grid]$ No protocol specified
18 Exception in thread "main" java.lang.NoClassDefFoundError
19         at java.lang.Class.forName0(Native Method)
20         at java.lang.Class.forName(Class.java:164)
21         at java.awt.Toolkit$2.run(Toolkit.java:821)
22         at java.security.AccessController.doPrivileged(Native Method)
23         at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)
24         at com.jgoodies.looks.LookUtils.isLowResolution(LookUtils.java:484)
25         at com.jgoodies.looks.LookUtils.<clinit>(LookUtils.java:249)
26         at com.jgoodies.looks.plastic.PlasticLookAndFeel.<clinit>(PlasticLookAndFeel.java:135)
27         at java.lang.Class.forName0(Native Method)
28         at java.lang.Class.forName(Class.java:242)
29         at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1779)
30         at javax.swing.UIManager.setLookAndFeel(UIManager.java:453)
31         at oracle.install.commons.util.Application.startup(Application.java:785)
32         at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:165)
33         at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:182)
34         at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:348)
35         at oracle.install.ivw.crs.driver.CRSInstaller.startup(CRSInstaller.java:98)
36         at oracle.install.ivw.crs.driver.CRSInstaller.main(CRSInstaller.java:105)
37 
38 :q
View Code

解决:

1 su 登入root 用户
2  
3 运行:
4 
5 xhost +
6 
7 再登入oracle 用户执行命令
View Code

原因:

1 因为Xserver默认情况下不允许别的用户的图形程序的图形显示在当前屏幕上. 如果需要别的用户的图形显示在当前屏幕上, 则应以当前登陆的用户, 也就是切换身份前的用户执行如下命令
2  xhost +
View Code

  

    安装界面:

    

重新授权文件

[root@oracle01 ~]# chown -R oracle:oinstall /u01/
[root@oracle01 ~]# chmod -R 775 /u01/

看见有三个问题需要解决:

用root 运行命令

问题二:

  yum install compat-libstdc++-33

其他问题就过滤把

等待安装完成

需要运行命令

好了到这里安装就完成了

主库搭建安装上诉方式

备库的话选择克隆的方式完成

备库需要跟改oracle 的位置有:

 

四,配置监听netca

      进入oracle用户

     运行 netca

    可能存在报错没有这个命令,可以查看.bash_profile是否配置环境变量合规,

    并且运行  source .bash_profile

   

  netca 启动各种问题:

    

 1 1.环境变量问题
 2 
 3 环境变量路径设置不对,找不到netca命令,--bash什么balabala提示,设置环境变量到ORACLE_HOME/bin
 4 
 5  
 6 
 7 2.无法显示图形界面
 8 
 9 比较容易解决,用root用户执行xhost +命令,切到Oracle用户下再次执行
10 
11 如果依旧不行,查看是不是缺少libXp这个rpm包
12 
13 此错误的错误提示有java.awt等
14 
15 java.lang.NullPointerException
16         at oracle.ewt.lwAWT.BufferedApplet.<init>(Unknown Source)
17         at oracle.net.ca.NetCA.<init>(Unknown Source)
18         at oracle.net.ca.NetCA.main(Unknown Source)
19 Oracle Net Services configuration failed.  The exit code is -1
20 
21 Exception in thread "main" java.lang.UnsatisfiedLinkError: /ora/app/oracle/db10g/jdk/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
22 
23         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
24 
25         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
26 
27         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503)
28 
29         at java.lang.Runtime.loadLibrary0(Runtime.java:788)
30 
31         at java.lang.System.loadLibrary(System.java:834)
32 
33         at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
34 
35         at java.security.AccessController.doPrivileged(Native Method)
36 
37         at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
38 
39         at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
40 
41         at java.awt.Component.<clinit>(Component.java:506)
42 
43  
44 
45 3.权限问题
46 
47 确定oracle用户和root用户分别什么用,重新把ORACLE_HOME赋权给oracle
48 
49 错误提示
50 
51 java.io.FileNotFoundException:/u01/cfgtoollogs/netca/netca_OraDb11g_home1_0809062PM5029.log(Permission denied)
52 at java.io.FileOutputStream.open(Native Method)
53 at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
54 at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
55 at oracle.net.ca.NetCA.main(Unknown Source)
56 Oracle Net Services configuration failed. The exit code is -1
57 
58  
59 
60 4.主机名错误
61 
62 错误提示:
63 
64 Oracle Net Services Configuration:
65 #
66 # An unexpected error has been detected by HotSpot Virtual Machine:
67 #
68 #  SIGSEGV (0xb) at pc=0x004f0ab3, pid=19917, tid=3086797008
69 #
70 # Java VM: Java HotSpot(TM) Client VM (1.4.2_14-b05 mixed mode)
71 # Problematic frame:
72 # C  [libc.so.6+0x6fab3]  index+0x63
73 #
74 # An error report file with more information is saved as hs_err_pid19917.log
75 #
76 # If you would like to submit a bug report, please visit:
77 #   http://java.sun.com/webapps/bugreport/crash.jsp
78 #
79 /u01/app/oracle/product/10.2.0/db_1/bin/netca: line 190: 19917 Aborted
80 $JRE -mx64m $SRVM_PROPERTY_DEFS -Dsun.java2d.font.DisableAlgorithmicStyles=true -classpath
81 
82 由于默认主机名错误导致,修改配置文件/etc/hosts,修改
83 
84 # Do not remove the following line, or various programs
85 # that require network functionality will fail.
86 127.0.0.1               localhost.localdomain localhost 你的主机名
View Code

   再root用户下xhost +

  oracle用户

   export DISPLAY=:0.0

  

最后点击 结束

五,安装数据库 dbca  

七,从库网络配置netmgr 

     命令行输入命令:  netmgr

    

 

八, 从库netca  

    

详情请见下篇------oracle 单实例DG(双机配置篇)

原文地址:https://www.cnblogs.com/kingle-study/p/10402130.html