用友NC6.5 Linux服务器环境部署
1.环境配置要求
1.1 操作系统平台
应用服务器操作系统 | 版本(补丁) | 中间件类型 | JDK 版本 |
---|---|---|---|
Linux-RedHat(x64,多核) | Enterprise Linux Server release 6.3 | Websphere 8.5.0.1/UAP/Weblogic11 | SUN JDK1.7_51/IBM SDK,Version 7 |
inux-SUSE(x64,多核) | SUSE 11 sp3 | Websphere 8.5.0.1/UAP/Weblogic11 | SUN JDK1.7_51/IBM SDK,Version 7 |
IBM AIX6.1 | 6.1(6100-09) | Websphere 8.5.0.1 | IBM SDK Version 7 |
IBM AIX7.1 | 7.1(7100-03) | Websphere 8.5.0.1 | Websphere 8.5.0.1 |
Windows 2008 R2(x64,多核) | Windows 2008 R2 Enterprise x64 R2 | Windows 2008 R2 Enterprise x64 R2 | SUN JDK1.7_51/IBM SDK,Version 7 |
Windows Server 2012 x64 | Windows Server 2012 Enterprise x64 | UAP/Websphere 8.5.0.1/Weblogic11 | SUN JDK1.7_51/IBM SDK, Version 7 |
Solaris 11 | Oracle Solaris 11.2 SPARC | Websphere 8.5.0.1 | IBM SDK for Solaris, Version 7 |
2.2 数据库
数据库类型 | Windows | Linux | Sun Solarls | IBM AIX |
---|---|---|---|---|
SQL Server 2012 R2 Enterprise Edition | Y | N | N | N |
ORACLE Enterprise/Standard Edition 11.2.0.4.0 | Y | Y | Y | Y |
ORACLE Enterprise Edition 12.1.0.1.0 | Y | Y | Y | Y |
DB2 Enterprise Edition V10.1/10.5 | Y | Y | Y | Y |
2.Linux对ORACLE Enterprise Edition 12.1.0.1.0环境配置
备注:本文采用RHEL 6.3 作为服务器环境进行用友NC6.5服务器环境
[root@NC65 ~]# uname -a
Linux NC65 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@NC65 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[root@NC65 ~]#
2.1 内存
服务器物理内存及操作系统内存(服务器物理内存为8G,操作系统内存为3.9G)
[root@NC65 ~]# free -m
total used free shared buffers cached
Mem: 7857 254 7602 0 7 45
-/+ buffers/cache: 201 7655
Swap: 16383 0 16383
[root@NC65 ~]# df -h /dev/shm
文件系统 容量 已用 可用 已用%% 挂载点
tmpfs 3.9G 0 3.9G 0% /dev/shm
[root@NC65 ~]#
[root@NC65 ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/sda1 60G 1.1G 56G 2% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda6 270G 191M 256G 1% /home
/dev/sda3 20G 172M 19G 1% /tmp
/dev/sda2 30G 198M 28G 1% /var
[root@NC65 ~]#
注意:Oracle使用内存要小于/dev/shm(操作系统占用内存)的值,生产环境中建议操作系统占用内存值为服务器物理内存的三分之二即可。
以上分区后操作系统内存偏小,调整为6G
查看fstab文件中/dev/shm的值
[root@NC65 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Dec 4 22:24:06 2022
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=622f7368-e78e-430a-850b-e62e3bfbf649 / ext4 defaults 1 1
UUID=35bdf465-6ac7-46a6-b146-81a3e4f7e6c4 /home ext4 defaults 1 2
UUID=f30ff6c8-2261-4807-a58b-d07f5bab5898 /tmp ext4 defaults 1 2
UUID=c2f56192-b9d5-4bf5-bc4d-60060e68be1d /var ext4 defaults 1 2
UUID=12a60cbe-c20c-46bf-8f7b-367202bcea94 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[root@NC65 ~]#
修改fstab文件中的/dev/shm的值
[root@NC65 ~]# vi /etc/fstab
tmpfs /dev/shm tmpfs defaults 0 0 修改为 tmpfs /dev/shm tmpfs defaults,size=6144M 0 0
#
# /etc/fstab
# Created by anaconda on Sun Dec 4 22:24:06 2022
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=622f7368-e78e-430a-850b-e62e3bfbf649 / ext4 defaults 1 1
UUID=35bdf465-6ac7-46a6-b146-81a3e4f7e6c4 /home ext4 defaults 1 2
UUID=f30ff6c8-2261-4807-a58b-d07f5bab5898 /tmp ext4 defaults 1 2
UUID=c2f56192-b9d5-4bf5-bc4d-60060e68be1d /var ext4 defaults 1 2
UUID=12a60cbe-c20c-46bf-8f7b-367202bcea94 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=6144M 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[root@NC65 ~]#
查看修改后相关值
[root@NC65 ~]# cat /etc/fstab | grep shm
tmpfs /dev/shm tmpfs defaults,size=6144M 0 0
[root@NC65 ~]#
挂载(只有挂载后才能生效)
[root@NC65 ~]# mount -o remount /dev/shm
查看是否修改成功
[root@NC65 ~]# df -h
文件系统 容量 已用 可用 已用%% 挂载点
/dev/sda1 60G 1.1G 56G 2% /
tmpfs 6.0G 0 6.0G 0% /dev/shm
/dev/sda6 270G 191M 256G 1% /home
/dev/sda3 20G 172M 19G 1% /tmp
/dev/sda2 30G 198M 28G 1% /var
[root@NC65 ~]#
注意:重启后之前修改参数无效,每一次需要重新挂载是因为系统BUG导致,按照如下操作
编辑rc.sysinit
[root@NC65 ~]# vi /etc/rc.d/rc.sysinit
mount -f /dev/shm >/dev/null 2>&1 #修改前
mount /dev/shm >/dev/null 2>&1 #修改后
2.2 hosts文件修改
[root@NC65 ~]# vi /etc/hosts
#修改前
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#修改后
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.28.147 NC65 #服务器IP 服务器名称
2.3 适用于 Oracle Linux 6 和 Red Hat Enterprise Linux 6 的软件包,必须安装以下软件包(或更高版本)
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc+±33-3.2.3-69.el6 (x86_64)
compat-libstdc+±33-3.2.3-69.el6 (i686)
gcc-4.4.4-13.el6 (x86_64)
gcc-c+±4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc+±4.4.4-13.el6 (x86_64)
libstdc+±4.4.4-13.el6 (i686)
libstdc+±devel-4.4.4-13.el6 (x86_64)
libstdc+±devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXext-1.1 (x86_64)
libXext-1.1 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.3 (x86_64)
libX11-1.3 (i686)
libXau-1.0.5 (x86_64)
libXau-1.0.5 (i686)
libxcb-1.5 (x86_64)
libxcb-1.5 (i686)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
2.4 安装ODBC(可选)
开放式数据库连接 (ODBC) 是一组数据库访问 API,用于连接到数据库、准备数据库,然后在数据库上运行 SQL 语句。使用
ODBC 驱动程序的应用程序可以访问非统一数据源,如电子表格和逗号分隔的文件。
安装 Oracle ODBC Driver for Linux x86-64
如果您打算使用 ODBC,请安装最新的 ODBC 驱动程序管理器 Linux。从以下网站下载并安装 ODBC 驱动程序管理器和 Linux
RPM:
http://www.unixodbc.org
或者执行
[root@NC65 RHEL_DVD]# yum install unixODBC
注意:如果安装,建议如下安装(版本按照实际版本选择安装)
yum install unixODBC-2.2.14-11.el6.i686 unixODBC-2.2.14-11.el6.x86_64 unixODBC-devel-2.2.14-11.el6.x86_64 unixODBC-devel-2.2.14-11.el6.i686
2.5 配置内核参数和资源限制
注意:以下为Oracle12g官方给出的最小值,如果是生产环境,建议按照实际情况进行调整。
如果任何参数的当前值高于此表中列出的值,则不要更改该参数的值。
参数 | 最小值 | 文件 |
---|---|---|
semmsl semmns semopm semmni | 250 32000 100 128 | /proc/sys/kernel/sem |
shmall | 以页为单位的物理内存大小的 40%注意:如果服务器支持多个数据库或使用大型 SGA,请将此参数设置为等于系统一次可以使用的共享内存总量(以 4K位)的值 | /proc/sys/kernel/shmall |
shmmax | 物理内存大小的一半(以字节为单位) | /proc/sys/kernel/shmmax |
shmmni | 4096 | /proc/sys/kernel/shmmni |
panic_on_oopsc | 1 | /proc/sys/kernel/panic_on_oops |
file-max | 6815744c | /proc/sys/fs/file-max |
ip_local_port_range | 最低:9000最大值:65500 | /proc/sys/net/ipv4/ip_local_port_range |
rmem_default | 262144 | /proc/sys/net/core/rmem_default |
rmem_max | 4194304 | /proc/sys/net/core/rmem_max |
wmem_default | 262144 | /proc/sys/net/core/wmem_default |
wmem_max | 1048576 | /proc/sys/net/core/wmem_max |
aio-max-nr | 1048576 | /proc/sys/fs/aio-max-nr |
要查看为这些内核参数指定的当前值,并在必要时更改它们,请执行以下操作
参数 | 命令 |
---|---|
semmsl和semmnssemopmsemmni | # /sbin/sysctl -a | grep sem 此命令按列出的顺序显示信号量参数的值。 |
shmall和shmmaxshmmni | # /sbin/sysctl -a | grep shm |
file-max | # /sbin/sysctl -a | grep file-max |
ip_local_port_range | # /sbin/sysctl -a | grep ip_local_port_range |
rmem_default | # /sbin/sysctl -a | grep rmem_default |
rmem_max | # /sbin/sysctl -a | grep rmem_max |
wmem_default | # /sbin/sysctl -a | grep wmem_default |
wmem_max | # /sbin/sysctl -a -a | grep wmem_max |
如果任何内核参数的值与建议的值不同,请完成以下步骤
打开sysctl.conf文件
[root@NC65 ~]# vim /etc/sysctl.conf
添加或者编辑以下内容(注意,不要添加重复参数值)。如果默认的值比以下值高,则按照实际情况可以修改更大值或者不修改。这里给出的值都是Oracle12C建议的最小值,生产环境的话可以按照实际需求修改。
fs.aio-max-nr = 1048576
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 = 1048586
重启系统使得参数生效
[root@NC65 ~]# shutdownn -r now
3.NC6.5对Java环境安装及配置
备注:本文采用SUN JDK1.7_51安装及配置,采用源码包进行配置安装
3.1 创建java安装路径(自定义路径)
[root@NC65 security]# mkdir /usr/lib/jvm
3.2 下载java源码包后解压java文件
[root@NC65 Temp]# tar xvf jdk-7u51-linux-x64.tar.gz
3.3 将解压后的java文件包移动到自定义的安装路径
[root@NC65 Temp]# mv jdk1.7.0_51/ /usr/lib/jvm/
3.4 java环境变量配置
[root@NC65 Temp]# vim /etc/profile
#向profile文件最后添加以下内容
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_51/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@NC65 Temp]# source /etc/profile
刷新全局变量,使java环境变量配置后生效
3.5注意
Linux 操作系统下 SUNJDK1.7051 有 BUG,使用 SUNJDK 时需做如下修改:修改文件$JAVA_HOME/jre/lib/security/java.security
中 securerandom.source=file:/dev/urandom 替换为 securerandom.source=file:/dev/./urandom
查看java是否配置成功
[root@NC65 Temp]# java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
[root@NC65 Temp]# javac -version
javac 1.7.0_51
[root@NC65 Temp]#
4.Linux安装图形界面
主要为了之后安装NC6.5所需。安装Oracle时,如果以rpm包安装也需要使用图形界面,但是如果以源码包安装则不需要图形界面。安装Oracle建议使用源码包安装,因为源码包安装会更加自由,可以更好的按照企业数据情况进行更高更自由的定制安装。
yum groupinstall "Desktop"
yum groupinstall "X Window System"
yum groupinstall "Chinese Support"
5.Oracle安装及配置(全新安装)
备注:本文采用ORACLE Enterprise Edition 12.1.0.1.0进行数据库安装及配置
5.1创建所需要的操作系统组及用户
如果要安装 Oracle 数据库,则需要以下本地操作系统组和用户:
Oracle 清单组(通常,oinstall)
OSDBA 组(dba)
Oracle 软件所有者(oracle)
OSOPER 组(oper)
[root@NC65 Temp]# /usr/sbin/groupadd oinstall #创建oinstall清单组
[root@NC65 Temp]# /usr/sbin/groupadd dba #创建dba组
[root@NC65 ~]# /usr/sbin/groupadd oper #创建oper组
[root@NC65 Temp]# /usr/sbin/useradd -g oinstall -G dba,oper oracle #创建oracle用户,并且指定主要组和辅助组,同时自动创建用户目录
修改oracle用户密码
[root@NC65 home]# passwd oracle
更改用户 oracle 的密码 。
新的 密码:
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。
[root@NC65 home]#
5.2 Oracle 软件安装用户的资源限制
Resource Shell Limit | Resource | Soft Limit (KB) | Hard Limit (KB) |
---|---|---|---|
Open file descriptors(打开文件描述符) | nofile | at least 1024 | at least 65536 |
Number of processes available to a single user(单个用户可用的进程数) | nproc | at least 2047 | at least 16384 |
Size of the stack segment of the process(流程堆栈段的大小) | stack | at least 10240 | at least 10240, and at most 32768 |
Maximum Locked Memory Limit (最大锁定内存限制) | memlock | at least 90 percent of the current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB) when HugePages is disabled | at least 90 percent of the current RAM when HugePages memory is enabled and at least 3145728 KB (3 GB) when HugePages is disabled |
要检查资源限制,请执行以下操作:
以安装所有者身份登录(即Oracle用户)。
检查文件描述符设置的软限制和硬限制。确保结果在建议的范围内。例如:
$ ulimit -Sn
4096
$ ulimit -Hn
65536
检查用户可用进程数的软限制和硬限制。确保结果在建议的范围内。例如:
$ ulimit -Su
2047
$ ulimit -Hu
16384
检查堆栈设置的软限制。确保结果在建议的范围内。例如:
$ ulimit -Ss
10240
$ ulimit -Hs
32768
对每个 Oracle 软件安装所有者重复此过程
修改为Oracle建议的参数值
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
备份
cp /etc/security/limits.conf /etc/security/limits.conf.bak
修改(将建议的参数值加入到下面位置即可)
[root@NC65 ~]# vim /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
#
#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
# End of file
重启,令其生效(这一步骤操作后值如果没有变化是正常的。这里是作用于Oracle 预安装 RPM以满足预安装要求,也就是Oracle的rpm包安装。所以这里其实可以不用修改参数,因为我们使用的是静默模式安装而非rpm包安装。但是建议将参数按照官方要求修改。)
shutdown -r now
5.3 创建目录
[root@NC65 ~]# mkdir -p /u01/app/oracle
[root@NC65 ~]# chown -R oracle:oinstall /u01
[root@NC65 ~]# chmod -R 775 /u01/app/oracle
5.4 拷贝安装文件
切换oracle用户,创建临时目录用于拷贝安装文件(创建临时目录可以省略)
[root@NC65 home]# su - oracle
[oracle@NC65 ~]$ mkdir Temp
拷贝文件(12c安装文件下载后有两个包,在windows上面解压后通过windows直接拷贝到Linux中,这一步按照个人实际操作情况灵活掌握)
D:\Temp>scp -P 3301 -r Oracle_Database_12.1.0.1.0_for_Linux_x86_64_1of2 oracle@172.16.28.137:/home/oracle/Temp
修改权限(从windows拷贝到Linux中部分权限出现问题,导致没办法安装,所有建议修改权限)
[oracle@NC65 ~]$ chmod -R 777 Oracle_Database_12.1.0.1.0_for_Linux_x86_64_1of2/
安装(该模式安装必须使用Oracle用户登录图形界面安装或者调用图形界面安装)
注意:调用图形界面安装与在Windows平台安装一致,按照实际需求进行安装即可。
[oracle@NC65 Temp]$ cd Oracle_Database_12.1.0.1.0_for_Linux_x86_64_1of2/database/
[oracle@NC65 database]$ ./runInstaller
如果出现安装报错”could not resove local nodename“,说明之前步骤中未修改hosts文件导致
[root@NC65 ~]# vim /etc/hosts
解决方案:
加入本机IP与计算机名称
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.28.137 NC65
5.5 Oracle监听配置
首先进行环境变量配置,环境变量配置方式按照个人习惯进行操作即可
[root@NC65 ~]# viim /etc/profile
profile文件最下面增加以下内容(按照实际情况进行修改)
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export PATH=$PATH:/u01/app/oracle/product/12.1.0/dbhome_1/bin
export ORACLE_SID=orcl
使环境变量生效
[root@NC65 ~]# source /etc/profile
查看监听状态(必须使用Oracle用户登录后操作)
[oracle@NC65 ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 05-DEC-2022 21:44:37
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=NC65)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
[oracle@NC65 ~]$
以上信息反映出监听并没有启动或没有启动成功,尝试启动监听
[oracle@NC65 ~]$ lsnrctl start
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 05-DEC-2022 21:50:44
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/NC65/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NC65)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 05-DEC-2022 21:50:45
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/NC65/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NC65)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@NC65 ~]$
以上状态反映出监听启动成功,现在再一次查看监听状态
[oracle@NC65 ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 05-DEC-2022 21:52:28
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 05-DEC-2022 21:50:45
Uptime 0 days 0 hr. 1 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/NC65/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NC65)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@NC65 ~]$
可以从状态中看出监听是成功启动的。
如果监听启动失败,启动后根据启动信息排查失败原因。一般是监听配置文件相关信息出错。例如监听文件中ip错误或者计算机名称错误导致
[oracle@NC65 ~]$ less /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
安装Oracle后,监听文件默认配置内容
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.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 = NC65)(PORT = 1521))
)
)
监听修改后内容如下(建议修改,否则之后客户端很有可能会访问不了服务器Oracle数据库)
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = NC65)(PORT = 1521))
)
)
oracle用户进入终端,使用sysdba登录(出以下内容说明是登录成功的状态)
[oracle@NC65 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Dec 5 21:58:36 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
查看实例状态
SQL> select status from v$instance;
select status from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL>
以上状态说明实例并未启动,现在需要启动实例
SQL> startup;
ORACLE instance started.
Total System Global Area 2471931904 bytes
Fixed Size 2684592 bytes
Variable Size 721422672 bytes
Database Buffers 1728053248 bytes
Redo Buffers 19771392 bytes
Database mounted.
Database opened.
SQL>
启动后再一次查看实例状态
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL>
可以看出实例是已经启动成功了。下面需要.解锁账户,重置密码
解锁system用户
SQL> alter user system account unlock;
User altered.
SQL>
重置system用户密码
SQL> alter user system identified by oracle_3301;
User altered.
SQL>
尝试切换登录(必须要确成功)
```bash
SQL> conn system/oracle_3301;
Connected.
SQL>
开放1521端口,否则远程无法访问Oracle
/sbin/iptables -I INPUT -p tcp --dport 1521 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/rc.d/init.d/iptables restart
查看端口是否开放成功
[root@NC65 ~]# /etc/init.d/iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1521
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3301
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
7 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
[root@NC65 ~]#
测试端口是否通畅
┌──(ttzo㉿3301)-[~]
└─$ telnet 172.16.28.147 1521
Trying 172.16.28.147...
Connected to 172.16.28.147.
Escape character is '^]'.
端口测通后,可以使用客户端登录,不管是sqlplus命令还是图形界面客户端,只要能登录成功就说明Oracle数据库访问没有任何问题,建议随便执行一次脚本看输出结果是否正常
[oracle@NC65 ~]$ sqlplus system/Oracle_3301@172.16.28.147:1521/orcl
SQL*Plus: Release 12.1.0.1.0 Production on Mon Dec 5 22:15:14 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Mon Dec 05 2022 22:06:33 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
CON_ID
----------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
0
PL/SQL Release 12.1.0.1.0 - Production
0
CORE 12.1.0.1.0 Production
0
BANNER
--------------------------------------------------------------------------------
CON_ID
----------
TNS for Linux: Version 12.1.0.1.0 - Production
0
NLSRTL Version 12.1.0.1.0 - Production
0
SQL>
以上为服务器自身通过system用户登录,可以看出是成功的。现在使用客户端上面的其他工具登录看是否正常
注意:以上所有步骤完成后,一定要重启一下服务器后一定要查看一下数据库是否自动启动,监听是否自动启动。否则每次重启后都需要手工启动相关服务。
配置数据库开机自动启动
执行dbstart报错
[root@NC65 ~]# dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart ORACLE_HOME
[root@NC65 ~]#
[root@NC65 ~]# vim /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart
ORACLE_HOME_LISTNER=$1
修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
执行dbshut报错
[root@NC65 ~]# dbshut
ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener
Usage: /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbshut ORACLE_HOME
[root@NC65 ~]#
[root@NC65 ~]# vim /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbshut
ORACLE_HOME_LISTNER=$1
修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
配置数据库开机监听自动启动
修改oratab文件
[oracle@NC65 ~]$ vim /etc/oratab
orcl:/u01/app/oracle/product/12.1.0/dbhome_1:N
修改为
orcl:/u01/app/oracle/product/12.1.0/dbhome_1:Y
修改rc.local文件
[root@NC65 ~]# vim /etc/rc.d/rc.local
添以下内容
注意:使用oracle用户安装的oracle数据库,所以只能用用户oracle启动监听服务
su - oracle -lc "/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start" #开机启动数据库监听服务
注意:dbstart只能用root操作,用户oracle操作会提示权限不足
su - root -lc "/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart" #开机启动数据库
注意:以上内容按照实际个人安装情况定夺
查看rc.local权限(必须要有执行权限,否则之前添加的内容会失效。如果权限不符合要求就需要修改权限。下面的权限就是系统默认的而且正确的权限)
[root@NC65 ~]# ll /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 359 12月 6 01:15 /etc/rc.d/rc.local
重启服务器后检查监听服务及数据库是否开机启动
查看数据库是否自动启动
[oracle@NC65 ~]$ ps -ef | grep oracle
oracle 2226 1 0 01:32 ? 00:00:00 /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr LISTENER -inherit
root 2443 2425 0 01:34 pts/0 00:00:00 su - oracle
oracle 2447 2443 0 01:34 pts/0 00:00:00 -bash
oracle 2469 2447 0 01:35 pts/0 00:00:00 ps -ef
oracle 2470 2447 0 01:35 pts/0 00:00:00 grep oracle
查看监听服务是否自动启动
[oracle@NC65 ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 06-DEC-2022 01:36:42
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 06-DEC-2022 01:32:33
Uptime 0 days 0 hr. 4 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/NC65/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NC65)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@NC65 ~]$
检查数据库启动命令是否正常
[root@NC65 ~]# dbshut
Processing Database instance "orcl": log file /u01/app/oracle/product/12.1.0/dbhome_1/shutdown.log
[root@NC65 ~]# dbstart
Processing Database instance "orcl": log file /u01/app/oracle/product/12.1.0/dbhome_1/startup.log
[root@NC65 ~]#
说明:这种状态就是合适的。会将操作记录到日志中
查看oratab权限,没有执行权限
[oracle@NC65 ~]$ ls -lh /etc/oratab
-rw-rw-r--. 1 oracle oinstall 788 12月 6 01:06 /etc/oratab
修改
[oracle@NC65 ~]$ chmod +x /etc/oratab
[oracle@NC65 ~]$ ls -lh /etc/oratab
-rwxrwxr-x. 1 oracle oinstall 788 12月 6 01:06 /etc/oratab
[oracle@NC65 ~]$
以上所有内容就是安装用友NC6.5之前进行Oralce数据库配置所需的所有工作。当然数据库选择还有操作系统选择这一块可以按照实际企业情况灵活掌握。本文是严格按照用友NC6.5官方文档进行操作系统版本与数据库版本相关部署及安装的。同时也需要注意jdk版本,建议严格按照用友NC6.5官方文档进行部署,否则后续可能导致各种问题出现。
6.部署用友NC6.5平台
6.1设置字符集(服务器操作系统,数据库服务器,客户端需要一致,否则数据库可能会出现乱码)
查看服务器字符集
[root@NC65 ~]# echo $LANG
zh_CN.UTF-8
查看数据库字符集
[oracle@NC65 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 6 18:18:18 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.WE8MSWIN1252
SQL>
修改数据库字符集与服务器一致
SQL>SHUTDOWN IMMEDIATE; #步骤1
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> STARTUP MOUNT; #步骤2
ORACLE instance started.
Total System Global Area 2471931904 bytes
Fixed Size 2684592 bytes
Variable Size 721422672 bytes
Database Buffers 1728053248 bytes
Redo Buffers 19771392 bytes
Database mounted.
SQL>
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION; #步骤3
System altered.
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; #步骤4
System altered.
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0; #步骤5
System altered.
SQL> ALTER DATABASE OPEN; #步骤6
Database altered.
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE UTF8; #步骤7
Database altered.
SQL> SHUTDOWN IMMEDIATE; #步骤8
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> STARTUP; #步骤9
ORACLE instance started.
Total System Global Area 2471931904 bytes
Fixed Size 2684592 bytes
Variable Size 721422672 bytes
Database Buffers 1728053248 bytes
Redo Buffers 19771392 bytes
Database mounted.
Database opened.
SQL>
查看数据库字符集
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.UTF8
SQL>
6.2 创建表空间,增加NC用户及修改临时表空间
CREATE TABLESPACE NNC_DATA01 DATAFILE '/u01/app/oracle/oradata/orcl/nnc_data01.dbf' SIZE 500M AUTOEXTEND ON NEXT 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 256K;
CREATE TABLESPACE NNC_INDEX01 DATAFILE '/u01/app/oracle/oradata/orcl/nnc_index01.dbf' SIZE 500M AUTOEXTEND ON NEXT 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;
CREATE USER C##NC65 IDENTIFIED BY NC65_3301 DEFAULT TABLESPACE NNC_DATA01 TEMPORARY TABLESPACE temp;
GRANT connect,dba to C##NC65;
ALTER DATABASE TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' AUTOEXTEND ON NEXT 256M MAXSIZE 10240M
6.3 使用新增的NC用户登录数据库,看是否能登录成功(必须要登录成功)
[oracle@NC65 ~]$ sqlplus C##NC65/NC65_3301@127.0.0.1:1521/orcl
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 6 18:43:42 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Tue Dec 06 2022 00:21:35 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
6.4 上传NC65安装包,解压
上传
D:\Temp>scp -P 3301 NC6.5金盘.zip oracle@172.16.28.147:/home/oracle/Temp/
oracle@172.16.28.147's password:
NC6.5金盘.zip 100% 3151MB 61.3MB/s 00:51
解压
[oracle@NC65 Temp]$ unzip NC6.5金盘.zip
6.5 安装NC65(安装步骤与Windows平台一致,配置也一致)
[root@NC65 yonyou_nc]# cd /home/oracle/Temp/yonyou_nc/
[root@NC65 yonyou_nc]# chmod 755 setup.sh #授权,否则无法安装
6.6 配置
文件授权
[root@NC65 yonyou_nc]# cd /home/oracle/yonyou/home/bin/
[root@NC65 yonyou_nc]# chmod 755 *.sh
#以下步骤必须要做,否则无法打开SysConfig界面
[root@NC65 yonyou_nc]# cd /home/oracle/yonyou/home
[root@NC65 yonyou_nc]# chmod 755 root.sh #这一步是对NCHOME授予权限
6.7 启动服务
[root@NC65 yonyou_nc]# cd /home/oracle/yonyou/home
[root@NC65 yonyou_nc]# ./startup.sh
等待服务启动后会有如下提示
*******
******
******
******
INFO Server startup in *** ms
6.8 测试登录
首先查看端口是否通常
┌──(ttzo㉿3301)-[~]
└─$ telnet 172.16.28.147 33013
Trying 172.16.28.147...
telnet: Unable to connect to remote host: 没有到主机的路由
如果端口不通,则需要在防火墙中放行,放行后一定要查看端口是否放行成功
[root@NC65 yonyou_nc]# iptables -I INPUT -p tcp --dport 33013 -j ACCEPT
[root@NC65 yonyou_nc]# /etc/rc.d/init.d/iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]
[root@NC65 yonyou_nc]# /etc/rc.d/init.d/iptables restart
iptables:清除防火墙规则: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则: [确定]
[root@NC65 yonyou_nc]# /etc/init.d/iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:33013
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1521
3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3301
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
5 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
8 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
[root@NC65 yonyou_nc]#
端口放行后,再次查看服务器NC相关端口是否能正常访问
┌──(ttzo㉿3301)-[~]
└─$ telnet 172.16.28.147 3301
Trying 172.16.28.147...
Connected to 172.16.28.147.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
^]
telnet> quit
Connection closed.
┌──(ttzo㉿3301)-[~]
└─$
端口能正常访问后,可以进入浏览器操作
、