重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Oracle安装之简单篇
为张家口等地区用户提供了全套网页设计制作服务,及张家口网站建设行业解决方案。主营业务为网站建设、成都做网站、张家口网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!安装准备包
linuxredhat5.8操作系统
oracle11g(以下是包名)
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
安装准备
配置IP,hosts,主机名。
备注hosts文件一定要与主机名对应。(如下)
127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.66.249 dbserver.cjl.com配置oracle环境脚本
#!/bin/bash #查看内存大小 echo "Mem Check:swap >2G,MEM >2G" grep -i memtotal /proc/meminfo grep -i swaptotal /proc/meminfo #配置yum本地源 cat <解压Oracle11g的包到oracle用户的home目录
unzip -d /home/oracle linux.x64_11gR2_database_1of2.zip && unzip -d /home/oraclelinux.x64_11gR2_database_2of2.zip允许用户oracle从本机访问
[root@dbserver ~]# xhost + access control disabled, clients can connect from any host切换用户并进入解压目录运行安装
[root@dbserver ~]# su - oracle [oracle@dbserver ~]$ ls database [oracle@dbserver ~]$ cd database/ [oracle@dbserver database]$ ./runInstaller运行root用户执行提示脚本
[root@dbserver ~]# /opt/oracle/oraInventory/orainstRoot.sh 更改权限/opt/oracle/oraInventory. 添加组的读取和写入权限。 删除全局的读取, 写入和执行权限。 更改组名/opt/oracle/oraInventory 到 oinstall. 脚本的执行已完成。 [root@dbserver ~]# /opt/oracle/product/11.2/db_1/root.sh Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /opt/oracle/product/11.2/db_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.sh script. Now product-specific root actions will be performed. Finished product-specific root actions. [root@dbserver ~]#访问以上地址测试https://dbserver.cjl.com:1158/em/
oracle用户访问测试
[oracle@dbserver database]$ sqlplus sys as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 18 05:28:47 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Enter password: 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> show user; USER is "SYS" SQL>图形界面添加数据库
如果重新启动还需web访问可用以下命令重新获取网址
[oracle@dbserver ~]$ emctl start dbconsole Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved. https://dbserver.cjl.com:1158/em/console/aboutApplication Starting Oracle Enterprise Manager 11g Database Control ........ started. ------------------------------------------------------------------ Logs are generated in directory /opt/oracle/product/11.2/db_1/dbserver.cjl.com_orcl/sysman/log如果发现不能使用dbca命令时试试它
[oracle@dbserver ~]$ /opt/oracle/product/11.2/db_1/bin/dbca Xlib: connection to ":0.0" refused by server Xlib: No protocol specified [root@dbserver ~]# xhost + access control disabled, clients can connect from any host启动数据库先启动监听
[oracle@dbserver ~]$ lsnrctl LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-SEP-2015 05:07:44 Copyright (c) 1991, 2009, Oracle. All rights reserved. Welcome to LSNRCTL, type "help" for information. LSNRCTL> start Starting /opt/oracle/product/11.2/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /opt/oracle/product/11.2/db_1/network/admin/listener.ora Log messages written to /opt/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.cjl.com)(PORT=1521))) 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-SEP-2015 05:07:50 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /opt/oracle/product/11.2/db_1/network/admin/listener.ora Listener Log File /opt/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.cjl.com)(PORT=1521))) The listener supports no services The command completed successfully LSNRCTL> quit [oracle@dbserver ~]$ sqlplus sys as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 18 05:08:12 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Enter password: Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 839282688 bytes Fixed Size 2217992 bytes Variable Size 541067256 bytes Database Buffers 289406976 bytes Redo Buffers 6590464 bytes Database mounted. Database opened. SQL> show user; USER is "SYS" SQL> alter database open; alter database open * ERROR at line 1: ORA-01531: a database already open by the instance SQL> quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options关闭数据库
shutdown immediate
shutdown abort (上一条关闭不能执行,则执行这条强制关机)
关闭监听
lsnrctl stop
本文如出现错误请留言!
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。