数据库
首页 > 数据库> > 非图形方式静默安装与配置 Oracle 11g RAC(3)——创建用户和组

非图形方式静默安装与配置 Oracle 11g RAC(3)——创建用户和组

作者:互联网

非图形方式静默安装与配置 Oracle 11g RAC(3)——创建用户和组

一、安装 readline(两节点同时操作)

将来在使用 xshell 连接 CentOS 进入 SQLPLUS 进行操作时,无法使用退格键、删除键、方向键(显示乱码)。安装软件 readline 和 rlwrap,重启系统可以解决此问题。

## 1、下载readline-6.2.tar.gz文件
[root@rac1 oracle]# mkdir -p /soft/soft
[root@rac1 oracle]# 
[root@rac1 oracle]# cd /soft/soft
[root@rac1 soft]# pwd
/soft/soft
[root@rac1 soft]# wget ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
--2021-04-19 00:33:24--  ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
           => “readline-6.2.tar.gz”
正在解析主机 ftp.gnu.org... 209.51.188.20, 2001:470:142:3::b
正在连接 ftp.gnu.org|209.51.188.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。    ==> PWD ... 完成。
==> TYPE I ... 完成。  ==> CWD (1) /gnu/readline ... 完成。
==> SIZE readline-6.2.tar.gz ... 2277926
==> PASV ... 完成。    ==> RETR readline-6.2.tar.gz ... 完成。
长度:2277926 (2.2M) (非正式数据)

99% [========================================> ] 2,266,600    737K/s eta(英国中部时
100%[=========================================>] 2,277,926    741K/s   in 3.0s    
2021-04-19 00:33:31 (741 KB/s) - “readline-6.2.tar.gz” 已保存 [2277926]

## 2、解压文件
[root@rac1 soft]# tar zxvf readline-6.2.tar.gz 
[root@rac1 soft]# tar zxvf readline-6.2.tar.gz
readline-6.2/
readline-6.2/doc/
readline-6.2/doc/Makefile.in
readline-6.2/doc/texinfo.tex
...........

readline-6.2/histexpand.c
readline-6.2/histfile.c
readline-6.2/histsearch.c
readline-6.2/patchlevel

## 3、安装编译软件 gcc
[root@rac1 soft]# yum install -y gcc
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-23.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: libgcc >= 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: libgomp.so.1()(64bit) for package: gcc-4.4.7-23.el6.x86_64
--> Running transaction check
...........
Installed:
  gcc.x86_64 0:4.4.7-23.el6                                                                                                           

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6           cpp.x86_64 0:4.4.7-23.el6                    glibc-devel.x86_64 0:2.12-1.212.el6_10.3 
  glibc-headers.x86_64 0:2.12-1.212.el6_10.3  kernel-headers.x86_64 0:2.6.32-754.35.1.el6  libgomp.x86_64 0:4.4.7-23.el6            
  mpfr.x86_64 0:2.4.1-6.el6                   ppl.x86_64 0:0.10.2-11.el6                  

Dependency Updated:
  glibc.x86_64 0:2.12-1.212.el6_10.3          glibc-common.x86_64 0:2.12-1.212.el6_10.3          libgcc.x86_64 0:4.4.7-23.el6         
  tzdata.noarch 0:2020d-1.el6                

Complete!


## 4、编译、安装软件
[root@rac1 soft]# ls
readline-6.2  readline-6.2.tar.gz
[root@rac1 soft]# cd readline-6.2
[root@rac1 readline-6.2]# ./configure && make && make install

## 5、安装libtermcap-devel
[root@rac1 readline-6.2]# yum install -y libtermcap-devel
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ncurses-devel.x86_64 0:5.7-4.20090207.el6 will be installed
--> Processing Dependency: ncurses-libs = 5.7-4.20090207.el6 for package: ncurses-devel-5.7-4.20090207.el6.x86_64
--> Running transaction check
---> Package ncurses-libs.x86_64 0:5.7-3.20090208.el6 will be updated
---> Package ncurses-libs.x86_64 0:5.7-4.20090207.el6 will be an update
--> Processing Dependency: ncurses-base = 5.7-4.20090207.el6 for package: ncurses-libs-5.7-4.20090207.el6.x86_64
--> Running transaction check
---> Package ncurses-base.x86_64 0:5.7-3.20090208.el6 will be updated
---> Package ncurses-base.x86_64 0:5.7-4.20090207.el6 will be an update
--> Finished Dependency Resolution
..........
Installed:
  ncurses-devel.x86_64 0:5.7-4.20090207.el6                                                                                           

Dependency Updated:
  ncurses-base.x86_64 0:5.7-4.20090207.el6                          ncurses-libs.x86_64 0:5.7-4.20090207.el6                         

Complete!

二、安装 rlwrap-0.37(两节点同时操作)

## 1、下载软件包
[root@rac1 soft]# ls
readline-6.2  readline-6.2.tar.gz  rlwrap-0.37.tar.gz

## 2、解压缩
[root@rac1 soft]# tar -zxvf rlwrap-0.37.tar.gz
rlwrap-0.37/
rlwrap-0.37/completions/
rlwrap-0.37/completions/testclient
rlwrap-0.37/completions/coqtop
rlwrap-0.37/doc/
rlwrap-0.37/doc/rlwrap.man.in
rlwrap-0.37/doc/Makefile.am
rlwrap-0.37/doc/Makefile.in
rlwrap-0.37/filters/
rlwrap-0.37/filters/README
rlwrap-0.37/filters/RlwrapFilter.pm
rlwrap-0.37/filters/RlwrapFilter.3pm
rlwrap-0.37/filters/count_in_prompt
rlwrap-0.37/filters/pipeto
rlwrap-0.37/filters/logger
rlwrap-0.37/filters/null
rlwrap-0.37/filters/unbackspace
rlwrap-0.37/filters/pipeline
rlwrap-0.37/filters/ftp_filter
rlwrap-0.37/filters/history_format
rlwrap-0.37/filters/simple_macro
rlwrap-0.37/filters/template
rlwrap-0.37/filters/scrub_prompt
rlwrap-0.37/filters/paint_prompt
rlwrap-0.37/filters/censor_passwords
rlwrap-0.37/filters/listing
rlwrap-0.37/filters/Makefile.am
rlwrap-0.37/filters/Makefile.in
rlwrap-0.37/src/
rlwrap-0.37/src/rlwrap.h
rlwrap-0.37/src/redblack.h
rlwrap-0.37/src/malloc_debug.h
rlwrap-0.37/src/completion.rb
rlwrap-0.37/src/Makefile.am
rlwrap-0.37/src/Makefile.in
rlwrap-0.37/src/main.c
rlwrap-0.37/src/signals.c
rlwrap-0.37/src/readline.c
rlwrap-0.37/src/pty.c
rlwrap-0.37/src/completion.c
rlwrap-0.37/src/term.c
rlwrap-0.37/src/ptytty.c
rlwrap-0.37/src/utils.c
rlwrap-0.37/src/string_utils.c
rlwrap-0.37/src/malloc_debug.c
rlwrap-0.37/src/filter.c
rlwrap-0.37/test/
rlwrap-0.37/test/testclient
rlwrap-0.37/test/testit
rlwrap-0.37/tools/
rlwrap-0.37/tools/config.guess
rlwrap-0.37/tools/config.sub
rlwrap-0.37/tools/depcomp
rlwrap-0.37/tools/install-sh
rlwrap-0.37/tools/missing
rlwrap-0.37/README
rlwrap-0.37/configure.ac
rlwrap-0.37/aclocal.m4
rlwrap-0.37/Makefile.am
rlwrap-0.37/Makefile.in
rlwrap-0.37/config.h.in
rlwrap-0.37/configure
rlwrap-0.37/AUTHORS
rlwrap-0.37/COPYING
rlwrap-0.37/ChangeLog
rlwrap-0.37/INSTALL
rlwrap-0.37/NEWS
rlwrap-0.37/TODO
rlwrap-0.37/BUGS
rlwrap-0.37/PLEA

## 3、编译、安装软件
[root@rac1 soft]# cd rlwrap-0.37
[root@rac1 rlwrap-0.37]# ./configure && make && make install

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make sets $(MAKE)... (cached) yes
checking whether build environment is sane... yes
checking for style of include used by make... GNU
.........
make[2]: Leaving directory `/soft/soft/rlwrap-0.37/filters'
make[1]: Leaving directory `/soft/soft/rlwrap-0.37/filters'
make[1]: Entering directory `/soft/soft/rlwrap-0.37'
make[2]: Entering directory `/soft/soft/rlwrap-0.37'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/rlwrap" || /bin/mkdir -p "/usr/local/share/rlwrap"
/bin/mkdir -p '/usr/local/share/rlwrap/filters'
 /usr/bin/install -c -m 644  filters/README filters/RlwrapFilter.pm filters/RlwrapFilter.3pm filters/count_in_prompt filters/pipeto fi
lters/logger filters/null filters/unbackspace filters/pipeline filters/ftp_filter filters/history_format filters/simple_macro filters/template filters/scrub_prompt filters/paint_prompt filters/censor_passwords filters/listing '/usr/local/share/rlwrap/filters'/bin/mkdir -p '/usr/local/share/rlwrap/completions'
 /usr/bin/install -c -m 644  completions/testclient completions/coqtop '/usr/local/share/rlwrap/completions'
make  install-data-hook
make[3]: Entering directory `/soft/soft/rlwrap-0.37'
chmod a+x /usr/local/share/rlwrap/filters/* 
make[3]: Leaving directory `/soft/soft/rlwrap-0.37'
make[2]: Leaving directory `/soft/soft/rlwrap-0.37'
make[1]: Leaving directory `/soft/soft/rlwrap-0.37'

三、创建用户和组(两个节点同时操作)

1、创建组

######## 创建所需的六个用户组,分别为 oinstall、dba、oper、asmadmin、asmdba、asmoper
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmdba
groupadd -g 506 asmoper

[root@rac1 rlwrap-0.37]# groupadd -g 501 oinstall
[root@rac1 rlwrap-0.37]# groupadd -g 502 dba
[root@rac1 rlwrap-0.37]# groupadd -g 503 oper
[root@rac1 rlwrap-0.37]# groupadd -g 504 asmadmin
[root@rac1 rlwrap-0.37]# groupadd -g 505 asmdba
[root@rac1 rlwrap-0.37]# groupadd -g 506 asmoper

2、创建用户

###分别创建两个用户:grid 和 oracle,并添加到相应的用户组中
###其中:
###grid用户所在的组为:dba,asmadmin,asmdba,asmoper
###oracle用户所在的组为:dba,oper,asmdba,asmadmin

useradd -u 502 -g oinstall -G dba,asmadmin,asmdba,asmoper grid
useradd -u 501 -g oinstall -G dba,oper,asmdba,asmadmin oracle

[root@rac1 rlwrap-0.37]# useradd -u 502 -g oinstall -G dba,asmadmin,asmdba,asmoper grid
[root@rac1 rlwrap-0.37]# useradd -u 501 -g oinstall -G dba,oper,asmdba,asmadmin oracle

3、设置用户口令

## 设置 grid 用户口令:grid
[root@rac1 rlwrap-0.37]# passwd grid
更改用户 grid 的密码 。
新的 密码:
无效的密码: 过短
无效的密码: 过于简单
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。

## 设置 oracle 用户口令:oracle
[root@rac1 rlwrap-0.37]# passwd oracle
更改用户 oracle 的密码 。
新的 密码:
无效的密码: 它基于字典单词
无效的密码: 过于简单
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。

四、配置环境变量(两个节点同时操作)

1、修改 grid 用户的配置文件

[root@rac1 rlwrap-0.37]# su - grid
[grid@rac1 ~]$ ls -a
.  ..  .bash_logout  .bash_profile  .bashrc  .gnome2
[grid@rac1 ~]$ vi .bash_profile 

## 文件的内容如下:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH


export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_OWNER=oracle
export ORACLE_SID=+ASM1  ## rac1 设置为 +ASM1, rac2 设置为 +ASM2,其他选项两个节点相同
export ORACLE_TERM=vt100
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export LANG=en_US
alias sqlplus='rlwrap sqlplus / as sysdba'
alias rman='rlwrap rman'
alias lsnrctl='rlwrap lsnrctl'
alias asmcmd='rlwrap asmcmd'

2、使用户配置文件生效

[grid@rac1 ~]$ source .bash_profile 

3、修改 oracle 用户的配置文件

[root@rac1 rlwrap-0.37]# vi /home/oracle/.bashrc
## 文件的内容如下:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH


export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_OWNER=oracle
export ORACLE_SID=orcl1  ####  rac2节点设置为 orcl2
export ORACLE_TERM=vt100
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export EDITOR=vi
export SQLPATH=/home/oracle
export LANG=en_US
alias sqlplus='rlwrap sqlplus'
alias lsnrctl='rlwrap lsnrctl'
alias rman='rlwrap rman'
alias dgmgrl='rlwrap dgmgrl'

4、使用户配置文件生效

[oracle@rac1 ~]$ source .bash_profile 

标签:11g,RAC,rac1,rlwrap,soft,0.37,filters,Oracle,el6
来源: https://blog.csdn.net/weixin_44377973/article/details/115835277