05 Linux快速安装 Oracle11g
本安装适合Linux桌面操作系统
某业务系统最近上线,需要搭建一套Oracle11g数据库环境,用于前期测试。
要求:
操作系统:Oracle Linx 7.6 x86_64
数据库版本:Oracle11g版本
创建数据库:itpxdb
字符集:ZHS16GBK
数据块大小:8k
可以远程连接,并提供给软件开发人员使用
Oracle11g安装过程
配置hosts
echo "192.168.1.51 lewen51">> /etc/hosts
#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
#创建用户,组,目录,权限
gropadd dba
seradd oracle
passwd oracle
mkdir -p /oracle/app/oracle
chown -R oracle:dba /oracle
chmod -R 775 /oracle
配置ym软件安装所需包
mkdir /mnt/linx
mont /dev/cdrom /mnt/linx
cd /etc/ym.repos.d
mkdir bk
mv *.repo bk/
echo "[EL]" >> /etc/ym.repos.d/itpx.repo
echo "name =Linx 7.x DVD" >> /etc/ym.repos.d/itpx.repo
echo "baserl=file:///mnt/linx" >> /etc/ym.repos.d/itpx.repo
echo "gpgcheck=0" >> /etc/ym.repos.d/itpx.repo
echo "enabled=1" >> /etc/ym.repos.d/itpx.repo
cat /etc/ym.repos.d/itpx.repo
安装:oracle所需软件包安装.txt
yum -y install autoconf yum -y install automake yum -y install binutils yum -y install binutils-devel yum -y install bison yum -y install cpp yum -y install dos2unix yum -y install ftp yum -y install gcc yum -y install gcc-c++ yum -y install lrzsz yum -y install python-devel yum -y install compat-db* yum -y install compat-gcc-34 yum -y install compat-gcc-34-c++ yum -y install compat-libcap1 yum -y install compat-libstdc++-33 yum -y install compat-libstdc++-33.i686 yum -y install glibc-* yum -y install glibc-*.i686 yum -y install libXpm-*.i686 yum -y install libXp.so.6 yum -y install libXt.so.6 yum -y install libXtst.so.6 yum -y install libXext yum -y install libXext.i686 yum -y install libXtst yum -y install libXtst.i686 yum -y install libX11 yum -y install libX11.i686 yum -y install libXau yum -y install libXau.i686 yum -y install libxcb yum -y install libxcb.i686 yum -y install libXi yum -y install libXi.i686 yum -y install libXtst yum -y install libstdc++-docs yum -y install libgcc_s.so.1 yum -y install libstdc++.i686 yum -y install libstdc++-devel yum -y install libstdc++-devel.i686 yum -y install libaio yum -y install libaio.i686 yum -y install libaio-devel yum -y install libaio-devel.i686 yum -y install ksh yum -y install libXp yum -y install libaio-devel yum -y install numactl yum -y install numactl-devel yum -y install make -y yum -y install sysstat -y yum -y install unixODBC yum -y install unixODBC-devel yum -y install elfutils-libelf-devel yum -y install redhat-lsb-core
需要单独安装的包
配置环境变量
s - oracle
echo "export LANG=en_S" >> ~/.bash_profile
echo "export ORACLE_BASE=/oracle/app/oracle" >> ~/.bash_profile
echo "export ORACLE_HOME=/oracle/app/oracle/prodct/11.2.0/db_1" >> ~/.bash_profile
echo "export ORACLE_NQNAME=itpxdb" >> ~/.bash_profile
echo "export ORACLE_SID=itpxdb" >> ~/.bash_profile
echo "NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG" >> ~/.bash_profile
echo "export PATH=$PATH:/oracle/app/oracle/prodct/11.2.0/db_1/bin" >> ~/.bash_profile
sorce ~/.bash_profile
解压安装包
s - oracle
cd /oracle
nzip /mnt/hgfs/soft/linx.x64_11gR2_database_1of2.zip
nzip /mnt/hgfs/soft/linx.x64_11gR2_database_2of2.zip
cd database
./rnInstaller -jreLoc /etc/alternatives/jre_1.8.0
出现报错 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数据库关闭
sqlpls "/as sysdba"
shtdown immediate;
exit;
lsnrctl stop
Ø Oracle数据库启动
sqlpls "/as sysdba"
startp;
exit;
lsnrctl start
数据库操作
Ø 日志路径
select * from v$diag_info;
Ø Oracle数据库登录
sqlpls "/as sysdba"
Ø Oracle表空间创建
create tablespace lewen datafile '/oracle/app/oracle/oradata/itpxdb/lewen01.dbf' size 10m;
Ø Oracle用户创建
create ser lewen identified by lewen defalt tablespace lewen;
grant dba to lewen;
Ø Oracle表创建
conn lewen/lewen;
create table test1(id nmber(12) primary key, name varchar(20)) ;
Ø Oracle数据插入
insert into test1 vales(1,'lewen01');
insert into test1 vales(2,'lewen02');
commit;
Ø Oracle数据查询
select * from test1;