在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…

     

如果這文章對你有幫助,請掃左上角微信支付-支付寶,給於打賞,以助博客運營