oracle 安装学习
oracle 安装学习
安装oracle-rdbms 命令,很多系统参数会自动安装,只需要重新修改oracle账户密码即可。
yum install oracle-rdbms-* -y passwd oracle cat /etc/sysctl.conf cat /etc/security/limits.conf
建立文件夹
mkdir /u01 chown oracle:oinstall /u01 -R /u01/oracle/11g /u01/oracle/12c /usr/grid/12c
处理五: 用户和组
groupadd -g 110 oinstall #必须有的 groupadd -g 111 dba #必须有的 groupadd -g 112 asmadmin groupadd -g 114 asmdba groupadd -g 115 asmoper useradd -u 110 -g oinstall -G dba,asmdba oracle passwd oracle
安装grid组
useradd -u 111 -g oinstall -G dba,asmdba,asmadmin,asmoper grid/12c passwd grid
可以只建立 oracle 一个用户
useradd -g oinstall -G dba oracle
passwd oracle
grid 用户环境变量:
echo " export ORACLE_BASE=/u01/oracle export GRID_HOME=/usr/grid/11g export ORACLE_HOME=$GRID_HOME export ORACLE_SID=+ASM export PATH=$ORACLE_HOME/bin:$PATH " >> .bash_profile
oracle 用户环境变量:
echo " export ORACLE_BASE=/u01/oracle export DB_HOME=/u01/oracle/11g export ORACLE_HOME=$DB_HOME export ORACLE_SID=updb export PATH=$ORACLE_HOME/bin:$PATH " >> .bash_profile
如果只用oracle用户,设置环境变量
echo " export ORACLE_BASE=/u01/oracle export GRID_HOME=/u01/grid/11g export DB_HOME=/u01/oracle/11g alias db=".~oracle/.db" alias asm=".~oracle/.asm" " >> .bash_profile
ntp 配置
ntpdate ntp1.aliyun.com
权限目录
mkdir /u01/oracle/11g -p mdkir /u01/grid/11g -p chown -R grid.oinstall /u01/grid chown -R oracle.oinstall /u01/oracle mkdir /u01/oraInventory setfacl -R -d -m u:oracle:rw /u01/oraInventory setfacl -R -d -m u:grid:rw /u01/oraInventory
数据库安装
1. 安装10.2.0.1 只安装软件
2. 安装10.2.0.5 升级安装
NETCA 配置网络
DBCA 建库
解压缩
[root@data ~]$ mount -o loop /data/10.2.0.5/10.2.0.5/10.2.0.5.iso /data/10.2.0.5/10.2.0.5/aa [oracle@oracle ~]$ zcat 10201_database_linux_x86_64.cpio.gz | cpio -idmv [oracle@oracle ~]$ ls 10201_database_linux_x86_64.cpio.gz database p8202632_10205_Linux-x86-64.zip
[oracle@oracle database]$ ./runInstaller #安装包错
./runInstaller: /home/oracle/database/install/.oui: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
缺少依赖包:
ksh libXtst-devel.x86_64 libXtst-devel.i686 libstdc++-devel.i686 kernel-headers glibc-devel.i686 glibc-devel.x86_64 gnome-icon-theme dmz-cursor-themes sgml-common libaio.i686 libaio.x86_64 libaio-devel.x86_64 libaio-devel.i686 ncurses-devel.x86_64 ncurses-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 compat-gcc-34 compat-gcc-34-c++ libXxf86misc.i686 libXxf86vm.i686 libXt.i686 libXt.x86_64 libXmu.x86_64 libXmu.i686 mpfr cpp xorg-x11-xauth compat-gcc-34-c++ libdaemon avahi avahi-glib shared-mime-info libIDL-devel.i686 libIDL-devel.x86_64 ORBit2-devel.i686 ORBit2-devel.x86_64 GConf2-devel.i686 GConf2-devel.x86_64 gnome-vfs2-devel.i686 gnome-vfs2-devel.x86_64 libbonobo-devel.i686 libbonobo-devel.x86_64 libtool-ltdl.i686 libtool-ltdl.x86_64 unixODBC-devel.i686 unixODBC-devel.x86_64 gtk2-engines.i686 gtk2-engines.x86_64 libmcpp mcpp xorg-x11-server-utils libXv-devel.i686 libXv-devel.x86_64 ConsoleKit-x11 xorg-x11-xinit libXp-devel.i686 libXp-devel.x86_64 libXxf86dga libdmx xorg-x11-utils compat-db43.i686 compat-db43.x86_64 ppl.i686 ppl.x86_64 cloog-ppl.i686 cloog-ppl.x86_64 gcc gcc-c++ compat-libstdc++-33.i686 compat-libstdc++-33.x86_64 compat-db.i686 compat-db.x86_64 gnome-themes system-icon-theme system-gnome-theme readline-devel.i686 readline-devel.x86_64 libgnome-devel.i686 libgnome-devel.x86_64 binutils-devel.i686 binutils-devel.x86_64 elfutils-devel.i686 elfutils-devel.x86_64 numactl-devel.i686 numactl-devel.x86_64 elfutils.i686 elfutils.x86_64 sysstat make zip imake unzip lvm2 lvm2-libs rdate xinetd mutt eject links man libcurl.i686 libdrm.i686 libidn.i686 libssh2.i686 mesa-dri-drivers.i686 mesa-libGL.i686 mesa-libGLU.i686 nspluginwrapper.i686 compat-libcap1 libstdc++-devel cifs-utils
[root@oracle 11]# yum -y install `cat rpm.txt`
[oracle@oracle database]$ ls
doc install response runInstaller stage welcome.html
[oracle@oracle database]$ ./runInstaller
如果运行runInstaller 报错, 这是因为oracle 10g只能安装在linux 4 以下版本,我们只需要把操作系统修改一下 把 /etc/redhat-release 里面的版本信息修改下,修改成4.4 [root@oracle database]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 4.4 (Santiago)
选择所有组件
需要执行2个脚本. root用户执行
/u01/oracle/oraInventor/orainstRoot.sh
/u01/oracle/10g/root.sh
2 升级安装到10.2.0.5
unzip p8202632_10205_Linux-x86-64.zip -d ./10205
进入到目录
/home/oracle/10205/Disk1
运行runInstaller
[oracle@oracle Disk1]$ ls
install patch_note.htm response runInstaller stage
[oracle@oracle Disk1]$ ./runInstaller
再次执行 /u01/oracle/10g/root.sh
设置环境变量
export ORACLE_BASE=/u01/oracle export GRID_HOME=/u01/grid/10g export ORACLE_HOME=/u01/oracle/10g export ORACLE_SID=prod10g export PATH=$ORACLE_HOME/bin:$PATH
三、配置监听
[oracle@oracle ~]$ netca Oracle Net Services Configuration: An unexpected exception has been detected in native code outside the VM. Unexpected Signal : 11 occurred at PC=0xF7679503 Function=index+0x63 Library=/lib/libc.so.6 Current Java thread: at oracle.net.common.NetGetEnv.getDNSDomain(Native Method) at oracle.net.ca.ConfigureProfile.setDefaultProfileParams(Unknown Source) at oracle.net.ca.InitialSetup.setupConfigObjects(Unknown Source) at oracle.net.ca.InitialSetup.<init>(Unknown Source) at oracle.net.ca.NetCA.main(Unknown Source) Dynamic libraries: 08048000-08056000 r-xp 00000000 fc:00 2895414 /u01/oracle/10g/jdk/jre/bin/java 08056000-08059000 rwxp 0000d000 fc:00 2895414 /u01/oracle/10g/jdk/jre/bin/java 08ff1000-09267000 rwxp 00000000 00:00 0 [heap] e7d99000-e7dae000 r-xp 00000000 fc:00 2364642 /lib/libresolv-2.12.so e7dae000-e7daf000 ---p 00015000 fc:00 2364642 /lib/libresolv-2.12.so e7daf000-e7db0000 r-xp 00015000 fc:00 2364642 /lib/libresolv-2.12.so e7db0000-e7db1000 rwxp 00016000 fc:00 2364642 /lib/libresolv-2.12.so e7db3000-e7db8000 r-xp 00000000 fc:00 2364630 /lib/libnss_dns-2.12.so e7db8000-e7db9000 r-xp 00004000 fc:00 2364630 /lib/libnss_dns-2.12.so e7db9000-e7dba000 rwxp 00005000 fc:00 2364630 /lib/libnss_dns-2.12.so e7dd1000-e7dde000 r-xp 00000000 fc:00 2889362 /u01/oracle/10g/lib32/libldapjclnt10.so e7dde000-e7de0000 rwxp 0000c000 fc:00 2889362 /u01/oracle/10g/lib32/libldapjclnt10.so e7de0000-e7fbe000 r-xp 00000000 fc:00 2889277 /u01/oracle/10g/lib32/libnnz10.so e7fbe000-e7fe4000 rwxp 001de000 fc:00 2889277 /u01/oracle/10g/lib32/libnnz10.so e7fe6000-e8d9d000 r-xp 00000000 fc:00 2885875 /u01/oracle/10g/lib32/libclntsh.so.10.1 e8d9d000-e8e00000 rwxp 00db7000 fc:00 2885875 /u01/oracle/10g/lib32/libclntsh.so.10.1
没有在 /etc/hosts 中设置 主机名
[oracle@oracle Desktop]$ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.230.26 oracle
建立一个数据库的静态注册
[oracle@oracle ~] # netmgr
File ---> save network configuration ---- exit
终端执行
关闭监听 [oracle@oracle ~] # lsnrctl stop 打开监听 [oracle@oracle Desktop]$ lsnrctl start LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 07-MAY-2020 15:52:28 Copyright (c) 1991, 2010, Oracle. All rights reserved. Starting /u01/oracle/10g/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 10.2.0.5.0 - Production System parameter file is /u01/oracle/10g/network/admin/listener.ora Log messages written to /u01/oracle/10g/network/log/listener.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1522))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1522))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production Start Date 07-MAY-2020 15:52:28 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/10g/network/admin/listener.ora Listener Log File /u01/oracle/10g/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1522))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0))) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "prod10g" has 1 instance(s). Instance "prod10g", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
四 建立数据库
[oracle@oracle ~]# dbca
10.0.2.4 10.0.2.5 OEM需要打一个补丁,可以选在ok继续, 后续在打补丁。
dba已经建立完成, OEM还不能使用,数据库已经正常了
[oracle@oracle admin]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Thu May 7 16:29:09 2020 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine and Real Application Testing options SQL> select name from v$database; NAME --------- PROD10G
打补丁:
[oracle@oracle ~]$ unzip p8350262_10205_Generic.zip -d ./Generic
[oracle@oracle ~]# cd ./Generic/8350262/
[oracle@oracle 8350262]$ emctl stop dbconsole [oracle@oracle 8350262]$ #/u01/oracle/10g/OPatch/opatch apply
删除重新配置
[oracle@oracle 8350262]$ emca -deconfig dbcontrol db -repos drop STARTED EMCA at May 7, 2020 4:41:14 PM EM Configuration Assistant, Version 10.2.0.5.0 Production Copyright (c) 2003, 2009, Oracle. All rights reserved. Enter the following information: Database SID: prod10g Listener port number: 1522 Password for SYS user: Password for SYSMAN user: Password for SYSMAN user: ---------------------------------------------------------------------- WARNING : While repository is dropped the database will be put in quiesce mode. ---------------------------------------------------------------------- Do you wish to continue? [yes(Y)/no(N)]: y May 7, 2020 4:42:44 PM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/oracle/10g/cfgtoollogs/emca/prod10g/emca_2020-05-07_04-41-14-PM.log. May 7, 2020 4:42:45 PM oracle.sysman.emcp.util.DBControlUtil stopOMS INFO: Stopping Database Control (this may take a while) ... May 7, 2020 4:42:51 PM oracle.sysman.emcp.util.PlatformInterface executeCommand WARNING: Error executing /u01/oracle/10g/bin/emctl stop dbconsole May 7, 2020 4:42:51 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Dropping the EM repository (this may take a while) ... May 7, 2020 4:42:51 PM oracle.sysman.emcp.EMReposConfig dropRepository INFO: Dropping the EM repository (this may take a while) ...
如果不知道 sys 用户密码,可以通过sqlplus 登录直接修改
sqlplus / as sysdba alter user sys identified by 123456;
创建emca
[oracle@oracle~]# emca -config dbcontrol db -repos create
oracle11G 安装
1. 安装grid
[oracle@oracle~]# unzip p10404530_112030_Linux-x86-64_3of7.zip
2 运行grid runInstaller
[oracle@oracle~]# cd grid
[oracle@oracle~] # ./runInstaller
设置环境变量
export ORACLE_BASE=/u01/oracle export ORACLE_HOME=/u01/grid/11g export PATH=$ORACLE_HOME/bin:$PATH
4. 新建监听
端口使用1523。
5. 安装database 产品。
unzip /data/11.2.0.3/11/p10404530_112030_Linux-x86-64_1of7.zip ; unzip /data/11.2.0.3/11/p10404530_112030_Linux-x86-64_2of7.zip
6.进入目录运行 runInstaller
cd database
./runInstaller