[20170705]理解linux su命令.txt

[20170705]理解linux su命令.txt

[20170705]理解linux su命令.txt,20170705.txt

[20170705]理解linux su命令.txt

–//小编1般在维护时常常选择root用户登录,然后su – oracle
转到其余用户操作
–//一般都投入 – 参数.那个早已成了原则反射…^_^.

# man su       
Change the effective user id and group id to that of USER.

-, -l, –login
make the shell a login shell

–//相当于使用login里面包车型大巴shell,设置好相应的环境.
–//假如执行未有-,也正是单独run a shell with substitute user and group
IDs,不替换里面包车型地铁环境变量只怕相关参数.

1.测试1:
–//当前以root用户登录:
# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# echo $ORACLE_HOME
# export aaa=test
# echo $aaa
test

# su  – oracle
$ id
uid=1001(oracle) gid=1001(oinstall)
groups=101(fuse),1001(oinstall),1002(dba),1003(racoper),1004(asmdba)

$ echo $aaa

–//无显示.

$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1

二.只要履行不加参数 – 呢?

$ echo $ORACLE_HOME

–//环境变量ORACLE_HOME未有设置,而root设置的条件变量aaa呢?
$ echo $aaa
test

–//可以窥见能够显得环境变量aaa.

三.这么看来应该很少使用-参数.
–//实际上rac的管理oracle引进许多东西,建立grid用户.通过有些非正规例子来注解难点:
–//以grid用户登录:
[[email protected]
~ ]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3852
         Available space (kbytes) :     258268
         ID                       : 2101855892
         Device/File Name         :   +DBFS_DG
                                    Device/File integrity check
succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check bypassed due to non-privileged user

–//OK.借使你进入参数:
$ ocrcheck -local
PROTL-602: Failed to retrieve data from the local registry
[20170705]掌握linux su命令.txt。PROCL-26: Error while accessing the physical storage Operating System
error [Permission denied] [13]

–//跟踪看看:
$ strace -f -o /tmp/b1.txt ocrcheck -local
PROTL-602: Failed to retrieve data from the local registry
PROCL-26: Error while accessing the physical storage Operating System
error [Permission denied] [13]

$ grep ‘Permission denied’ /tmp/b1.txt
14849 open(“/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr”,
O_RDONLY|O_SYNC) = -1 EACCES (Permission denied)

–//要打开文件/u01/app/1一.2.0.4/grid/cdata/dm0壹dbadm0贰.olr.

$ ls -l /u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
-rw——- 1 root oinstall 272756736 2017-07-05 09:45:15
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
–//注意看用户,组是root,oinstall,grid用户根本未曾权限打开这一个文件.

–//要化解这一个题材部分dba选拔把root用户里面参加grid的多多环境变量.以root用户执行,不过那样小编以为不是很好!!
–//实际上很不难的秘诀就是切换成root用户执行,注意那年不能进入-
参数,因为如此grid的环境参数就不见了,实际上那样就以
–//root用户执行,而选用的条件依旧grid用户的.

$ su root
Password:

# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# echo $PATH
/usr/local/bin:/bin:/usr/bin:/u01/app/11.2.0.4/grid/bin:.:/u01/app/11.2.0.4/grid/bin

# echo $ORACLE_HOME
/u01/app/11.2.0.4/grid

–//你能够发现grid的环境参数还在.这么些应用以root用户执行如下:
# ocrcheck -local
Status of Oracle Local Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2800
         Available space (kbytes) :     259320
         ID                       : 1632195400
         Device/File Name         :
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
                                    Device/File integrity check
succeeded
         Local registry integrity check succeeded
         Logical corruption check succeeded

–//当然还足以以其余的措施,正是应用sudo命令. sudo ocrcheck -local
–//注意要修改/etc/sudoers,出席:
grid    ALL=(ALL)   ALL

$ sudo ocrcheck -local
[sudo] password for grid:
Status of Oracle Local Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2800
         Available space (kbytes) :     259320
         ID                       : 1632195400
         Device/File Name         :
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
                                    Device/File integrity check
succeeded
         Local registry integrity check succeeded
         Logical corruption check succeeded

su命令.txt,20170705.txt
[20170705]知道linux su命令.txt
–//我1般在珍贵时平日使用root用户登录,然后su – oracle
转到别的用户操作…

RedHat Linux
5.7下Oracle RAC
10.2.0.5 升级到11.2.0.4

–//笔者壹般在维护时平时使用root用户登录,然后su – oracle
转到别的用户操作
–//壹般都投入 – 参数.这些早已成了尺度反射…^_^.

–//笔者一般在保证时平常利用root用户登录,然后su – oracle
转到其余用户操作
–//一般都加入 – 参数.那一个已经成了条件反射…^_^.

澳门金沙国际 1

# man su       
Change the effective user id and group id to that of USER.

# man su       
Change the effective user id and group id to that of USER.

1.升级grid
当前rac状态:

-, -l, –login
make the shell a login shell

-, -l, –login
make the shell a login shell

[root@rac1 ~]# crs_stat -t

–//也正是使用login里面包车型地铁shell,设置好相应的环境.
–//假若执行未有-,也正是仅仅run a shell with substitute user and group
IDs,不替换里面包车型客车环境变量也许有关参数.

–//也等于使用login里面包车型地铁shell,设置好相应的环境.
–//假设执行未有-,也正是1味run a shell with substitute user and group
IDs,不替换里面包车型大巴环境变量大概连带参数.

NameTypeTargetStateHost

ora.rac.db application ONLINE ONLINE rac1
ora….c1.inst application ONLINE ONLINE rac1
ora….c2.inst application ONLINE ONLINE rac2
ora….SM1.asm application ONLINE ONLINE rac1
ora….C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora….SM2.asm application ONLINE ONLINE rac2
ora….C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
crs版本:

[root@rac1 ~]# crsctl query crs softwareversion
CRS software version on node [rac1] is [10.2.0.5.0]
数据库版本:

[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus:Release10.2.0.5.0-Production on TueNov2219:07:552016
Copyright(c)1982,2010,Oracle.AllRightsReserved.
Connected to:
OracleDatabase10gEnterpriseEditionRelease10.2.0.5.0-64bitProduction
With the Partitioning,RealApplicationClusters, OLAP,DataMining
and RealApplicationTesting options
SQL> select * from v$version;

1.测试1:
–//当前以root用户登录:
# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# echo $ORACLE_HOME
# export aaa=test
# echo $aaa
test

1.测试1:
–//当前以root用户登录:
# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# echo $ORACLE_HOME
# export aaa=test
# echo $aaa
test

BANNER

OracleDatabase10gEnterpriseEditionRelease10.2.0.5.0-64bi
PL/SQL Release10.2.0.5.0-Production
CORE 10.2.0.5.0Production
TNS forLinux:Version10.2.0.5.0-Production
NLSRTL Version10.2.0.5.0–Production
Ocr检查:

[oracle@rac1 ~]$ ocrcheck
Status of OracleClusterRegistry is as follows :
Version:2
Total space (kbytes):1043916
Used space (kbytes):3848
Available space (kbytes):1040068
ID :1371096888
Device/FileName:/dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
表决盘检查:

[oracle@rac1 ~]$ crsctl query css votedisk
0.0/dev/raw/raw2
located 1 votedisk(s).
反省软件包安装

检查/etc/security/limit.conf

检查/etc/sysctl.conf

在hosts中添加scan ip信息:

[root@rac1 ~]# cat /etc/hosts
#Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.56.110 rac1
192.168.56.111 rac2
192.168.56.112 rac1-vip
192.168.56.113 rac2-vip
172.16.8.1 rac1-priv
172.16.8.2 rac2-priv
192.168.56.115 rac-scan
翻开Oracle用户音讯:

[oracle@rac1 ~]$ id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
鉴于是升高到1一.贰.0.肆,grid的装置用户也运用oracle来安装,然则急需相应的用户组,手工业来创制:
在颇具节点修改oracle用户组添加asmadmin,asmdba,asmoper,oper组

groupadd -g 1020 asmadmin
groupadd -g 1021 asmdba
groupadd -g 1022 asmoper
groupadd -g 1032 oper
usermod -g oinstall -G dba,oper,asmadmin,asmdba,asmoper oracle
查阅修改后的oracle用户组:
[root@rac1 ~]# id oracle
uid=500(oracle) gid=500(oinstall)
groups=500(oinstall),501(dba),1020(asmadmin),1021(asmdba),1022(asmoper),1032(oper)
在享有节点成立11g安装文件目录

mkdir -p /u01/11.2.0/grid
chown -R oracle:oinstall /u01/11.2.0/grid
chmod -R 775/u01/11.2.0/grid
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1
chmod -R 775/u01/app/oracle/product/11.2.0/db_1
在具备节点添加oracle和grid的环境变量:

vi ~/.bash_profile

增进以下的外号:

alias ora=”export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export
PATH=/u01/app/oracle/product/11.2.0/db_1/bin:$CRS_HOME/bin:$PATH:$HOME/bin
export ORACLE_SID=rac1″
alias grid=”export ORACLE_HOME=/u01/11.2.0/grid
export PATH=/u01/11.2.0/grid/bin:$CRS_HOME/bin:$PATH:$HOME/bin
export ORACLE_SID=+ASM1″
设置cvudisk包,用来检查评定oracle环境

[root@rac1 ~]# cd /home/oracle/grid/rpm/
[root@rac1 rpm]# ls
cvuqdisk-1.0.9-1.rpm
[root@rac1 rpm]# rpm -ivh cvuqdisk-1.0.9-1.rpm
Preparing…###########################################[100%]
1:cvuqdisk
###########################################[100%]
[oracle@rac1 grid]$ pwd
/home/oracle/grid

RedHat Linux 5.柒下Oracle RAC 10.二.0.5升级到11.2.0.4图像和文字详解PDF到Linux公社财富站下载:

——————————————分割线——————————————

免费下载地址在

用户名与密码都是www.linuxidc.com

切实下载目录在 /2016年资料/12月/11日/RedHat Linux 5.7下Oracle RAC
10.2.0.5 升级到11.2.0.4/

下载格局见
http://www.linuxidc.com/Linux/2013-07/87684.htm

——————————————分割线——————————————

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-12/138204.htm

澳门金沙国际 2

# su  – oracle
$ id
uid=1001(oracle) gid=1001(oinstall)
groups=101(fuse),1001(oinstall),1002(dba),1003(racoper),1004(asmdba)

# su  – oracle
$ id
uid=1001(oracle) gid=1001(oinstall)
groups=101(fuse),1001(oinstall),1002(dba),1003(racoper),1004(asmdba)

$ echo $aaa

$ echo $aaa

–//无显示.

–//无显示.

$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1

$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_澳门金沙国际 ,1

贰.比方履行不加参数 – 呢?

2.一旦进行不加参数 – 呢?

$ echo $ORACLE_HOME

$ echo $ORACLE_HOME

–//环境变量ORACLE_HOME没有安装,而root设置的条件变量aaa呢?
$ echo $aaa
test

–//环境变量ORACLE_HOME未有安装,而root设置的条件变量aaa呢?
$ echo $aaa
test

–//能够窥见能够显得环境变量aaa.

–//能够窥见能够展现环境变量aaa.

3.这样看来应该很少使用-参数.
–//实际上rac的管理oracle引入许多东西,建立grid用户.通过某些卓殊例子来验证难题:
–//以grid用户登录:
[grid@dm01dbadm02 ~ ]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3852
         Available space (kbytes) :     258268
         ID                       : 2101855892
         Device/File Name         :   +DBFS_DG
                                    Device/File integrity check
succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check bypassed due to non-privileged user

3.那样看来应该很少使用-参数.
–//实际上rac的管住oracle引进许多事物,建立grid用户.通过有个别奇异例子来表达难题:
–//以grid用户登录:
[grid@dm01dbadm02 ~ ]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3852
         Available space (kbytes) :     258268
         ID                       : 2101855892
         Device/File Name         :   +DBFS_DG
                                    Device/File integrity check
succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check bypassed due to non-privileged user

–//OK.假使你参与参数:
$ ocrcheck -local
PROTL-602: Failed to retrieve data from the local registry
PROCL-26: Error while accessing the physical storage Operating System
error [Permission denied] [13]

–//OK.如果你进入参数:
$ ocrcheck -local
PROTL-602: Failed to retrieve data from the local registry
PROCL-26: Error while accessing the physical storage Operating System
error [Permission denied] [13]

–//跟踪看看:
$ strace -f -o /tmp/b1.txt ocrcheck -local
PROTL-602: Failed to retrieve data from the local registry
PROCL-26: Error while accessing the physical storage Operating System
error [Permission denied] [13]

–//跟踪看看:
$ strace -f -o /tmp/b1.txt ocrcheck -local
PROTL-602: Failed to retrieve data from the local registry
PROCL-26: Error while accessing the physical storage Operating System
error [Permission denied] [13]

$ grep ‘Permission denied’ /tmp/b1.txt
14849 open(“/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr”,
O_RDONLY|O_SYNC) = -1 EACCES (Permission denied)

$ grep ‘Permission denied’ /tmp/b1.txt
14849 open(“/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr”,
O_RDONLY|O_SYNC) = -1 EACCES (Permission denied)

–//要打开文件/u01/app/1一.2.0.4/grid/cdata/dm01dbadm02.olr.

–//要打开文件/u01/app/1壹.二.0.4/grid/cdata/dm0一dbadm0二.olr.

$ ls -l /u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
-rw——- 1 root oinstall 272756736 2017-07-05 09:45:15
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
–//注意看用户,组是root,oinstall,grid用户根本未曾权限打开那么些文件.

$ ls -l /u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
-rw——- 1 root oinstall 272756736 2017-07-05 09:45:15
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
–//注意看用户,组是root,oinstall,grid用户根本未曾权限打开那个文件.

–//要消除那些难题部分dba采取把root用户里面加入grid的多多环境变量.以root用户执行,也就这样小编以为不是很好!!
–//实际上相当粗略的点子正是切换来root用户执行,注意那一年不能够加盟-
参数,因为那样grid的环境参数就不见了,实际上那样就以
–//root用户执行,而选拔的环境依旧grid用户的.

–//要消除那么些难题部分dba选用把root用户里面到场grid的居多条件变量.以root用户执行,也才那样自身认为不是很好!!
–//实际上很简短的措施正是切换成root用户执行,注意那年不可能加盟-
参数,因为那样grid的环境参数就丢掉了,实际上那样就以
–//root用户执行,而利用的条件依然grid用户的.

$ su root
Password:

$ su root
Password:

# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# echo $PATH
/usr/local/bin:/bin:/usr/bin:/u01/app/11.2.0.4/grid/bin:.:/u01/app/11.2.0.4/grid/bin

# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# echo $PATH
/usr/local/bin:/bin:/usr/bin:/u01/app/11.2.0.4/grid/bin:.:/u01/app/11.2.0.4/grid/bin

# echo $ORACLE_HOME
/u01/app/11.2.0.4/grid

# echo $ORACLE_HOME
/u01/app/11.2.0.4/grid

–//你能够发现grid的环境参数还在.这一个动用以root用户执行如下:
# ocrcheck -local
Status of Oracle Local Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2800
         Available space (kbytes) :     259320
         ID                       : 1632195400
         Device/File Name         :
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
                                    Device/File integrity check
succeeded
         Local registry integrity check succeeded
         Logical corruption check succeeded

–//你能够发现grid的环境参数还在.那么些应用以root用户执行如下:
# ocrcheck -local
Status of Oracle Local Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2800
         Available space (kbytes) :     259320
         ID                       : 1632195400
         Device/File Name         :
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
                                    Device/File integrity check
succeeded
         Local registry integrity check succeeded
         Logical corruption check succeeded

–//当然仍是能够以此外的法子,正是运用sudo命令. sudo ocrcheck -local
–//注意要修改/etc/sudoers,参加:
grid    ALL=(ALL)   ALL

–//当然还足以以其它的措施,就是利用sudo命令. sudo ocrcheck -local
–//注意要修改/etc/sudoers,参预:
grid    ALL=(ALL)   ALL

$ sudo ocrcheck -local
[sudo] password for grid:
Status of Oracle Local Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2800
         Available space (kbytes) :     259320
         ID                       : 1632195400
         Device/File Name         :
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
                                    Device/File integrity check
succeeded
         Local registry integrity check succeeded
         Logical corruption check succeeded

$ sudo ocrcheck -local
[sudo] password for grid:
Status of Oracle Local Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2800
         Available space (kbytes) :     259320
         ID                       : 1632195400
         Device/File Name         :
/u01/app/11.2.0.4/grid/cdata/dm01dbadm02.olr
                                    Device/File integrity check
succeeded
         Local registry integrity check succeeded
         Logical corruption check succeeded

相关文章