[root@ora11g home]# ls -la
total 20
drwxr-xr-x 3 root root 4096 May 4 11:33 .
drwxr-xr-x 26 root root 4096 May 4 10:00 ..
drwx------ 4 oracle oinstall 4096 May 4 11:30 oracle_bak
[root@ora11g home]# mkdir oracle
[root@ora11g home]# chown oracle:oinstall oracle
[root@ora11g home]# ls -la
total 24
drwxr-xr-x 4 root root 4096 May 4 11:33 .
drwxr-xr-x 26 root root 4096 May 4 10:00 ..
drwxr-xr-x 2 oracle oinstall 4096 May 4 11:33 oracle
drwx------ 4 oracle oinstall 4096 May 4 11:30 oracle_bak
[root@ora11g home]# cd /etc/skel
[root@ora11g skel]# ls -la
total 64
drwxr-xr-x 3 root root 4096 Mar 17 16:11 .
drwxr-xr-x 96 root root 12288 May 4 11:07 ..
-rw-r--r-- 1 root root 33 Jun 2 2011 .bash_logout
-rw-r--r-- 1 root root 176 Jun 2 2011 .bash_profile
-rw-r--r-- 1 root root 124 Jun 2 2011 .bashrc
-rw-r--r-- 1 root root 515 Jun 21 2011 .emacs
drwxr-xr-x 4 root root 4096 Feb 1 2012 .mozilla
[root@ora11g skel]# cp .* /home/oracle/
cp: omitting directory `.'
cp: omitting directory `..'
cp: omitting directory `.mozilla'
[root@ora11g skel]# cd /home/oracle
[root@ora11g oracle]# ls -la
total 28
drwxr-xr-x 2 oracle oinstall 4096 May 4 11:33 .
drwxr-xr-x 4 root root 4096 May 4 11:33 ..
-rw-r--r-- 1 root root 33 May 4 11:33 .bash_logout
-rw-r--r-- 1 root root 176 May 4 11:33 .bash_profile
-rw-r--r-- 1 root root 124 May 4 11:33 .bashrc
-rw-r--r-- 1 root root 515 May 4 11:33 .emacs
注意权限,必须是oracle用户,oinstall组的
[root@ora11g oracle]# chown oracle:oinstall /home/oracle -R
[root@ora11g oracle]# ls -la
total 28
drwxr-xr-x 2 oracle oinstall 4096 May 4 11:33 .
drwxr-xr-x 4 root root 4096 May 4 11:33 ..
-rw-r--r-- 1 oracle oinstall 33 May 4 11:33 .bash_logout
-rw-r--r-- 1 oracle oinstall 176 May 4 11:33 .bash_profile
-rw-r--r-- 1 oracle oinstall 124 May 4 11:33 .bashrc
-rw-r--r-- 1 oracle oinstall 515 May 4 11:33 .emacs
[root@ora11g oracle]# su - oracle
[oracle@ora11g ~]$ sqlplus / as sysdba
-bash: sqlplus: command not found
[oracle@ora11g ~]$ vi .bash_profile
添加以下环境变量的内容:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ora11g
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@ora11g ~]$ . .bash_profile
[oracle@ora11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon May 4 11:36:31 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
oracle用户又可以继续登录了