Oracle users have relatively large permissions. Therefore, you may need to use non-oracle users to manage related databases. In particular, it is necessary for multiple individuals to add different users to the system or database, and then add these users to the dba group. These users can also set different environment variables based on their preferences. This article describes how to create a new user in linux and connect to a database using a new user.
# View the current oracle user id and its Group
Oracle @ SZDB: ~> Id
Uid = 2000 (oracle) gid = 1000 (oinstall) groups = 1000 (oinstall), 1002 (dba)
# Current System Environment
Oracle @ SZDB: ~> Cat/etc/issue
Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64)-Kernel \ r (\ l ).
# Add a new user, robin.
Oracle @ SZDB: ~> Su-root
Password:
SZDB :~ # Useradd-g oinstall-G dba robin
# View to add user information
SZDB :~ # Cat/etc/passwd | grep robin
ROUND robin: x: 2004: 1000:/home/round:/bin/bash
#/Home/robin is the home directory of user robin. Change it to/users/robin (this is my favorite, but you do not need to modify it)
SZDB :~ # Vi/etc/passwd
# View the modified results
SZDB :~ # Cat/etc/passwd | grep robin
Round: x: 2004: 1000:/users/round:/bin/bash
# Create the corresponding home directory below,
SZDB :~ # Mkdir/users/robin
SZDB :~ # Chown-R robin: oinstall/users/robin # modify the owner and group of the Home Directory
# Changing the password of a new user
SZDB :~ # Passwd robin
Changing password for robin.
New Password:
Bad password: too simple
Reenter New Password:
Password changed.
# Switch to a new user
SZDB :~ # Su-robin
# View information about the new user robin
Robin @ SZDB: ~> Id
Uid = 2004 (robin) gid = 1000 (oinstall) groups = 1000 (oinstall), 1002 (dba)
# Modifying the environment variables of the new user
Robin @ SZDB: ~> Vi ~ /. Bash_profile # copy the content of the oracle user's Environment configuration file
Robin @ SZDB: ~> Source ~ /. Bash_profile # new environment variables take effect
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 22 17:31:50 2012
Copyright (c) 1982,200 6, Oracle. All Rights Reserved.
ERROR:
A ORA-01034: ORACLE not available
ORA-27123: unable to attach to shared memory segment
Linux-x86_64 Error: 13: Permission denied # The license is rejected
Enter user-name: goex_admin
Enter password:
ERROR:
A 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 2350 1 0 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 22 17:34:52 2012
Copyright (c) 1982,200 6, Oracle. All Rights Reserved.
Connected to an idle instance.
Idle> exit
Disconnected
Robin @ SZDB: ~> Oerr ora 27123.
27123,000 00, "unable to attach to shared memory segment"
// * Cause: shmat () call failed
// * Action: check permissions on segment, contact Oracle support
# View the permissions of $ ORACLE_HOME/bin/oracle. The value is 751.
Robin @ SZDB: ~> Cd $ ORACLE_HOME/bin
Robin @ SZDB:/users/oracle/OraHome10g/bin> ls-hltr oracle
-Rwxr-x -- x 1 oracle oinstall 99 M oracle
# Log on with an oracle user
Robin @ SZDB: ~> Su-oracle
Password:
Oracle @ SZDB: ~> Cd $ ORACLE_HOME/bin
# Modify permissions under $ ORACLE_HOME/bin/oracle
Oracle @ SZDB :~ /OraHome10g/bin> chmod 6751 oracle # This is the key. modify this permission so that other users can access the oracle environment from the same host.
Oracle @ SZDB :~ /OraHome10g/bin> ls-hltr oracle
-Rwsr-s -- x 1 oracle oinstall 99 M oracle
# Author: Robinson
# Modify the permissions of the folder where the database is located so that the new user robin has the permission to operate all files in the path.
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 22 17:42:50 2012
Copyright (c) 1982,200 6, 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:
Oracle Database 10g Release 10.2.0.3.0-64bit Production
Goex_admin @ CNMMBO>
Oracle video tutorial follow: http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html