添加非oracle用户到dba, oinstall组

来源:互联网 发布:java开发的发展方向 编辑:程序博客网 时间:2024/05/14 20:24

    oracle用户所拥有的权限比较大,因此有些时候需要使用非oracle用户来完成相关数据库管理工作。尤其是多个人维护系统或数据库时,有必要为其添加不同的用户,然后将这些用户添加到dba组。同时这些用户也可以根据自己的喜好来设定不同的环境变量。本文描述了在linux下创建新用户以及使用新用户来连接数据库等。

#查看当前的oracle用户id及其所属组oracle@SZDB:~> iduid=2000(oracle) gid=1000(oinstall) groups=1000(oinstall),1002(dba)#当前系统环境oracle@SZDB:~> cat /etc/issueWelcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel \r (\l).#添加新用户robinoracle@SZDB:~> su - rootPassword: SZDB:~ # useradd -g oinstall -G dba robin#查看以添加用户的信息SZDB:~ # cat /etc/passwd | grep robinrobin:x:2004:1000::/home/robin:/bin/bash#/home/robin是用户robin的家目录,下面将其修改为/users/robin(此为个人喜欢,可以不用修改)SZDB:~ # vi /etc/passwd  #查看修改后的结果SZDB:~ # cat /etc/passwd | grep robinrobin:x:2004:1000::/users/robin:/bin/bash#因此下面创建对应的家目录,SZDB:~ # mkdir /users/robinSZDB:~ # chown -R robin:oinstall /users/robin   #修改家目录的属主,属组#修改新用户的密码SZDB:~ # passwd robinChanging password for robin.New Password: Bad password: too simpleReenter New Password: Password changed.#切换到新用户SZDB:~ # su - robin#查看新用户robin的相关信息robin@SZDB:~> iduid=2004(robin) gid=1000(oinstall) groups=1000(oinstall),1002(dba)#修改该新用户的环境变量robin@SZDB:~> vi ~/.bash_profile   #可以将oracle用户的环境配置文件的内容复制过来robin@SZDB:~> source ~/.bash_profile  #生效新的环境变量robin@SZDB:~> sidORA_CRS_HOME=/opt/oracle/product/10gR2/crsORACLE_PATH=.:/users/robin/dba_scripts/custom/sql:/users/robin/dba_scripts/common/sqlORA_ASM_HOME=/opt/oracle/product/10gR2/asmORACLE_SID=CNMMBOORACLE_BASE=/users/oracleORACLE_HOME=/users/oracle/OraHome10grobin@SZDB:~> sqlSQL*Plus: Release 10.2.0.3.0 - Production on Thu Nov 22 17:31:50 2012Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.ERROR:ORA-01034: ORACLE not availableORA-27123: unable to attach to shared memory segmentLinux-x86_64 Error: 13: Permission denied   #提示许可拒绝Enter user-name: goex_adminEnter password: ERROR:ORA-01034: ORACLE not availableORA-27123: unable to attach to shared memory segmentLinux-x86_64 Error: 13: Permission deniedEnter user-name: robin@SZDB:~> ps -ef | grep pmon |grep SYBO2SZoracle    2350     1  0 Oct25 ?        00:00:00 ora_pmon_SYBO2SZrobin@SZDB:~> export ORACLE_SID=SYBO2SZrobin@SZDB:~> sqlplus / as sysdbaSQL*Plus: Release 10.2.0.3.0 - Production on Thu Nov 22 17:34:52 2012Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.Connected to an idle instance.idle> exitDisconnectedrobin@SZDB:~> oerr ora 2712327123, 00000, "unable to attach to shared memory segment"// *Cause: shmat() call failed// *Action: check permissions on segment, contact Oracle support#查看$ORACLE_HOME/bin/oracle的权限,此处为751robin@SZDB:~> cd $ORACLE_HOME/bin robin@SZDB:/users/oracle/OraHome10g/bin> ls -hltr oracle-rwxr-x--x 1 oracle oinstall 99M 2011-05-13 14:26 oracle#使用oracle 用户登录robin@SZDB:~> su - oraclePassword: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 99M 2011-05-13 14:26 oracle#Author : Robinson#Blog : http://blog.csdn.net/robinson_0612#修改数据库所在文件夹的权限以便新用户robin有权限操作该路径下的所有文件oracle@SZDB:~/OraHome10g/bin> chmod -R 775 /u02/database oracle@SZDB:~/OraHome10g/bin> su - robinPassword: robin@SZDB:~> sqlSQL*Plus: Release 10.2.0.3.0 - Production on Thu Nov 22 17:42:50 2012Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.Error accessing PRODUCT_USER_PROFILEWarning:  Product user profile information not loaded!You may need to run PUPBLD.SQL as SYSTEMConnected to:Oracle Database 10g Release 10.2.0.3.0 - 64bit Productiongoex_admin@CNMMBO> 

更多参考

有关Oracle RAC请参考
     使用crs_setperm修改RAC资源的所有者及权限
     使用crs_profile管理RAC资源配置文件
     RAC 数据库的启动与关闭
     再说 Oracle RAC services
     Services in Oracle Database 10g
     Migrate datbase from single instance to Oracle RAC
     Oracle RAC 连接到指定实例
     Oracle RAC 负载均衡测试(结合服务器端与客户端)
     Oracle RAC 服务器端连接负载均衡(Load Balance)
     Oracle RAC 客户端连接负载均衡(Load Balance)
     ORACLE RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)
     ORACLE RAC 监听配置 (listener.ora tnsnames.ora)
     配置 RAC 负载均衡与故障转移
     CRS-1006 , CRS-0215 故障一例 
     基于Linux (RHEL 5.5) 安装Oracle 10g RAC
     使用 runcluvfy 校验Oracle RAC安装环境

有关Oracle 网络配置相关基础以及概念性的问题请参考:
     配置非默认端口的动态服务注册
     配置sqlnet.ora限制IP访问Oracle
     Oracle 监听器日志配置与管理
     设置 Oracle 监听器密码(LISTENER)
     配置ORACLE 客户端连接到数据库

有关基于用户管理的备份和备份恢复的概念请参考
     Oracle 冷备份
     Oracle 热备份
     Oracle 备份恢复概念
     Oracle 实例恢复
     Oracle 基于用户管理恢复的处理
     SYSTEM 表空间管理及备份恢复
     SYSAUX表空间管理及恢复
     Oracle 基于备份控制文件的恢复(unsing backup controlfile)

有关RMAN的备份恢复与管理请参考
     RMAN 概述及其体系结构
     RMAN 配置、监控与管理
     RMAN 备份详解
     RMAN 还原与恢复
     RMAN catalog 的创建和使用
     基于catalog 创建RMAN存储脚本
     基于catalog 的RMAN 备份与恢复
     RMAN 备份路径困惑
     使用RMAN实现异机备份恢复(WIN平台)
     使用RMAN迁移文件系统数据库到ASM
     linux 下RMAN备份shell脚本
     使用RMAN迁移数据库到异机

有关ORACLE体系结构请参考
     Oracle 表空间与数据文件
     Oracle 密码文件
     Oracle 参数文件
     Oracle 联机重做日志文件(ONLINE LOG FILE)
     Oracle 控制文件(CONTROLFILE)
     Oracle 归档日志
     Oracle 回滚(ROLLBACK)和撤销(UNDO)
     Oracle 数据库实例启动关闭过程
     Oracle 10g SGA 的自动化管理
     Oracle 实例和Oracle数据库(Oracle体系结构) 

原创粉丝点击