RedHat6.4安装Oracle12c 12.1.0.2.0 博客分类: 数据库oracle oracleredhatlinux
程序员文章站
2024-03-02 11:34:52
...
[root@pacollector ~]# vi /etc/hosts
这里要把本机IP和主机名加入hosts文件中
VMWare设置CD/DVD处勾选已连接并指定RedHat6的ISO安装包
[root@pacollector ~]#mkdir /mnt/cdrom
[root@pacollector ~]#mount -o loop /dev/cdrom /mnt/cdrom
[root@pacollector ~]#yum list|grep vsftpd
[root@pacollector software]# groupadd oinstall
[root@pacollector software]# groupadd dba
[root@pacollector software]# useradd -g oinstall -G dba oracle
[root@pacollector software]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@pacollector /]# mkdir -p /u01/app/oracle
[root@pacollector /]# chown -R oracle:oinstall /u01/app/oracle
[root@pacollector /]# chmod -R 775 /u01/app/oracle
[root@pacollector /]# mkdir -p /u01/app/oraInventory
[root@pacollector /]# chown -R oracle:oinstall /u01/app/oraInventory
[root@pacollector /]# chmod -R 775 /u01/app/oraInventory
[root@pacollector /]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@pacollector /]# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
[root@pacollector /]# vi /etc/sysctl.conf
# Controls the maximum shared segment size, in bytes
# kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
# kernel.shmall = 4294967296
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048576
[root@pacollector etc]# lsmod|grep bridge
[root@pacollector etc]# modprobe bridge
[root@pacollector etc]# lsmod|grep bridge
bridge 79078 0
stp 2218 1 bridge
llc 5546 2 bridge,stp
[root@pacollector etc]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048576
以上几个内核参数的大致含义如下――
kernel.shmma:最大共享内存段,以字节为单位,物理内存*1024*1024*2,为物理内存的2倍。
kernel.shmmni:共享内存段的最大数目。
kernel.shmall:共享内存总量,以页为单位。
kernel.sem:每个信号对象集的最大信号对象数;系统范围内最大信号对象数;每个信号对象支持的最大操作数;系统范围内最大信号对象集数。
fs.file-max:文件句柄数,表示在Linux系统中可以打开的文件数量。
net.ipv4.ip_local_port_range:应用程序可使用的IPv4端口范围。
rpm -q binutils compat-libstdc++-33 compat-libcap1-1.10 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel
rpm -q glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat
rpm -q unixODBC unixODBC-devel
yum -y install binutils compat-libstdc++-33 compat-libcap1-1.10 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel
yum -y install glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat
yum -y install unixODBC unixODBC-devel
rpm -ivh elfutils-libelf-devel-static-0.152-1.el6.x86_64.rpm --nodeps
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm --nodeps
rpm -q binutils compat-libstdc++-33 compat-libcap1-1.10 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static glibc glibc-common glibc-devel gcc- gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel | sort
[root@pacollector ~]# exit
这个地方要退出root用户重新用oracle用户登录,不能在root用户下面直接su - oracle
[oracle@pacollector ~]$ unzip p17694377_121020_Linux-x86-64_1of8.zip
[oracle@pacollector ~]$ unzip p17694377_121020_Linux-x86-64_2of8.zip
[oracle@pacollector ~]$ cd database/
[oracle@pacollector database]$ ls
install readme.html response rpm runInstaller sshsetup stage welcome.html
[oracle@pacollector database]$ export DISPLAY=192.168.10.16:0.0
[oracle@pacollector database]$ ./runInstaller
这个地方不要急着单击OK按钮,要换成root用户登录后执行Number1和Number2两个脚本。
[root@pacollector ~]# /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@pacollector ~]# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.1.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 script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@pacollector ~]#
在图形界面单击close按钮完成安装。
[oracle@pacollector ~]$ vi .bash_profile
# PATH=$PATH:$HOME/bin
# export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_SID=pacollorcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:.
export LANG=en_US
# export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
[oracle@pacollector ~]$ source .bash_profile
[oracle@pacollector ~]$ which lsnrctl
/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl
[oracle@pacollector ~]$ cd /u01/app/oracle/product/12.1.0/dbhome_1/bin
[oracle@pacollector bin]$ pwd
/u01/app/oracle/product/12.1.0/dbhome_1/bin
[oracle@pacollector bin]$ vi dbstart
# ORACLE_HOME_LISTNER=$1
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@pacollector bin]$ vi dbshut
# ORACLE_HOME_LISTNER=$1
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@pacollector bin]$ vi /etc/oratab
# pacollorcl:/u01/app/oracle/product/12.1.0/dbhome_1:N
pacollorcl:/u01/app/oracle/product/12.1.0/dbhome_1:Y
[root@pacollector ~]$ vi /etc/rc.d/rc.local
su -oracle -c 'dbstart'
su -oracle -c 'lsnrctl start'
[oracle@pacollector ~]$ lsnrctl status
[oracle@pacollector ~]$ lsnrctl start
[oracle@pacollector ~]$ lsnrctl stop
[oracle@pacollector ~]$ sqlplus /nolog
SQL> conn /as sysdba
SQL> startup --"启动数据库实例"
SQL> shutdown immediate --"关闭数据库实例"
或者
[oracle@pacollector ~]$ sqlplus / as sysdba
SQL> startup --"启动数据库实例"
SQL> shutdown immediate --"关闭数据库实例"
[root@pacollector ~]$ sudo service iptables stop
[root@pacollector ~]$ sudo service iptables start
[root@pacollector ~]$ sudo chkconfig iptables off
[root@pacollector ~]$ sudo chkconfig iptables on
[root@pacollector ~]$ sudo vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
[oracle@pacollector ~]$ echo $ORACLE_SID --查看Oracle实例名
[oracle@pacollector ~]$ ps -ef|grep smon --查看已经启动了的实例名
[oracle@pacollector ~]$ dbca
会出现图形界面配置实例
[oracle@pacollector ~]$ netca
会出现配置Oracle Net Services Configuration的图形界面配置
这里要把本机IP和主机名加入hosts文件中
VMWare设置CD/DVD处勾选已连接并指定RedHat6的ISO安装包
[root@pacollector ~]#mkdir /mnt/cdrom
[root@pacollector ~]#mount -o loop /dev/cdrom /mnt/cdrom
[root@pacollector ~]#yum list|grep vsftpd
[root@pacollector software]# groupadd oinstall
[root@pacollector software]# groupadd dba
[root@pacollector software]# useradd -g oinstall -G dba oracle
[root@pacollector software]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@pacollector /]# mkdir -p /u01/app/oracle
[root@pacollector /]# chown -R oracle:oinstall /u01/app/oracle
[root@pacollector /]# chmod -R 775 /u01/app/oracle
[root@pacollector /]# mkdir -p /u01/app/oraInventory
[root@pacollector /]# chown -R oracle:oinstall /u01/app/oraInventory
[root@pacollector /]# chmod -R 775 /u01/app/oraInventory
[root@pacollector /]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@pacollector /]# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
[root@pacollector /]# vi /etc/sysctl.conf
# Controls the maximum shared segment size, in bytes
# kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
# kernel.shmall = 4294967296
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048576
[root@pacollector etc]# lsmod|grep bridge
[root@pacollector etc]# modprobe bridge
[root@pacollector etc]# lsmod|grep bridge
bridge 79078 0
stp 2218 1 bridge
llc 5546 2 bridge,stp
[root@pacollector etc]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048576
以上几个内核参数的大致含义如下――
kernel.shmma:最大共享内存段,以字节为单位,物理内存*1024*1024*2,为物理内存的2倍。
kernel.shmmni:共享内存段的最大数目。
kernel.shmall:共享内存总量,以页为单位。
kernel.sem:每个信号对象集的最大信号对象数;系统范围内最大信号对象数;每个信号对象支持的最大操作数;系统范围内最大信号对象集数。
fs.file-max:文件句柄数,表示在Linux系统中可以打开的文件数量。
net.ipv4.ip_local_port_range:应用程序可使用的IPv4端口范围。
rpm -q binutils compat-libstdc++-33 compat-libcap1-1.10 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel
rpm -q glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat
rpm -q unixODBC unixODBC-devel
yum -y install binutils compat-libstdc++-33 compat-libcap1-1.10 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel
yum -y install glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat
yum -y install unixODBC unixODBC-devel
rpm -ivh elfutils-libelf-devel-static-0.152-1.el6.x86_64.rpm --nodeps
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm --nodeps
rpm -q binutils compat-libstdc++-33 compat-libcap1-1.10 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static glibc glibc-common glibc-devel gcc- gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel | sort
[root@pacollector ~]# exit
这个地方要退出root用户重新用oracle用户登录,不能在root用户下面直接su - oracle
[oracle@pacollector ~]$ unzip p17694377_121020_Linux-x86-64_1of8.zip
[oracle@pacollector ~]$ unzip p17694377_121020_Linux-x86-64_2of8.zip
[oracle@pacollector ~]$ cd database/
[oracle@pacollector database]$ ls
install readme.html response rpm runInstaller sshsetup stage welcome.html
[oracle@pacollector database]$ export DISPLAY=192.168.10.16:0.0
[oracle@pacollector database]$ ./runInstaller
这个地方不要急着单击OK按钮,要换成root用户登录后执行Number1和Number2两个脚本。
[root@pacollector ~]# /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@pacollector ~]# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.1.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 script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@pacollector ~]#
在图形界面单击close按钮完成安装。
[oracle@pacollector ~]$ vi .bash_profile
# PATH=$PATH:$HOME/bin
# export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_SID=pacollorcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:.
export LANG=en_US
# export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
[oracle@pacollector ~]$ source .bash_profile
[oracle@pacollector ~]$ which lsnrctl
/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl
[oracle@pacollector ~]$ cd /u01/app/oracle/product/12.1.0/dbhome_1/bin
[oracle@pacollector bin]$ pwd
/u01/app/oracle/product/12.1.0/dbhome_1/bin
[oracle@pacollector bin]$ vi dbstart
# ORACLE_HOME_LISTNER=$1
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@pacollector bin]$ vi dbshut
# ORACLE_HOME_LISTNER=$1
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@pacollector bin]$ vi /etc/oratab
# pacollorcl:/u01/app/oracle/product/12.1.0/dbhome_1:N
pacollorcl:/u01/app/oracle/product/12.1.0/dbhome_1:Y
[root@pacollector ~]$ vi /etc/rc.d/rc.local
su -oracle -c 'dbstart'
su -oracle -c 'lsnrctl start'
[oracle@pacollector ~]$ lsnrctl status
[oracle@pacollector ~]$ lsnrctl start
[oracle@pacollector ~]$ lsnrctl stop
[oracle@pacollector ~]$ sqlplus /nolog
SQL> conn /as sysdba
SQL> startup --"启动数据库实例"
SQL> shutdown immediate --"关闭数据库实例"
或者
[oracle@pacollector ~]$ sqlplus / as sysdba
SQL> startup --"启动数据库实例"
SQL> shutdown immediate --"关闭数据库实例"
[root@pacollector ~]$ sudo service iptables stop
[root@pacollector ~]$ sudo service iptables start
[root@pacollector ~]$ sudo chkconfig iptables off
[root@pacollector ~]$ sudo chkconfig iptables on
[root@pacollector ~]$ sudo vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
[oracle@pacollector ~]$ echo $ORACLE_SID --查看Oracle实例名
[oracle@pacollector ~]$ ps -ef|grep smon --查看已经启动了的实例名
[oracle@pacollector ~]$ dbca
会出现图形界面配置实例
[oracle@pacollector ~]$ netca
会出现配置Oracle Net Services Configuration的图形界面配置