- 时间:2021-05-12 20:37 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:DBA 在Linux下安装Oracle Database11g数据库图文教程
Oracle11g是比较通用的版本,尝试安装Oracle 12c可惜失败了,没有办法
以下是整理的资料
[b]1. 系在安装文件连接[/b]
[url=http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip?AuthParam=1407205871_4259949f8bacf912168631692563a693]http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip?AuthParam=1407205871_4259949f8bacf912168631692563a693[/url]
[url=http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip?AuthParam=1407205876_ec394cc017d1815a8cce7cc31e0f0bb9]http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip?AuthParam=1407205876_ec394cc017d1815a8cce7cc31e0f0bb9[/url]
[b]2. 具体步骤如下[/b]
Step1. 下载安装文件
Step2. 安装前配置初始化环境
Step3. 安装Oracle Installer - Database
Step4. 配置Oracle Database - Configuration
Step5. 配置Listener
Step6. 启动数据库,并测试是否成功
[b]3. 安装OEM注意事项[/b]
[b]4. 启动数据库步骤[/b]
启动监听./lsnrctl start
启动书库sqplus> start up
[b]二、安装前配置初始化环境[/b]
1. 在linux下创建oracle用户,以及管理组以root用户登录linux,执行以下命令
#/usr/sbin/groupadd dba
#/usr/sbin/groupadd oper
#/usr/sbin/groupadd oinstall
#useradd oracle
#/usr/sbin/usermod -g oinstall -G dba oracle (dba为管理组)
#/usr/sbin/useradd -g oinstall -G dba oracle
#passwd oracle
2. 预先创建安装目录
#mkdir -p /opt/oracle/product
#mkdir -p /opt/oracle/product/11.2.0/db_home1
#mkdir -p /opt/oraInventory
#mkdir -p /opt/oracle/oradata
#mkdir -p /var/opt/oracle
3. 设置目录的所有者所属组和权限
#chown -R oracle.oinstall /opt/oracle
#chown -R oracle.oinstall /opt/oracle/oradata
#chown -R oracle.oinstall /opt/oracle/product/11.2.0/db_home1
#chown -R oracle.dba /opt/oraInventory
#chown oracle.dba /var/opt/oracle
#chmod -R 775 /opt/oracle
#chmod -R 755 /var/opt/oracle
4. 设置用户oracle的环境变量在文件中添加如下:
#su - oracle
#vi /home/oracle/.bash_profile
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_home1
export ORACLE_SID=PROD
export ORACLE_OWNER=oracle
export ORACLE_TERM=vt100
export PATH=PATH:ORACLE_HOME/bin:$HOME/bin
export PATH=ORACLEHOME/bin:ORACLE_HOME/Apache/Apache/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=ORACLEHOME/JRE:ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=CLASSPATH:ORACLE_HOME/network/jlib
export CLASSPATH
PATH=$PATH:/usr/sbin; export PATH
PATH=$PATH:/usr/bin; export PATH
$ source /home/oracle/.bash_profile
[b]三、安装Oracle Installer - Database[/b]
使用Oracle账号,将oracle安装文件上传至服务器,并解压
cd /opt/oracle/database
./runInstaller
1. 配置安全更新
[img]http://files.jb51.net/file_images/article/201408/oracle/1.png[/img]
2. 安装选项
[img]http://files.jb51.net/file_images/article/201408/oracle/2.png[/img]
3. 网格选项
[img]http://files.jb51.net/file_images/article/201408/oracle/3.png[/img]
4. 安装类型
[img]http://files.jb51.net/file_images/article/201408/oracle/4.png[/img]
5. 典型安装
[img]http://files.jb51.net/file_images/article/201408/oracle/5.png[/img]
[img]http://files.jb51.net/file_images/article/201408/oracle/5_2.png[/img]
6. 先决条件检查
[img]http://files.jb51.net/file_images/article/201408/oracle/6.png[/img]
[img]http://files.jb51.net/file_images/article/201408/oracle/6_2.png[/img]
7. 概要
[img]http://files.jb51.net/file_images/article/201408/oracle/7.png[/img]
8. 安装产品
[img]http://files.jb51.net/file_images/article/201408/oracle/8.png[/img]
9. 安装以Root后执行以下两个脚本
[img]http://files.jb51.net/file_images/article/201408/oracle/9.png[/img]
[b]四、配置Oracle Database - Configuration[/b]
1.1 运行dbca script配置数据库
cd /opt/oracle/product/11.2.0/db_home1/bin
./dbca
2.1 Create a database
[img]http://files.jb51.net/file_images/article/201408/oracle/2_1_1.png[/img]
2.2 Database Templates
[img]http://files.jb51.net/file_images/article/201408/oracle/2.2.png[/img]
2.3 Database identification
[img]http://files.jb51.net/file_images/article/201408/oracle/2.3.png[/img]
2.4 Management Options
[img]http://files.jb51.net/file_images/article/201408/oracle/2.4.png[/img]
2.5 Database Credentiais
[img]http://files.jb51.net/file_images/article/201408/oracle/2.5.png[/img]
2.6 Database File Locations
[img]http://files.jb51.net/file_images/article/201408/oracle/2.6.png[/img]
2.7 Database Content
[img]http://files.jb51.net/file_images/article/201408/oracle/2.7.png[/img]
2.8 Initilization Paramters
[img]http://files.jb51.net/file_images/article/201408/oracle/2.8.png[/img]
2.9 Creation Options
[img]http://files.jb51.net/file_images/article/201408/oracle/2.9.png[/img]
[b]五、配置Listener[/b]
1.1 运行netca script配置数据库监听
cd /opt/oracle/product/11.2.0/db_home1/bin
./netca
2. 配置Listener
2.1 Listener Configuration
[img]http://files.jb51.net/file_images/article/201408/oracle/5-2-1.png[/img]
2.2 Create an Listener
[img]http://files.jb51.net/file_images/article/201408/oracle/5-2-2.png[/img]
2.3 Confirm Port Number
[img]http://files.jb51.net/file_images/article/201408/oracle/5-2-3.png[/img]
3. 配置服务器Local Net Service Name Configuration
3.1 Add Local Net Service Name Configuration
[img]http://files.jb51.net/file_images/article/201408/oracle/5-3-1.png[/img]
3.2 Service Name
[img]http://files.jb51.net/file_images/article/201408/oracle/5-3-2.png[/img]
3.3 TCP and Host Name
[img]http://files.jb51.net/file_images/article/201408/oracle/5-3-3.png[/img]
[b]六、启动数据库监听和数据库用以测试[/b]
1. 启动数据库监听
cd /opt/oracle/product/11.2.0/db_home1/bin
./lsnrctl start
[img]http://files.jb51.net/file_images/article/201408/oracle/6_2_1.png[/img]
2. 启动数据库
sqlplus '/as sysdba'
SQL>startup
3. 启动后查看进程
[img]http://files.jb51.net/file_images/article/201408/oracle/6_2_3.png[/img]
4.1. 异常(启动数据库监听失败修改配置文件)
/etc/selinux/config
./lsnrctl error while loading shared libaries libclntsh.so.11.1
[img]http://files.jb51.net/file_images/article/201408/oracle/6_4_1.png[/img]
4.2. 异常(启动数据库监听失败修改配置文件)
异常:
lsnrctl message1070
解决方式:
确认/home/.bash_profile中的环境变量$ORACLE_HOME是否正确
4.3. 异常(无法使用SQLPLUS)
异常
sqlplus ora-01034
ORA-01034:ORACLE not avaiable
ORA-27101 : shared memory realm does not exist
Process ID:0
Session ID:0 Serial Number:0
解决方式
通过sysdba方式登陆,启动数据库后再以普通用户登录
4.4 验证时,提示缺少安装包
yum install unixODBC-devel-2.2.11
yum install unixODBC-2.2.11
yum install sysstat-5.0.5
yum install libaio-devel-0.3.105
yum install liaio-devel-0.3.105
yum install compat-libstdc++-33-3.2.3
yum install libaio-devel
yum install pdksh
yum install elfutils-libelf-devel
yum install sysstat
4.5 验证时,OS Kernel Parmaters
修改/etc/sysctl.conf这个文件,然后用sysctl -p激活
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
5 Oracle Yum 安装yi
Step1、检查网络环境,确保网络畅通
[root@gavinsit]# cat /etc/issue
[root@gavinsit]# ping www.baidu.com
Step2、检查yum是否已安装
[root@gavinsit]# rpm -qa | grep yum
Step3、切换到目录 /etc/yum.repos.d/
[root@gavinsit]# cd /etc/yum.repos.d/
Step4、获取配置文件并进行相应修改
[root@gavinsit]#yum.repos.d]# wget http://public-yum.oracle.com/public-yum-ol6.repo
Step5、使用yum安装oracle-rdbms-server-11gR2-preinstall包
[root@gavinsit]# yum install oracle-rdbms-server-11gR2-preinstall