在Redhat 7.2上安装Oracle 12c1

Redhat 7.2上安装Oracle 12c

环境:
OS:
带有图形界面的Red Hat Enterprise Linux Server release 7.2 (Maipo)
Oracle:12c Enterprise Edition Release 12.2.0.1.0
主机名:node01

步骤:

1. 建立用户和组

[root@node01 ~]# groupadd oinstall
[root@node01 ~]# groupadd dba
[root@node01 ~]# groupadd oper
[root@node01 ~]# useradd -g oinstall -G dba,oper oracle
[root@node01 ~]# passwd oracle

2. 修改/etc/hosts

增加以下内容, node01hostname
127.0.0.1 node01

3. 安装Oracle

切换到oracle用户(这里要进入oracle用户的图形界面),解压安装包,并运行runInstaller程序
[oracle@node01 ~]$ unzip linuxx64_12201_database.zip
[oracle@node01 ~]$ cd database/
[oracle@node01 database]$ ls
install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[oracle@node01 database]$ export DISPLAY=:0.0
[oracle@node01 database]$ xhost +
access control disabled, clients can connect from any host
[oracle@node01 database]$ ./runInstaller 
Starting Oracle Universal Installer…

Checking Temp space: must be greater than 500 MB.   Actual 46538 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 5887 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-02-22_09-59-51PM. Please wait …[oracle@node01 database]$

之后自动进入图形界面:

运行到这一步时,有很多要求不符合,可以尝试点击Fix & Check Again,会出现如下界面,需要开一个新的终端,使用root用户执行脚本:


执行完成之后,有一些不符要求的地方已经被修复,剩余的直接勾选Ignore All即可:

上面这一步,在运行到Execute Root Scripts时,会出现如下界面,只需要使用root用户执行里面提到的两个脚本即可:


另个,如果遇到如下的报错,直接关掉,再点击Retry就能过去:

4. 修改环境变量

修改home目录下的.bash_profile文件,增加以下内容
export ORACLE_HOME=/home/oracle/app/oracle/product/12.2.0/dbhome_1
export ORACLE_SID=orcl
export LD_LIBRARY_PATY=/usr/lib:$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH

并使之立即生效
[oracle@node01 ~]$ source .bash_profile 

5. 测试oracle

[oracle@node01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Feb 22 22:45:40 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production

SQL> startup
ORA-01081: cannot start already-running ORACLE – shut it down first
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area 1845493760 bytes
Fixed Size     8793976 bytes
Variable Size   570425480 bytes
Database Buffers 1258291200 bytes
Redo Buffers     7983104 bytes
Database mounted.
Database opened.
SQL> select name from v$database;

NAME
———
ORCL

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
——————————
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS

SQL> create table t1(id int, name char(20));

Table created.

SQL> insert into t1 values(1,’miao’);

1 row created.

SQL> insert into t1 values(2,’qing’);

1 row created.

SQL> select * from t1;

ID NAME
———- ——————–
1 miao
2 qing

SQL> shutdown immediate 
ORA-01097: cannot shutdown while in a transaction – commit or rollback first
SQL> commit;

Commit complete.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production
[oracle@node01 ~]$

6. 配置监听

可以参考链接:

以下文章点击率最高

Loading…


发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注