oracle數據庫安裝筆記

安裝centos,要在安裝時設置網絡爲靜態ip,不支持動態ip。

vi /etc/inittab 
id:5:initdefault:
change id:3:initdefault:
vi /etc/selinux/config
SELINUX=disabled
setup
close system services---sendmail

set dns
vi /etc/resolv.conf
nameserver 查看自己的dns服務器ip
nameserver 10.96.1.19
nameserver 10.176.2.1

下載軟件
wget -c http://

install rlwrap
tar zxvf rlwrap
./configure && make && make install

less rpm
mount /dev/sr0 /mnt/cdro
m

mount 再次查看一下是否掛載成功

cd /etc/yum.repos.d/

mv .repo .repo.bak?保存一個.repo.bak,爲了以後網絡yum方便使用,並且備份

把所有的.repo?全部備份好。但是不改media.repo,因爲後面要使用修改這個文件。

vim media.repo
修改:file:///掛載地址

修改:enable=1

註釋file:///下面兩個地址


#?file///media/cdrom


# file///media/cdrom

註釋有嚴格格式

rpm -qa | grep readline 查看rpm包內是否有readline
yum install readline* 安裝所有readline*的包

最後再次執行./configure && make && make install成功安裝!

which rlwrap 查看安裝路徑

unzip oracle的安裝文件.zip文件

ls -l 查看

在root 根目錄下新建文件夾oracle

開始建組
groupadd oinstall
groupadd dba
建用戶
useradd -g oinstall -G dba -d /oracle/oracle12 oracle
主組oinstall 輔組dba 用戶oracle
設置密碼
passwd oracle
進入oracle文件夾
mv /root/database/ .
粘貼到oracle文件夾內
更改database的權限和組
chown -R oracle:oinstall /oracle
磁盤佈局完成,切換用戶
su - oracle
ls -la 查看.bash_profile
vi .bash_profile
在最後一行增加
ORACLE_SID=walnut
ORACLE_BASE=/oracle
ORACLE_HOME=$ORACLE_BASE/oracle

LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
PATH=$ORACLE_HOME/bin:$PATH

DISPLAY=192.168.25.1:0.0

TNS_ADMIN=$ORACLE_HOME/network/admin

export ORACLE_SID ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH PATH DISPLAY TNS_ADMIN

stty erase ^h

alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"

保存退出

查看一下
env | grep ORA
準備工作完成

安裝必須的rpm包
必須在root用戶下操作check
oracle database preinstallation requirments
checking the software requirements
Configuring Openerating systems for oracle database on linux
operating system requirements for x86-64 linux platforms

必須安裝pdksh-devel包,但是文檔中未提出。

按照文檔中的rpm包查看是否已經安裝好

如果沒有安裝好,就要下載,rpm文件
然後用命令安裝
ls -l *.rpm可以查看有哪些.rpm包
rpm -ivh *.rpm

pdksh-devel

compat-libstdc++-33-3.2.3-71.el7 (i686
compat-libstdc++-33-3.2.3-71.el7 (x86_64)


step1:安裝必需的rpm包

yum install binutils libX11 compat-libcap1 libXau compat-libstdc++-33 libaio gcc libaio-devel gcc-c++ libdmx glibc-devel glibc ksh make libgcc sysstat libstdc++ xorg-x11-utils libstdc++-devel xorg-x11-xauth libXext libXv libXtst libXi libxcb libXt libXmu libXxf86misc libXxf86dga libXxf86vm nfs-utils smartmontools

配置內核參數
Completing Preinstallation Tasks Manually
Changing Kernel Parameter Values
step1:安裝必需的rpm包

yum install binutils libX11 compat-libcap1 libXau compat-libstdc++-33 libaio gcc libaio-devel gcc-c++ libdmx glibc-devel glibc ksh make libgcc sysstat libstdc++ xorg-x11-utils libstdc++-devel xorg-x11-xauth libXext libXv libXtst libXi libxcb libXt libXmu libXxf86misc libXxf86dga libXxf86vm nfs-utils smartmontools

Checking Resource Limits for Oracle Software Installation Users

step3:設置用戶限制

vim /etc/security/limits.d/99-grid-oracle-limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

oracle hard stack 32768

step4:添加用戶

groupadd --gid 54321 oinstall

groupadd --gid 54322 dba

groupadd --gid 54326 oper

groupadd --gid 54327 backupdba

groupadd --gid 54328 dgdba

groupadd --gid 54329 kmdba

useradd --uid 54321 --gid oinstall --groups dba,oper,backupdba,dgdba,kmdba oracle

echo "oracle"|passwd --stdin oracle

step5:設置目錄

mkdir -p /u01/app/12.2.0/grid

chown -R oracle.oinstall /u01

chmod -R 755 /u01

step6:設置環境變量

su - oracle

vim .bash_profile

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1

export ORACLE_SID=orcl

export PATH=$ORACLE_HOME/bin:$PATH; 


確保DISPLAY=192.168.25.1:0.0
env | grep DIS 查看一下是否可以找到對應的ip的windows系統


需求:Unix/Linux下需要圖形輸出結果,往往需要用到Xwin圖形界面。而unix/linux往往都是服務器,在遠端;而我們操作的客戶機往往是windows,通過SecureCRT/Putty連接到unix/Linux服務器上.如何在windows客戶機上實現X11的圖形界面功能呢?

實現步驟如下:
1、首先windows客戶機下載安裝Xming軟件。

請在這裏下載Xming軟件:http://sourceforge.net/projects/xming/files/latest/download
2、配置Xming,確保允許遠端服務器可連接windows客戶機上的Xming。
把遠端unix/Linux服務器的ip加入到xming的信任的ip裏去. 在xming的安裝目錄中找到Xn.hosts (其中n爲你的DISPLAY Number對應的值,如X0.hosts), 在裏面新加一行ip 地址(這個文件中每個ip佔一行) ,需重新啓動Xming生效。

此步驟若不配置,會發生:類似”Xming: client 4 rejected from IP”的Xming log報錯,且無法連接。

3、配置SecureCRT轉發X11(putty類似),在連接unix/Linux服務器的會話選項中配置,見下圖:
回話選項---遠程X11---勾選轉發X11數據包(F)
4、在服務器上配置X11到windows客戶機:

export DISPLAY=192.168.X.X:0.0

192.168.X.X爲你安裝了Xming軟件的客戶機IP。

5、運行需要用到Xwin圖形界面的應用即可,如gnuplot.

實用技巧:在Linux下設置xhost方法步驟

(1)安裝vnc yum -y install vnc 
(2)安裝vncserver依賴包 yum -y install xorg-x11-fonts-misc
(3)安裝vncserver yum -y install tigervnc-server


第一步:用root登陸linux,啓動vnc服務;

vncserver

New ‘localhost:1 (root)’ desktop is localhost:1

Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost:1.log

第二步:根據vnc起來的端口爲1,設置export DISPLAY=localhost:1(1表示vnc在第一個tty上啓動的),vnc的啓動信息見附件1;

export DISPLAY=localhost:1

第三步:執行xhost +,並且提示“access control disabled, clients can connect from any host”才正確。

xhost +


關閉vncserver 
vncserver -kill :n 
查看連接 
vncserver -list

關閉vncserver

重啓服務器init 6

step7:開始安裝

su - oracle

[oracle@oracle12c database]$ ./runInstaller

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 7211 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 1023 MB    Passed

Checking monitor: must be configured to display at least 256 colors

    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,

Continue? (y/n) [n] y

>>> Ignoring required pre-requisite failures. Continuing...

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-08-11_01-14-29AM. Please wait ...

DISPLAY not set. Please set the DISPLAY and try again.

Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:

- For csh:              % setenv DISPLAY 192.168.1.128:0.0

- For sh, ksh and bash:     $ DISPLAY=192.168.1.128:0.0; export DISPLAY

Use the following command to see what shell is being used:

    echo $SHELL

Use the following command to view the current DISPLAY environment variable setting:

    echo $DISPLAY

- Make sure that client users are authorized to connect to the X Server.

To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:

% xhost +

To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':

    % <full path to xclock.. see below>

If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.

Typical path for xclock: /usr/X11R6/bin/xclock

之後嘗試設置了多次$DISPLAY,都不行,如下

DISPLAY=192.168.107.155:0.0;export $DISPLAY

DISPLAY=192.168.107.155:1.0;export $DISPLAY

DISPLAY=192.168.107.155:0.1export $DISPLAY

DISPLAY=:0;export $DISPLAY

DISPLAY=:1;export $DISPLAY

之後我在root的一個窗口執行xclock,發現沒有clock,之後安裝了xorg-x11-apps(yum install xorg-x11-apps),使用root的xclock就可以看到clock了

之後su - oracle還是看不到clock

之後到root窗口echo $DISPLAY發現是:0,所以我在oracle窗口也設置

    DISPLAY=:0;export $DISPLAY

之後就可以正常的圖形化安裝了


參看文檔

https://cloud.tencent.com/info/fccf3d24c14fa4cdb3c5c31ab7a86f6a.html

更改 inventory的目錄爲/u01/oraInventory

prerequisite checks這裏用fix來修復一下

按提示進入root執行腳本,如果有提示,直接按回車。

DBCA建庫

輸入命令:dbca

默認,一直到typical configuration,選擇name爲orc,設置密碼,下面的name爲orclpdb

或者選擇advanced configuration,在deployment type選擇custom database,在database identification選擇orcl和walnut,storage option選擇use following for the database storage attribute,在fast recovery option選擇兩個複選框,在network configuration選擇create下面listener1和1521,在configuration options內的sample schemas選擇add複選框,在management options選擇configure複選框爲5500,在user Credentials 選擇use the same admin,在creation option勾選所有複選框。

log:/oracle/cfgtoollogs/dbca/orcl

global database name:orcl
system identifier:walnut
server parameter file name:/oracle/oracle12/dbs/spfilewalnut.ora
em database express url:https://localhost:5500/em
設置密碼 system Aa1
passwd oracle
sys 可以設置密碼
orapwd file=orapwtest password=P@ssw0rd entries=10

安裝完成

sqlplus /nolog

conn /as sysdba

select * from v$version;

quit

SYS@orcl> select host_name,version from v$instance;

unzip examples.zip
mv examples/ /oracle
cd /oracle
chown -R oracle:oinstall examples/

./runinstall

rm -r databse/ examples/ 刪除安裝文件database和example

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章