对数据库管理员使用操作系统认真的方法,(b14231 第63页)
1、创建操作系统用户
创建操作系统用户,并将这个用户指定为dba用户组ora_test@root[/root]> useradd -G dba -g oinstall oradba
ora_test@root[/root]> id oradba
uid=501(oradba) gid=502(oinstall) groups=502(oinstall),501(dba)[@more@]
2、修改用户的密码ora_test@root[/root]> passwd oradba
Changing password for user oradba.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
3、登录的新创建的用户ora_test@root[/root]> su - oradba
4、编辑用户的环境变量,指定ORACLE_HOME和ORACLE_SID[oradba@ora_test ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
ORACLE_HOME=/oracle/app/10.1; export ORACLE_HOME
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
ORACLE_SID=cnhtm; export ORACLE_SID
5、使环境变量生效[oradba@ora_test ~]$ . ./.bash_profile
6、登录数据库
登录数据库,不指定用户名、密码(使用操作系统认证)[oradba@ora_test ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Feb 6 21:37:15 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
7、检查用户schemaSQL> show user
USER is "SYS"
SQL>
--end--