以root用户运行脚本
[root@stone ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@stone ~]# /u01/app/Oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
将以下文件中的环境变量写入oracle主目录下的.bash_profile文件
[root@stone ~]# cat ora_env.txt
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
ORACLE_SID=stone; export ORACLE_SID
ORA_NLS33=$ORACLE_HOME/nls/admin/data; export ORA_NLS33
NLS_LANG=american_america.zhs16gbk;export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH; export PATH
[root@stone ~]# cat ora_env.txt >> /home/oracle/.bash_profile
[root@stone ~]# cat /home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib; export LD_LIBRARY_PATH
ORACLE_SID=stone; export ORACLE_SID
ORA_NLS33=$ORACLE_HOME/nls/admin/data; export ORA_NLS33
NLS_LANG=american_america.zhs16gbk;export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH; export PATH
切换到oracle用户,确认环境变量已生效
[root@stone ~]# su - oracle
[oracle@stone ~]$ env | grep ORACLE
ORACLE_SID=stone
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
9、使用netmgr新建一个监听,以便在创建数据库时同时安装em
[oracle@stone ~]$ netmgr
新建监听
![clipboard[102] clipboard[102]](../../upload/2014_03/140320162599331.png)
增加一个监听地址
![clipboard[103] clipboard[103]](../../upload/2014_03/140320162599332.png)
设置对应的数据库服务
![clipboard[104] clipboard[104]](../../upload/2014_03/140320162599333.png)
