yum install gcc make binutils setarch compat-db libstdc++-devel unixODBA unixODBC-devel libaio-devel sysstat pdksh
groupadd dba
groupadd oinstall
useradd -d /home/oracle -g dba -G oinstall -s /bin/bash oracle
passwd oracle
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0.3
export ORACLE_SID=testdb
export ORACLE_OWNER=oracle
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/X11R6/lib:$LD_LIBRARY_PATH
export PATH=.:/usr/sbin:$ORACLE_HOME/bin:$ORACLE_HOME/jdk/bin:$PATH
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$CLASSPATH
export LANG=en_US
1.# vi /etc/security/limits.conf
#增加以下设置
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
2. 修改配置文件(两台主机实施)
# vi /etc/sysctl.conf
#增加以下配置
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 68719476736
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
# sysctl -p
3、解压两个压缩包
4、拷贝建库文件/oracle/database/response目录中
dbca.rsp db_install.rsp netca.rsp 3个文件到其它目录(/oracle)下
5、更改db_install.rsp内容
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=centos
INVENTORY_LOCATION=/oracle/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/oracle/app/oracle/product/11.2.0.3
ORACLE_BASE=/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.globalDBName=testdb
oracle.install.db.config.starterdb.SID=testdb
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.password.ALL=sys
6、安装oracle软件
./runInstaller -silent -responseFile /oracle/db_install.rsp
安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在进行,如果出现[FATAL],则安装程序已经停止了。打开另一个终端,执行
#tail -100 f /oracle/app/oraInventory/logs/installActions......log
可以实时跟踪查看安装日志,了解安装的进度。
当出现
以下配置脚本需要以 "root" 用户的身份执行。
#!/bin/sh
#要运行的 Root 脚本
/oracle/app/oraInventory/orainstRoot.sh
/oracle/app/product/11.2.0/db_1/root.sh
要执行配置脚本, 请执行以下操作:
1. 打开一个终端窗口
2. 以 "root" 身份登录
3. 运行脚本
4. 返回此窗口并按 "Enter" 键继续
Successfully Setup Software.
表示安装成功了。按照其提示操作。
7、安装实例
修改dbca.rsp文件
RESPONSEFILE_VERSION = "11.2.0"
GDBNAME = "testbd"
SID = "testdb"
SYSPASSWORD = "sys"
DATAFILEDESTINATION =/oracle/data/
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "800"
SYSDBAUSERNAME = "sys"
8、执行安装实例
dbca -silent -responseFile /oracle/dbca.rsp
Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 3%
DBCA_PROGRESS : 11%
DBCA_PROGRESS : 18%
DBCA_PROGRESS : 26%
DBCA_PROGRESS : 37%
Creating and starting Oracle instance
DBCA_PROGRESS : 40%
DBCA_PROGRESS : 45%
DBCA_PROGRESS : 50%
DBCA_PROGRESS : 55%
DBCA_PROGRESS : 56%
DBCA_PROGRESS : 60%
DBCA_PROGRESS : 62%
Completing Database Creation
DBCA_PROGRESS : 66%
DBCA_PROGRESS : 70%
DBCA_PROGRESS : 73%
DBCA_PROGRESS : 85%
DBCA_PROGRESS : 96%
DBCA_PROGRESS : 100%
Database creation complete. For details check the logfiles at:
/oracle/cfgtoollogs/dbca/testbd.
Database Information:
Global Database Name:testbd
System Identifier(SID):testdb
9、设置监听
netca /silent /responsefile /oracle/netca.rsp
10、最后看进程状态
ps -ef|grep ora
lsnrctl status
至此oracle安装完成
sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES)
ADR_BASE = /oracle
tnsnames.ora
TESTDB123 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.153.89)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = testdb)
)
)
listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/oracle/product/11.2.0.3)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = testdb)
(ORACLE_HOME = /oracle/app/oracle/product/11.2.0.3)
(SID_NAME = testdb)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = centos)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /oracle
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount;
ORACLE 例程已经启动。
Total System Global Area 835104768 bytes
Fixed Size 2232960 bytes
Variable Size 490737024 bytes
Database Buffers 339738624 bytes
Redo Buffers 2396160 bytes
数据库装载完毕。
以下是更改oracle字符集
SQL> alter session set sql_trace=true;
会话已更改。
SQL> alter system enable restricted session;
系统已更改。
SQL> alter system set job_queue_processes=0;
系统已更改。
SQL> alter system set aq_tm_processes=0;
系统已更改。
SQL> alter database open;
数据库已更改。
SQL> alter database character set INTERNAL_USE UTF8;
数据库已更改。
SQL> select name,value$ from props$ where name like '%NLS%';