添加非oracle用户到dba, oinstall组_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1854 | 回复: 0   主题: 添加非oracle用户到dba, oinstall组        下一篇 
张伟
注册用户
等级:列兵
经验:110
发帖:81
精华:0
注册:2011-12-22
状态:离线
发送短消息息给张伟 加好友    发送短消息息给张伟 发消息
发表于: IP:您无权察看 2015-7-13 11:33:07 | [全部帖] [楼主帖] 楼主

#查看当前的oracle用户id及其所属组

oracle@SZDB:~> id

uid=2000(oracle) gid=1000(oinstall) groups=1000(oinstall),1002(dba)

#当前系统环境

oracle@SZDB:~> cat /etc/issue

Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).

#添加新用户robin

oracle@SZDB:~> su - root

Password:

SZDB:~ # useradd -g oinstall -G dba robin

#查看以添加用户的信息

SZDB:~ # cat /etc/passwd   grep robin

robin:x:2004:1000::/home/robin:/bin/bash

#/home/robin是用户robin的家目录,下面将其修改为/users/robin(此为个人喜欢,可以不用修改)

SZDB:~ # vi /etc/passwd

#查看修改后的结果

SZDB:~ # cat /etc/passwd   grep robin

robin:x:2004:1000::/users/robin:/bin/bash

#因此下面创建对应的家目录,

SZDB:~ # mkdir /users/robin

SZDB:~ # chown -R robin:oinstall /users/robin   #修改家目录的属主,属组

#修改新用户的密码

SZDB:~ # passwd robin

Changing password for robin.

New Password:

Bad password: too simple

Reenter New Password:

Password changed.

#切换到新用户

SZDB:~ # su - robin

#查看新用户robin的相关信息

robin@SZDB:~> id

uid=2004(robin) gid=1000(oinstall) groups=1000(oinstall),1002(dba)

#修改该新用户的环境变量

robin@SZDB:~> vi ~/.bash_profile   #可以将oracle用户的环境配置文件的内容复制过来

robin@SZDB:~> source ~/.bash_profile  #生效新的环境变量

robin@SZDB:~> sid

ORA_CRS_HOME=/opt/oracle/product/10gR2/crs

ORACLE_PATH=.:/users/robin/dba_scripts/custom/sql:/users/robin/dba_scripts/common/sql

ORA_ASM_HOME=/opt/oracle/product/10gR2/asm

ORACLE_SID=CNMMBO

ORACLE_BASE=/users/oracle

ORACLE_HOME=/users/oracle/OraHome10g

robin@SZDB:~> sql

SQL*Plus: Release 10.2.0.3.0 - Production on Thu Nov 2217:31:502012

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:

ORA-01034: ORACLE not available

ORA-27123: unable to attach to shared memory segment

Linux-x86_64 Error: 13: Permission denied   #提示许可拒绝

Enter user-name: goex_admin

Enter password:

ERROR:

ORA-01034: ORACLE not available

ORA-27123: unable to attach to shared memory segment

Linux-x86_64 Error: 13: Permission denied

Enter user-name:

robin@SZDB:~> ps -ef   grep pmon  grep SYBO2SZ

oracle    235010 Oct25 ?        00:00:00 ora_pmon_SYBO2SZ

robin@SZDB:~> export ORACLE_SID=SYBO2SZ

robin@SZDB:~> sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Thu Nov 2217:34:522012

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to an idle instance.

idle> exit

Disconnected

robin@SZDB:~> oerr ora 27123

27123, 00000, "unable to attach to shared memory segment"

// *Cause: shmat() call failed

// *Action: check permissions on segment, contact Oracle support

#查看$ORACLE_HOME/bin/oracle的权限,此处为751

robin@SZDB:~> cd $ORACLE_HOME/bin

robin@SZDB:/users/oracle/OraHome10g/bin> ls -hltr oracle

-rwxr-x--x 1 oracle oinstall 99M2011-05-1314:26 oracle

#使用oracle 用户登录

robin@SZDB:~> su - oracle

Password:

oracle@SZDB:~> cd $ORACLE_HOME/bin

#修改$ORACLE_HOME/bin/oracle下的权限

oracle@SZDB:~/OraHome10g/bin> chmod 6751 oracle  #这个地方是关键,修改这个权限以便其他用户能够从同一主机访问oracle 环境

oracle@SZDB:~/OraHome10g/bin> ls -hltr oracle

-rwsr-s--x 1 oracle oinstall 99M2011-05-1314:26 oracle

#修改数据库所在文件夹的权限以便新用户robin有权限操作该路径下的所有文件

oracle@SZDB:~/OraHome10g/bin> chmod -R 775 /u02/database

oracle@SZDB:~/OraHome10g/bin> su - robin

Password:

robin@SZDB:~> sql

SQL*Plus: Release 10.2.0.3.0 - Production on Thu Nov 2217:42:502012

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Error accessing PRODUCT_USER_PROFILE

Warning:  Product user profile information not loaded!

You may need to run PUPBLD.SQL as SYSTEM

Connected to:

Oracle Database 10g Release 10.2.0.3.0 - 64bit Production

goex_admin@CNMMBO>

--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论