Linux快速安装Oracle11g
配置hosts
echo “192.168.1.51 youwei1”>> /etc/hosts
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
创建用户,组,目录,权限
groupadd dba
useradd oracle
passwd oracle
mkdir -p /oracle/app/oracle
chown -R oracle:dba /oracle
chmod -R 775 /oracle
安装:oracle所需软件包安装.txt
配置yum软件安装所需包
mkdir /mnt/linux
mount /dev/cdrom /mnt/linux
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/
echo “[EL]” >> /etc/yum.repos.d/itpux.repo
echo “name =Linux 7.x DVD” >> /etc/yum.repos.d/itpux.repo
echo “baseurl=file:///mnt/linux” >> /etc/yum.repos.d/itpux.repo
echo “gpgcheck=0” >> /etc/yum.repos.d/itpux.repo
echo “enabled=1” >> /etc/yum.repos.d/itpux.repo
cat /etc/yum.repos.d/itpux.repo
另需安装:rpm -ivh compat-libstdc-33-3.2.3-72.el7.x86_64.rpm
配置环境变量
su – oracle
echo export LANG=en_US >> ~/.bash_profile
echo export ORACLE_BASE=/oracle/app/oracle >> ~/.bash_profile
echo export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1 >> ~/.bash_profile
echo export ORACLE_UNQNAME=itpuxdb >> ~/.bash_profile
echo export ORACLE_SID=itpuxdb >> ~/.bash_profile
echo export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK >> ~/.bash_profile
echo export PATH=$PATH:/oracle/app/oracle/product/11.2.0/db_1/bin >> ~/.bash_profile
source ~/.bash_profile
解压安装包
在系统退出当前ROOT用户,切换至ORACLE用户
cd /oracle
unzip /mnt/hgfs/soft/linux.x64_11gR2_database_1of2.zip
unzip /mnt/hgfs/soft/linux.x64_11gR2_database_2of2.zip
cd database
./runInstaller -jreLoc /etc/alternatives/jre_1.8.0
安装过程提示有包Failed
选择Fix & Check Again
桌面打开一个终端,切换至root
运行/tmp/CVU….这个命令
回到图形界面,再点OK
出现报错 Error in invoking target ‘agent nmhs’ of makefile
建议修改前备份原始文件
[oracle@ ~]$ cd $ORACLE_HOME/sysman/lib
[oracle@ lib]$ cp ins_emagent.mk ins_emagent.mk.bak
[oracle@ lib]$ vi ins_emagent.mk
进入vi编辑器后 命令模式输入/NMECTL 进行查找,快速定位要修改的行
在后面追加参数-lnnz11
$(SYSMANBIN)emdctl:
$(MK_EMAGENT_NMECTL) -lnnz11
保存退出后Retry
Oracle数据库关闭
sqlplus “/as sysdba”
shutdown immediate;
exit;
lsnrctl stop
Oracle数据库启动
sqlplus “/as sysdba”
startup;
exit;
lsnrctl start
日志路径
select * from v$diag_info;
Oracle数据库登录
sqlplus “/as sysdba”
Oracle表空间创建
create tablespace fgedu datafile’/oracle/app/oracle/oradata/itpuxdb/fgedu01.dbf’ size 10m
Oracle用户创建
create user fgedu identified by fgedu default tablespace fgedu;
grant dba to fgedu;
Oracle表创建
conn fgedu/fgedu;
create table itpuxt1(id number(12) primary key, name varchar(20)) ;
Oracle数据插入
insert into itpuxt1 values(1,’fgedu01′);
insert into itpuxt1 values(2,’fgedu02′);
commit;
Oracle数据查询
select * from itpuxt1;