[20171223]grid用户的环境变量问题.txt

--//oracle 11G 安装RAC,一般需要建立grid用户,使用这个用户管理asm,群集信息.
--//在安装过程中,同事的疑问实际上也是我以前的疑问.

--//grid用户:
$ id
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper)

$ env| egrep "ORACLE_BASE|ORACLE_HOME"
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/11.2.0/grid

--//oracle用户:
$ id
uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1201(asmdba),1300(dba),1301(oper)

$  env| egrep "ORACLE_BASE|ORACLE_HOME"
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

--//为什么oracle用户建立ORACLE_HOME在ORACLE_BASE之中,而grid用户建立ORACLE_HOME却没有建立为
--//ORACLE_HOME目录之下,例如:/u01/app/grid/product/11.2.0/dbhome_1

--//我开始一直以为也许是一种约定,按照文档操作就ok了.昨天别人问这个问题,我google:

https://community.oracle.com/message/12310012

For ASM installation of software:

. The directories are located by the operating system environment variables.
-- ORACLE_BASE is the top-level directory for a particular software owner.
-- ORACLE_HOME is used to identify the top-level directory of the Grid Infrastructure software.

. Use a common ORACLE_BASE for all Oracle products owned by the same user.
. Use an isolated ORACLE_HOME location from other Oracle products even if they are the same version.
. Do not place Grid ORACLE_HOME below ORACLE_BASE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. ORACLE_HOME requires 3 GB to 5 GB of disk space.

--//对方的解答:

The recommendation is correct.  GRID_HOME should be separate.  The root.sh script for the GRID_HOME changes ownership
and permissions for certain files to rooot so it should be separate.

...

Gridhome must not be a subdirectory of gridbase, because of the permission change to root.  It works good in production
and hopefully survives a deinstall of grid base after e.g. an upgrade.

--//按照官方的解析,许多文件目录在按照后修改为root用户.

$ ls -l $ORACLE_HOME |grep " root "
drwxrwxrwt  6 root oinstall  4096 2016-12-24 12:12:53 auth
drwxr-xr-x  2 root oinstall 12288 2016-12-24 12:12:53 bin
drwxr-x---  4 root oinstall  4096 2016-12-24 12:12:53 crf
drwxr-xr-x 17 root oinstall  4096 2016-12-24 12:12:53 crs
drwxr-xr-x  3 root oinstall  4096 2016-12-24 12:12:53 ctss
drwxr-x---  3 root oinstall  4096 2016-12-24 12:12:53 gnsd
drwxr-xr-x  3 root oinstall 12288 2016-12-24 12:12:53 lib
drwxr-xr-x  3 root oinstall  4096 2016-12-24 12:12:53 ologgerd
drwxr-xr-x  3 root oinstall  4096 2016-12-24 12:12:53 osysmond
drwxr-xr-x  4 root root      4096 2016-12-24 12:13:13 tfa

$ find /u01/app/11.2.0 -uid 0  -exec ls -ld {} \;
--//能查询到许多目录文件都是root用户.

$ ls -l /u01/app
total 16
drwxr-xr-x. 3 root   oinstall 4096 2016-12-18 14:47:35 11.2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drwxrwxr-x. 9 grid   oinstall 4096 2016-12-30 12:09:18 grid
drwxrwxr-x. 7 oracle oinstall 4096 2016-12-24 12:52:35 oracle
drwxrwx---  6 grid   oinstall 4096 2016-12-24 12:42:52 oraInventory

--//11.2.0 目录的owner=root.我估计安装在子目录下安装也能过去,问题也许更多在取消安装或者升级.
--//实际上有许多帖子是关于grid中文件目录权限的问题.总之按照安装文档要求实施总是有一定道理.

--//实际上最好的方法是保存一份权限目录的文件,必须时查询与用于恢复.
getfacl -R /u01/app/11.2.0/grid > dir_privs.txt
setfact -restore dir_privs.txt
--//注意这样保存的是相对路径.保存绝对路径使用如下命令:
getfacl -R --absolute-names /u01/app/11.2.0/grid > dir_privs.txt

--//grid在安装后还保存一份文件目录的权限在如下目录:
# find /u01 -name "crsconfig_*" -exec ls -l {} + | grep utl
-rw-r--r-- 1 root   root       8159 Dec 24  2016 /u01/app/11.2.0/grid/crs/utl/crsconfig_dirs
-rw-r--r-- 1 root   root      12877 Dec 24  2016 /u01/app/11.2.0/grid/crs/utl/crsconfig_fileperms
-rw-r--r-- 1 root   root      11936 Dec 24  2016 /u01/app/11.2.0/grid/crs/utl/crsconfig_files

[20171223]grid用户的环境变量问题.txt的更多相关文章

  1. Linux命令之env:显示当前用户的环境变量

    Linux系统里的env命令可以显示当前用户的环境变量,还可以用来在指定环境变量下执行其他命令.下面来比较一下set,env和export命令的异同:set命令显示当前shell的变量,包括当前用户的 ...

  2. 在Windows系统上以C++打印出当前活动用户的环境变量

    在Windows系统上以C++打印出当前活动用户的环境变量,代码如下(QT环境): void getEnvironmentVariables() { DWORD sessionId = WTSGetA ...

  3. Linux设定系统变量和单个用户的环境变量问题

    环境为Ubuntu. 设定系统变量意思就是所有用户都可以使用设定的环境变量,而设定用户的单个环境变量意思就是只有设定环境的该用户才可以使用这个环境变量. 这里以java的jdk环境变量JAVA_HOM ...

  4. Linux为用户设定环境变量

    今天在做从将MySQL中的数据同步到ES的时候,当启动脚本程序报错: Exception in thread "main" java.lang.UnsupportedClassVe ...

  5. mac OS配置用户全局环境变量(设置字符集为UTF8)

    mac OS系统跟linux系统一样也是将用户的全局环境变量保存在.bash_profile配置文件中,只是mac OS默认没有此文件. 1.创建.bash_profile文件 vi ~/.bash_ ...

  6. linux给当前用户添加环境变量

    比如当前用户为oracel,则添加环境变量操作为: vim  /home/oracel/.bashrc

  7. sudo如何保持当前用户的环境变量?

    现象,我在/etc/profile里设置全局代理,然后使用命令 1.curl http://www.baidu.com  走代理 2.sudo curl http://www.baidu.com 并没 ...

  8. 在Win7中修改 系统盘中 “系统” - “用户” 的环境变量映射关系

    1.在此列表中,选中对应登录帐号 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList 2.将Prof ...

  9. root用户Linux 环境变量的配置解决(-bash: jps: command not found)有关问题

    可以写成:$JAVA_HOME/bin 3. source /root/.bash_profile 发现 jps 等命令运行正常了

随机推荐

  1. IOS 数据存储之 Core Data详解

    Core Date是ios3.0后引入的数据持久化解决方案,它是是苹果官方推荐使用的,不需要借助第三方框架.Core Date实际上是对SQLite的封装,提供了更高级的持久化方式.在对数据库操作时, ...

  2. 《Kubernetes权威指南》——入门

    1 Hello World 1.1 概述 搭建一个Web留言板应用,采用PHP+Redis. Redis由一个master提供写和两个slave提供读. PHP构成的前端Web层由三个实例构成集群,访 ...

  3. Linux 常用命令 | mkdir/rmdir/touch 的使用

    一.创建空目录 命令:mkdir 原意:make directories 所在路径: /bin/mkdir 1.创建空目录 ​ 2.递归创建空目录 选项:-p 如果直接使用mkdir 创建空目录: W ...

  4. css3学习--select怎么去掉默认样式

    select { 2. /*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/ 3. border: solid 1px #000; 4. /*很关键:将默认的select选择框样式 ...

  5. Java 8 新特性-菜鸟教程 (6) -Java 8 Optional 类

    Java 8 Optional 类 Optional 类是一个可以为null的容器对象.如果值存在则isPresent()方法会返回true,调用get()方法会返回该对象. Optional 是个容 ...

  6. Jmeter配置通过SSH连接的mysql数据库

    jmeter连接配置mysql数据库时,如果数据库服务器没有通过ssh连接,则只需要添加配置相应的jdbc参数就可以了.如果数据库服务器是通过SSH连接的,则需要通过中间远程连接工具来登录,此处使用的 ...

  7. [NOI 2015]品酒大会

    Description 题库链接 \(n\) 杯鸡尾酒排成一行,其中第 \(i\) 杯酒 (\(1 \leq i \leq n\)) 被贴上了一个标签 \(s_i\),每个标签都是 \(26\) 个小 ...

  8. [HEOI2016] 字符串

    Description 给定长度为n的字符串,m次询问,每次询问s[a...b]的所有子串与s[c...d]的LCP的最大值.n,m<=10^5. Solution 感觉这种n,m<=10 ...

  9. VSCode git Warning LF will be replaced by CRLF

    本文参考自:http://www.yulongjun.com/linux/20170518-08-lf-cr/ 我们打开Visual Studio Code编辑器,可以看到右下角有这个LF,这是VS ...

  10. 基本css说明

    /*-moz代表firefox浏览器私有属性 2.-ms代表ie浏览器私有属性 3.-webkit代表safari.chrome私有属性*/ body, dl, dd, ul, ol, h1, h2, ...