7.设置用户的.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
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/crs
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:${PATH}:$HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/oracm/lib:$ORACLE_HOME/lib
export LIBPATH=$LIBPATH:$ORA_CRS_HOME/lib:$ORACLE_HOME/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/JRE
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
运行命令来使设置应用:source /home/oracle/.bash_profile
8.安装Oracle Database
切换到oracle用户
$/mount_point/db/runInstaller
选择 Basic Installation
Oracle Base 的位置:/u01/app/oracle
Oracle Home 位置:/u01/app/oracle/product/11.1.0/db_1
安装类型:Enterprise Edition (3.3GB)
UNIX DBA 组:dba
确保选中 Create Starter Database
全局数据库名称:orcl
输入数据库口令并确认口令
清单目录:/u01/app/oraInventory
操作系统组名:oinstall
配置“口令管理”
sys,system,scot oracleadmin
以root用户运行脚本
[iyunv@squid ~]$ /u01/app/oraInventory/orainstRoot.sh
[iyunv@squid oracle]# /u01/app/oracle/product/11.1.0/db_1/root.sh
9.安装完成
安装汇总信息
全局数据库名称: orcl
System Identifier(SID): orcl
Server Parameters filename:/u01/app/oracle/product/11.1.0/db_1/dbs/spfileorcl.ora
企业管理器地址: https://ip:1158/em
企业管理器配置文件: /u01/app/oracle/product/11.1.0/db_1/localhost
登陆OEM界面https://ip:1158/em
使用sys登陆需要选择sysdba的身份
10.启动和停止的方法
首先启动的应该是数据库,然后是监听,最后是OEM
启动和停止数据库:
启动和停止数据库的最简单方法是从 OEM 控制台启动和停止。要从命令行执行此操作,请在以 oracle 身份登录后使用 SQL*Plus,如下所示:
启动:
$ sqlplus
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Nov 5 00:00:31 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> startup
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1303216 bytes
Variable Size 377490768 bytes
Database Buffers 465567744 bytes
Redo Buffers 5169152 bytes
Database mounted.
Database opened.
SQL> exit
停止:
$ sqlplus
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Nov 5 00:00:31 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
启动和停止监听器:
监听器接受客户端的连接请求,并在验证证书后创建数据库连接。要使用 OEM,必须先启动监听器。
$ lsnrctl start
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 25-OCT-2009 08:09:59
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.1.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 25-OCT-2009 08:09:59
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
$ lsnrctl stop
[oracle@localhost ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 25-OCT-2009 08:09:07
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
启动和停止 Oracle 企业管理器数据库控制:
$ emctl start dbconsole
[oracle@localhost ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.1.0.6.0
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
https://localhost.localdomain:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ............................. started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.1.0/db_1/localhost.localdomain_orcl/sysman/log
$ emctl stop dbconsole
[oracle@localhost ~]$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.1.0.6.0
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
https://localhost.localdomain:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
... Stopped.