Oracle的安装部署(必须为root用户)

149 阅读3分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

Oracle****的安装部署根据实际情况非必须安装(docker安装请移至docker标签文章内)

安装****oracle

在root用户下

选择opt目录,然后把安装包上传到该目录下

[root@robot~]#cd /opt
[root@robot opt]#mkdir oracle

1.解压文件

[root@robotopt]# unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
[root@robotopt]# cd Disk1

2.Suse****系统可以忽略此步骤,centos系统需要做以下检查

主机名检查

如果检查结果为localhost或者localhost.localdomain,都需要更改主机名,更改为robot,方法如下:

[root@robot bin]# vim /etc/sysconfig/network

​编辑

重启系统之后再次查看

[root@localhost ~]# reboot -h now
[root@robot ~]# hostname

成功更改

​编辑

修改hosts文件

[root@robot bin]# vim /etc/hosts

​编辑

3.安装文件

执行安装,显示以下内容

[root@robotDisk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracle-xe              ########################################### [100%]
Executing post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

4.添加环境变量

[root@robot bin]#  vim  /etc/profile  注:在文件的末尾添加如上红色字体

# End of /etc/profile

#

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe

export ORACLE_SID=XE

export ORACLE_BASE=/u01/app/oracle

export PATH=$ORACLE_HOME/bin:$PATH

[root@robot bin]#  source /etc/profile

5.配置

输入**/etc/init.d/oracle-xe configure**,显示以下信息

[root@robot bin]# /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press <Enter> to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:8089
注:配置Oracle http端口,输入可用端口号,此处为8089,按回车。
Specify a port that will be used for the database listener [1521]: 11521
注:配置Oracle 监听端口,输入可用端口号,此处为11521,按回车。
Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
注:输入密码,按回车(此处输入密码时不会显示)。
Confirm the password:
注:输入确认密码,按回车(此处输入密码时不会显示)。
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
注:确认开机启动,安装完成。
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

出现以上信息,表明数据库已经成功安装了。

6.启动

[root@robotbin]# cd /u01/app/oracle/product/11.2.0/xe/bin
[root@robotbin]# ./lsnrctl start
[root@robotbin]#./tnslsnr start
[root@robotbin]#netstat -ant | grep 11521

新建oracle数据库

使用工具****登陆到数据库

​编辑

创建表,以及插入数据

​编辑

成功创建表

​编辑

安装包下载地址:点击下载