2017-05-18
操作文档 Oracle 11g (CentOS7.2环境) 静默安装
一、安装操作流程
- 准备工作:检查服务器
- 准备工作:检查yum仓库、安装依赖包
- 准备工作:Oracle系统用户、组、用户密码管理
- 准备工作:Oracle文件、目录、系统权限管理
- 准备工作:配置内核参数及Oracle用户环境变量
- 根据响应文件静默安装Oracle 11g 软件(OUI)
- 根据响应文件静默配置监听(NETCA)
- 根据响应文件静默建库和实例(DBCA)
- EM Web客户端连接Oracle数据库、配置EM企业管理器(EMCA)
- SQLPlus 命令行连接Oracle数据库
- PLSQL Developer 连接Oracle数据库
二、安装组件说明
- Oracle Universal Installer(OUI) 安装数据库软件(RDBMS)
- Oracle Database Configuration Assistant(DBCA) 创建新库、与实例
- Database Upgrade Assistant 数据库升级工具
- Net Configuration Assistant(NETCA) 配置网络、启动监听、注册服务
- Oracle Enterprise Manager Configuration Assistant(EMCA) 配置EM企业管理器、Oracle WEB连接工具、WEB监控
- SQLPlus Oracle命令行连接工具
- rlwrap SQLPlus历史命令的回调功能
- PLSQL Developer Oracle客户端连接工具
三、安装配置命令
runInstaller、dbca、netca、lsnrctl、tnsping、emca、emctl、sqlplus
四、安装核心步骤
核心步骤:OUI → DBCA → NETCA → EMCA → SQLPlus → PLSQL Developer
###################################################################### # # # # # 准备工作:检查服务器 # # # # # ###################################################################### #---------------------------- 检查系统 --------------------------------------------- [root@vpn ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@vpn ~]# uname -r 3.10.0-514.6.2.el7.x86_64 [root@vpn ~]# cat /proc/version Linux version 3.10.0-514.6.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Thu Feb 23 03:04:39 UTC 2017 #---------------------------- 检查CPU --------------------------------------------- [root@vpn ~]# cat /proc/version processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 63 model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz stepping : 2 microcode : 0x1 cpu MHz : 2494.224 cache size : 30720 KB physical id : 0 siblings : 4 core id : 3 cpu cores : 4 apicid : 3 initial apicid : 3 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt bogomips : 4988.44 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management: #---------------------------- 检查内存 --------------------------------------------- [root@vpn ~]# free -g total used free shared buff/cache available Mem: 7 0 6 0 0 7 Swap: 0 0 0 #---------------------------- 检查硬盘 --------------------------------------------- [root@vpn ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/vda1 ext3 40G 1.7G 36G 5% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 328K 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vdb ext4 99G 61M 94G 1% /data tmpfs tmpfs 783M 0 783M 0% /run/user/0 #---------------------------- 检查网络 --------------------------------------------- [root@vpn ~]# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.27.173.7 netmask 255.255.254.0 broadcast 10.27.173.255 ether 00:16:3e:08:ab:e3 txqueuelen 1000 (Ethernet) RX packets 1401283 bytes 120505824 (114.9 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 529282 bytes 37721895 (35.9 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 119.23.129.240 netmask 255.255.252.0 broadcast 119.23.131.255 ether 00:16:3e:08:b4:e0 txqueuelen 1000 (Ethernet) RX packets 114181 bytes 65179292 (62.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 97802 bytes 101311209 (96.6 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 10.8.0.1 netmask 255.255.255.0 destination 10.8.0.1 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC) RX packets 31757 bytes 5626053 (5.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 53682 bytes 48639152 (46.3 MiB) TX errors 0 dropped 280 overruns 0 carrier 0 collisions 0 [root@vpn ~]# ping www.baidu.com PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data. 64 bytes from 220.181.112.244: icmp_seq=1 ttl=51 time=40.5 ms 64 bytes from 220.181.112.244: icmp_seq=2 ttl=51 time=40.5 ms 64 bytes from 220.181.112.244: icmp_seq=3 ttl=51 time=40.6 ms ^C --- www.a.shifen.com ping statistics --- 4 packets transmitted, 3 received, 25% packet loss, time 3004ms rtt min/avg/max/mdev = 40.565/40.588/40.603/0.233 ms #---------------------------- 检查主机名 --------------------------------------------- [root@vpn ~]# hostname vpn [root@vpn ~]# cat /etc/hosts 127.0.0.1 localhost ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 10.27.173.7 vpn ###################################################################### # # # # # 准备工作:检查yum仓库、安装依赖包 # # # # # ###################################################################### #检查yum仓库 [root@vpn ~]# ls -hl /etc/yum.repos.d total 12K drwxr-xr-x 2 root root 4.0K May 17 13:47 backup -r--r--r-- 1 root root 1.3K May 17 13:47 CentOS-Base.repo -r--r--r-- 1 root root 670 May 17 13:47 epel.repo #安装依赖包 yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static glibc glibc-common glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel numactl-devel sysstat unixODBC unixODBC-devel kernel- headers pdksh pcre-devel readline rlwrap ###################################################################### # # # # # 准备工作:Oracle系统用户、组、用户密码管理 # # # # # ###################################################################### #创建用户、组 groupadd oinstall && groupadd dba && useradd -g oinstall -G dba oracle echo "sadfafw" | passwd --stdin oracle && id oracle --系统用户oracle的密码不能太简单,容易被入侵 ###################################################################### # # # # # 准备工作:Oracle文件、目录、系统权限管理 # # # # # ###################################################################### #上传安装包文件 sftp:/root> Uploading linux.x64_11gR2_client.zip to remote:/root/linux.x64_11gR2_client.zip 304 MB, 1.12 MB/sec #创建安装包文件存放目录 mkdir -p /data/u01/software mv linux.x64_11gR2_database_* /data/u01/software/ && cd /data/u01/software #解压安装包文件 unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip #创建目录 mkdir -p /data/u01/app/oracle/product/11.2.0/dbhome_1 mkdir /data/u01/app/oracle/{oradata,inventory,fast_recovery_area} chown -R oracle:oinstall /data/u01/app/oracle chmod -R 775 /data/u01/app/oracle ###################################################################### # # # # # 准备工作:配置内核参数及Oracle用户环境变量 # # # # # ###################################################################### #修改内核参数 vim /etc/sysctl.conf #添加以下内容 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 1073741824 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 = 1048576 #使内核新配置生效 sysctl -p #修改用户限制 vim /etc/security/limits.conf #添加以下内容 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 #修改/etc/pam.d/login文件 vim /etc/pam.d/login #添加以下内容 session required /lib64/security/pam_limits.so session required pam_limits.so #修改/etc/profile文件 vim /etc/profile #添加以下内容 if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi #设置oracle用户环境变量 su - oracle vim .bash_profile #添加以下内容 export ORACLE_BASE=/data/u01/app/oracle export ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export ORACLE_UNQNAME=$ORACLE_SID export PATH=$ORACLE_HOME/bin:$PATH export NLS_LANG=american_america.AL32UTF8 alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' ###################################################################### # # # # # 根据响应文件静默安装Oracle 11g 软件(OUI) # # # # # ###################################################################### #编辑静默安装响应文件 cp -R /data/u01/software/database/response/ . && cd response/ vim db_install.rsp #设置以下内容 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=vpn UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/data/u01/app/oracle/inventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1 ORACLE_BASE=/data/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba DECLINE_SECURITY_UPDATES=true cd /data/u01/software/database/ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq #----------------安装过程中发现阿里云默认系统安装时,没有Swap分区,需要创建文件作为swap分区 [oracle@vpn database]$ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 36326 MB Passed Checking swap space: 0 MB available, 150 MB required. Failed <<<< Some requirement checks failed. You must fulfill these requirements before continuing with the installation, Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2017-05-18_04-16-17PM/installActions2017-05- 18_04-16-17PM.log [oracle@vpn database]$ free -m total used free shared buff/cache available Mem: 7822 106 2102 0 5612 7402 Swap: 0 0 0 #-----------------以下是用文件作为Swap分区的操作步骤 #创建要作为swap分区的文件:增加4GB大小的交换分区 dd if=/dev/zero of=/data/swapfile bs=1M count=4096 #格式化为交换分区文件 mkswap /data/swapfile #启用交换分区文件 swapon /data/swapfile #使系统开机时自启用,在文件/etc/fstab中添加一行 /data/swapfile swap swap defaults 0 0 #----------------以下是重新安装的运行结果 [oracle@vpn database]$ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 36324 MB Passed Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-05-18_04-31-20PM. Please wait ...[oracle@vpn database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base. CAUSE: The Central Inventory is located in the Oracle base. ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory. [WARNING] [INS-32055] The Central Inventory is located in the Oracle base. CAUSE: The Central Inventory is located in the Oracle base. ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory. You can find the log of this install session at: /data/u01/app/oracle/inventory/logs/installActions2017-05-18_04-31-20PM.log [oracle@vpn database]$ ########################################################################## #打开终端,以root身份登录,执行脚本: ctrl +d [root@vpn ~]# sh /data/u01/app/oracle/inventory/orainstRoot.sh Changing permissions of /data/u01/app/oracle/inventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /data/u01/app/oracle/inventory to oinstall. The execution of the script is complete. [root@vpn ~]# sh /data/u01/app/oracle/product/11.2.0/dbhome_1/root.sh Check /data/u01/app/oracle/product/11.2.0/dbhome_1/install/root_vpn_2017-05-18_16-40-51.log for the output of root script ###################################################################### # # # # # 根据响应文件静默配置监听(NETCA) # # # # # ###################################################################### #查看监听响应文件配置信息 [oracle@vpn ~]$ egrep -v "(^#|^$)" /home/oracle/response/netca.rsp [GENERAL] RESPONSEFILE_VERSION="11.2" CREATE_TYPE="CUSTOM" [oracle.net.ca] INSTALLED_COMPONENTS={"server","net8","javavm"} INSTALL_TYPE=""typical"" LISTENER_NUMBER=1 LISTENER_NAMES={"LISTENER"} LISTENER_PROTOCOLS={"TCP;1521"} LISTENER_START=""LISTENER"" NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"} NSN_NUMBER=1 NSN_NAMES={"EXTPROC_CONNECTION_DATA"} NSN_SERVICE={"PLSExtProc"} NSN_PROTOCOLS={"TCP;HOSTNAME;1521"} #以静默方式配置监听 [oracle@vpn oracle]$ netca /silent /responsefile /home/oracle/response/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /home/oracle/response/netca.rsp Done parsing command line arguments. Oracle Net Services Configuration: Profile configuration complete. Oracle Net Listener Startup: Running Listener Control: /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0 [root@vpn ~]# netstat -tnulp | grep 1521 tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 23576/tnslsnr #查看监听状态 [oracle@vpn ~]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-MAY-2017 17:16:05 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 18-MAY-2017 16:42:56 Uptime 0 days 0 hr. 33 min. 9 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /data/u01/app/oracle/diag/tnslsnr/vpn/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vpn)(PORT=1521))) Services Summary... Service "orcl" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... Service "orclXDB" has 1 instance(s). Instance "orcl", status READY, has 1 handler(s) for this service... The command completed successfully #查看监听器配置文件 listener.ora [oracle@vpn ~]$ cat $ORACLE_HOME/network/admin/listener.ora # listener.ora Network Configuration File: /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = vpn)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /data/u01/app/oracle #查看监听服务名配置文件 tnsnames.ora [oracle@vpn ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora # tnsnames.ora Network Configuration File: /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vpn)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) ) ###################################################################### # # # # # 根据响应文件静默建库和实例(DBCA) # # # # # ###################################################################### #配置以静默方式建立新库,和实例 的响应文件 vim /home/oracle/response/dbca.rsp #设置以下参数 GDBNAME = "orcl" SID = "orcl" SYSPASSWORD = "SYS用户密码" SYSTEMPASSWORD = "SYSTEM用户密码" SYSMANPASSWORD = "sysman" DBSNMPPASSWORD = "dbsnmp" DATAFILEDESTINATION =/data/u01/app/oracle/oradata RECOVERYAREADESTINATION=/data/u01/app/oracle/fast_recovery_area CHARACTERSET = "AL32UTF8" TOTALMEMORY = "6144" #查看建库响应文件配置信息 [root@vpn ~]# egrep -v "(^#|^$)" /home/oracle/response/dbca.rsp [GENERAL] RESPONSEFILE_VERSION = "11.2.0" OPERATION_TYPE = "createDatabase" [CREATEDATABASE] GDBNAME = "orcl" SID = "orcl" TEMPLATENAME = "General_Purpose.dbc" SYSPASSWORD = "Xunshi2017" SYSTEMPASSWORD = "Xunshi2017" DATAFILEDESTINATION =/data/u01/app/oracle/oradata RECOVERYAREADESTINATION=/data/u01/app/oracle/fast_recovery_area CHARACTERSET = "AL32UTF8" TOTALMEMORY = "6144" [createTemplateFromDB] SOURCEDB = "myhost:1521:orcl" SYSDBAUSERNAME = "system" TEMPLATENAME = "My Copy TEMPLATE" [createCloneTemplate] SOURCEDB = "orcl" TEMPLATENAME = "My Clone TEMPLATE" [DELETEDATABASE] SOURCEDB = "orcl" [generateScripts] TEMPLATENAME = "New Database" [CONFIGUREDATABASE] SYSMANPASSWORD = "sysman" DBSNMPPASSWORD = "dbsnmp" [ADDINSTANCE] DB_UNIQUE_NAME = "orcl11g.us.oracle.com" NODELIST= SYSDBAUSERNAME = "sys" [DELETEINSTANCE] DB_UNIQUE_NAME = "orcl11g.us.oracle.com" INSTANCENAME = "orcl11g" SYSDBAUSERNAME = "sys" #启用配置,以静默方式建立新库,和实例 [oracle@vpn ~]$ dbca -silent -responseFile /home/oracle/response/dbca.rsp Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/data/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details. #检查实例后台进程 [oracle@vpn ~]$ ps -ef | grep ora_ | grep -v grep oracle 28014 1 0 17:11 ? 00:00:00 ora_pmon_orcl oracle 28016 1 0 17:11 ? 00:00:00 ora_vktm_orcl oracle 28020 1 0 17:11 ? 00:00:00 ora_gen0_orcl oracle 28022 1 0 17:11 ? 00:00:00 ora_diag_orcl oracle 28024 1 0 17:11 ? 00:00:00 ora_dbrm_orcl oracle 28026 1 0 17:11 ? 00:00:00 ora_psp0_orcl oracle 28028 1 0 17:11 ? 00:00:00 ora_dia0_orcl oracle 28030 1 0 17:11 ? 00:00:00 ora_mman_orcl oracle 28032 1 0 17:11 ? 00:00:00 ora_dbw0_orcl oracle 28034 1 0 17:11 ? 00:00:00 ora_lgwr_orcl oracle 28036 1 0 17:11 ? 00:00:00 ora_ckpt_orcl oracle 28038 1 0 17:11 ? 00:00:00 ora_smon_orcl oracle 28040 1 0 17:11 ? 00:00:00 ora_reco_orcl oracle 28042 1 0 17:11 ? 00:00:00 ora_mmon_orcl oracle 28044 1 0 17:11 ? 00:00:00 ora_mmnl_orcl oracle 28046 1 0 17:11 ? 00:00:00 ora_d000_orcl oracle 28048 1 0 17:11 ? 00:00:00 ora_s000_orcl oracle 28068 1 0 17:11 ? 00:00:00 ora_qmnc_orcl oracle 28083 1 0 17:11 ? 00:00:00 ora_cjq0_orcl oracle 28105 1 0 17:11 ? 00:00:00 ora_q000_orcl oracle 28107 1 0 17:11 ? 00:00:00 ora_q001_orcl
###################################################################### # # # # # 配置EM企业管理器(EMCA) # # # # # ###################################################################### #查看ORACLE_UNQNAME环境变量 [oracle@vpn ~]$ env|grep ORACLE_UNQNAME ORACLE_UNQNAME=orcl #查看EM控制台服务的状态 [oracle@vpn ~]$ emctl status dbconsole OC4J Configuration issue. /data/u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_vpn_orcl not found. #删除EM资料库 [oracle@vpn ~]$ emca -repos drop STARTED EMCA at May 18, 2017 5:37:53 PM EM Configuration Assistant, Version 11.2.0.0.2 Production Copyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information: Database SID: orcl Listener port number: 1521 Password for SYS user: Password for SYSMAN user: Do you wish to continue? [yes(Y)/no(N)]: y May 18, 2017 5:38:24 PM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /data/u01/app/oracle/cfgtoollogs/emca/orcl/emca_2017_05_18_17_37_52.log. May 18, 2017 5:38:24 PM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl WARNING: Error initializing SQL connection. SQL operations cannot be performed May 18, 2017 5:38:24 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Dropping the EM repository (this may take a while) ... May 18, 2017 5:39:13 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Repository successfully dropped Enterprise Manager configuration completed successfully FINISHED EMCA at May 18, 2017 5:39:13 PM #创建EM资料库 [oracle@vpn ~]$ emca -repos create STARTED EMCA at May 18, 2017 5:40:00 PM EM Configuration Assistant, Version 11.2.0.0.2 Production Copyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information: Database SID: orcl Listener port number: 1521 Password for SYS user: Password for SYSMAN user: Do you wish to continue? [yes(Y)/no(N)]: y May 18, 2017 5:40:21 PM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /data/u01/app/oracle/cfgtoollogs/emca/orcl/emca_2017_05_18_17_40_00.log. May 18, 2017 5:40:21 PM oracle.sysman.emcp.EMReposConfig createRepository INFO: Creating the EM repository (this may take a while) ... May 18, 2017 5:43:44 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Repository successfully created Enterprise Manager configuration completed successfully FINISHED EMCA at May 18, 2017 5:43:44 PM #配置EM控制台 [oracle@vpn ~]$ emca -config dbcontrol db STARTED EMCA at May 18, 2017 5:44:45 PM EM Configuration Assistant, Version 11.2.0.0.2 Production Copyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information: Database SID: orcl Listener port number: 1521 Listener ORACLE_HOME [ /data/u01/app/oracle/product/11.2.0/dbhome_1 ]: 1521 Password for SYS user: Password for DBSNMP user: Password for SYSMAN user: Email address for notifications (optional): Outgoing Mail (SMTP) server for notifications (optional): ----------------------------------------------------------------- You have specified the following settings Database ORACLE_HOME ................ /data/u01/app/oracle/product/11.2.0/dbhome_1 Local hostname ................ vpn Listener ORACLE_HOME ................ 1521 Listener port number ................ 1521 Database SID ................ orcl Email address for notifications ............... Outgoing Mail (SMTP) server for notifications ............... ----------------------------------------------------------------- Do you wish to continue? [yes(Y)/no(N)]: y May 18, 2017 5:45:43 PM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /data/u01/app/oracle/cfgtoollogs/emca/orcl/emca_2017_05_18_17_44_45.log. May 18, 2017 5:45:47 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository INFO: Uploading configuration data to EM repository (this may take a while) ... May 18, 2017 5:47:18 PM oracle.sysman.emcp.EMReposConfig invoke INFO: Uploaded configuration data successfully May 18, 2017 5:47:18 PM oracle.sysman.emcp.ParamsManager getLocalListener WARNING: Error retrieving listener for vpn May 18, 2017 5:47:19 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib INFO: Software library configured successfully. May 18, 2017 5:47:19 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary INFO: Deploying Provisioning archives ... May 18, 2017 5:48:36 PM oracle.sysman.emcp.util.PlatformInterface executeCommand WARNING: Error executing /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/PARDeploy -action deploy -parDir /data/u01/app/oracle/product/11.2.0/dbhome_1/sysman/prov/paf -force May 18, 2017 5:48:36 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary INFO: Provisioning archives deployment failed. Please deploy it manually. May 18, 2017 5:48:36 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole INFO: Securing Database Control (this may take a while) ... May 18, 2017 5:51:49 PM oracle.sysman.emcp.util.PlatformInterface executeCommand WARNING: Error executing /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey -repos May 18, 2017 5:51:49 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole WARNING: Configuring EM-Key failed. May 18, 2017 5:51:49 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration WARNING: Error securing Database control. May 18, 2017 5:51:49 PM oracle.sysman.emcp.EMDBPostConfig setWarnMsg INFO: Error securing Database Control, Database Control has been brought up in non-secure mode. To secure the Database Control execute the following command(s): 1) Set the environment variable ORACLE_SID to orcl 2) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl stop dbconsole 3) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user > 4) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user > 5) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl start dbconsole To secure Em Key, run /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user > May 18, 2017 5:51:49 PM oracle.sysman.emcp.util.DBControlUtil startOMS INFO: Starting Database Control (this may take a while) ... May 18, 2017 5:51:54 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: Database Control started successfully May 18, 2017 5:51:54 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: >>>>>>>>>>> The Database Control URL is http://vpn:1158/em <<<<<<<<<<< Error securing Database Control, Database Control has been brought up in non-secure mode. To secure the Database Control execute the following command(s): 1) Set the environment variable ORACLE_SID to orcl 2) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl stop dbconsole 3) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user > 4) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user > 5) /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl start dbconsole To secure Em Key, run /data/u01/app/oracle/product/11.2.0/dbhome_1/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user > Provisioning archives deployment failed. Please deploy it manually. # EM企业管理器地址
# 将配置EM控制台时输出的INFO信息中主机名vpn改成外网可以访问的服务器IP地址
#如果服务器是云主机,那么IP为ifconfig中的eth1中的IP;如果服务器是在IDC机房里的,那么需要在防火墙上做端口映射,将该服务器的1158端口映射为外网IP才能访问到。 http://119.23.129.240:1158/em
图一、EM企业管理器登录界面
图二、EM企业管理器主页面
###################################################################### # # # # # SQLPlus 命令行连接Oracle数据库 # # # # # ###################################################################### #登录查看实例状态 [oracle@vpn ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Thu May 18 17:18:51 2017 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select status from v$instance; STATUS ------------ OPEN
###################################################################### # # # # # PLSQL Developer 连接Oracle数据库 # # # # # ###################################################################### #客户端TNS配置文件路径 D:\app\Administrator\product\11.2.0\client_1\network\admin #添加客户端TNS配置 MB_DB_240 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =119.23.129.240)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
图三、PLSQL Developer 登录界面
图四、PLSQL Developer 主界面
###################################################################### # # # # # 根据响应文件静默安装Oracle 11g 客户端 # # # # # ###################################################################### #安装依赖包 yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat #编辑静默安装响应文件 su - oracle cp -R /data/u01/software/client/response/ . && cd response/ #查看客户端静默安装相应文件默认配置 [oracle@vpn response]$ egrep -v "(^#|^$)" client_install.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_clientinstall_response_schema_v11_2_0 ORACLE_HOSTNAME= UNIX_GROUP_NAME= INVENTORY_LOCATION= SELECTED_LANGUAGES= ORACLE_HOME= ORACLE_BASE= oracle.install.client.installType= oracle.install.client.customComponents="oracle.sqlj:11.2.0.1.0","oracle.rdbms.util:11.2.0.1.0","oracle.javavm.client:11.2.0.1.0","oracle.sqlplus:11.2.0.1.0","oracle.dbjava.jdbc:11.2.0.1.0","oracle.ldap.client:11.2.0.1.0","oracle.rdbms.oci:11.2.0.1.0","oracle.precomp:11.2.0.1.0","oracle.xdk:11.2.0.1.0","oracle.network.aso:11.2.0.1.0","oracle.assistants.oemlt:11.2.0.1.0","oracle.oraolap.mgmt:11.2.0.1.0","oracle.network.client:11.2.0.1.0","oracle.network.cman:11.2.0.1.0","oracle.network.listener:11.2.0.1.0","oracle.ordim.client:11.2.0.1.0","oracle.ons:11.2.0.0.0","oracle.odbc:11.2.0.1.0","oracle.has.client:11.2.0.1.0","oracle.dbdev:11.2.0.1.0","oracle.rdbms.scheduler:11.2.0.1.0" oracle.install.client.oramtsPortNumber= oracle.install.client.schedulerAgentHostName= oracle.install.client.schedulerAgentPortNumber= vim client_install.rsp #设置以下内容 ORACLE_HOSTNAME=vpn UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/data/u01/app/oracle/inventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1 ORACLE_BASE=/data/u01/app/oracle oracle.install.client.installType=Administrator cd /data/u01/software/client/ ./runInstaller -silent -responseFile /home/oracle/response/client_install.rsp ###################################################################### # # # # # 安装oracle-instantclient轻量级客户端 # # # # # ###################################################################### #安装依赖包 yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat #上传rpm包 oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm #安装rpm包 rpm -ivh oracle-instantclient11.2-* #设置环境变量 vim /etc/profile export ORACLE_BASE=/data/u01/app/oracle export ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export ORACLE_UNQNAME=$ORACLE_SID export PATH=$ORACLE_HOME/bin:$PATH export NLS_LANG=american_america.AL32UTF8 alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' export TNS_ADMIN=$ORACLE_HOME export LD_LIBRARY_PATH=$ORACLE_HOME/client64/lib:$LD_LIBRARY_PATH export OCI_HEADERS_HOME=/usr/include/oracle/11.2/client64 export OCI_LIBS_HOME=$ORACLE_HOME/client64/lib