<menu id="ycqsw"></menu><nav id="ycqsw"><code id="ycqsw"></code></nav>
<dd id="ycqsw"><menu id="ycqsw"></menu></dd>
  • <nav id="ycqsw"></nav>
    <menu id="ycqsw"><strong id="ycqsw"></strong></menu>
    <xmp id="ycqsw"><nav id="ycqsw"></nav>
  • oracle卸載步驟教程(oracle徹底卸載并重裝)


    寫在前面

    之前寫過一篇在CentOS 7/8上安裝Oracle的文章,按照我寫的文章安裝成功了,但是卸載Oracle時出現了問題。今天,我就整理一篇手動安裝和卸載Oracle的文章吧。全文為實戰型內容,全程干貨。

    如果文章對你有所幫助,請不要吝惜你的點贊、在看、留言和轉發,你的支持是我持續創作的最大動力!

    環境準備

    1.CentOS7 / CentOS8 64位最小化安裝的虛擬機環境(這里的安裝步驟,我就直接省略了,大家自行安裝虛擬機環境)

    2.Oracle 11gR2 64位 Linux版安裝包(關注【冰河技術】微信公眾號,回復“oracle”關鍵字即可獲取Oracle數據庫安裝包下載鏈接)。

    linux.x64_11gR2_database_1of2.zip

    linux.x64_11gR2_database_2of2.zip

    安裝過程

    1.關閉防火墻

    操作用戶:root

    systemctl stop firewalld.service
    systemctl disable firewalld.service

    2.安裝依賴包

    操作用戶為:root。

    執行如下命令安裝依賴包。

    yum install -y automake autotools-dev binutils bzip2 elfutils expat 
    gawk gcc gcc-multilib g++-multilib lib32ncurses5 lib32z1 
    ksh less lib32z1 libaio1 libaio-dev libc6-dev libc6-dev-i386 
    libc6-i386 libelf-dev libltdl-dev libodbcinstq4-1 libodbcinstq4-1:i386 
    libpth-dev libpthread-stubs0-dev libstdc++5 make openssh-server rlwrap 
    rpm sysstat unixodbc unixodbc-dev unzip x11-utils zlibc unzip cifs-utils 
    libXext.x86_64  glibc.i686

    3.創建oracle用戶

    操作用戶為:root

    groupadd -g 502 oinstall
    groupadd -g 503 dba
    groupadd -g 504 oper
    groupadd -g 505 asmadmin
    useradd -u 502 -g oinstall -G oinstall,dba,asmadmin,oper -s /bin/bash -m oracle
    passwd oracle

    上述命令執行完畢后,為oracle用戶設置密碼,例如,我這里設置的密碼為oracle

    4.解壓Oracle數據庫安裝包

    操作用戶:oracle操作目錄:/home/oracle

    將Oracle 11gR2安裝文件上傳(可以使用sftp上傳)到該操作目錄下面,然后順序解壓安裝文件到該目錄。

    unzip linux.x64_11gR2_database_1of2.zip
    unzip linux.x64_11gR2_database_2of2.zip

    5.修改操作系統配置

    操作用戶:root操作文件:/etc/security/limits.conf

    vim /etc/security/limits.conf

    在文件的末尾添加如下配置項。

    oracle          soft      nproc   2047
    oracle          hard      nproc   16384
    oracle          soft      nofile  1024
    oracle          hard      nofile  65536
    oracle          soft      stack   10240

    6.創建Oracle安裝目錄

    操作用戶:oracle

    mkdir ~/tools/oracle11g

    7.修改環境變量

    操作用戶:oracle操作目錄:/home/oracle

    vim ~/.bash_profile

    在文件末尾添加如下配置項

    export ORACLE_BASE=/home/oracle/tools/oracle11g
    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
    export ORACLE_SID=orcl
    export ORACLE_UNQNAME=orcl
    export NLS_LANG=.AL32UTF8
    export PATH=${PATH}:${ORACLE_HOME}/bin/:$ORACLE_HOME/lib64

    使得環境變量生效。

    source ~/.bash_profile

    8.修改Oracle配置文件

    操作用戶:oracle操作目錄:/home/oracle

    復制文件模板

    cp /home/oracle/database/response/db_install.rsp .

    注意:復制命令的最后一個 . 不能省略,表示將db_install.rsp文件從
    /home/oracle/database/response目錄拷貝到當前目錄。

    對db_install.rsp文件進行編輯。

    vim db_install.rsp

    需要修改的配置項如下所示,這里,我將修改后的配置項列舉出來。

    oracle.install.option=INSTALL_DB_AND_CONFIG
    ORACLE_HOSTNAME=localhost #實際上可以修改成你自己的主機名或者域名(IP)
    UNIX_GROUP_NAME=oinstall
    INVENTORY_LOCATION=/home/oracle/tools/oraInventory
    SELECTED_LANGUAGES=en,zh_CN
    ORACLE_HOME=/home/oracle/tools/oracle11g/product/11.2.0/dbhome_1
    ORACLE_BASE=/home/oracle/tools/oracle11g
    oracle.install.db.InstallEdition=EE
    oracle.install.db.DBA_GROUP=dba
    oracle.install.db.OPER_GROUP=oper
    oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
    oracle.install.db.config.starterdb.globalDBName=orcl
    oracle.install.db.config.starterdb.SID=orcl
    oracle.install.db.config.starterdb.characterSet=AL32UTF8
    oracle.install.db.config.starterdb.memoryOption=true
    oracle.install.db.config.starterdb.memoryLimit=1024
    oracle.install.db.config.starterdb.installExampleSchemas=false
    oracle.install.db.config.starterdb.password.ALL=Oracle#123456
    oracle.install.db.config.starterdb.control=DB_CONTROL
    oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
    oracle.install.db.config.starterdb.dbcontrol.emailAddress=test@qq.com #可以填寫你自己的郵箱地址
    oracle.install.db.config.starterdb.automatedBackup.enable=false
    oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
    oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/tools/oracle11g/oradata
    oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/home/oracle/tools/oracle11g/fast_recovery_area
    oracle.install.db.config.starterdb.automatedBackup.enable=false
    DECLINE_SECURITY_UPDATES=true

    9.靜默安裝Oracle 11gR2

    操作用戶:oracle操作目錄:/home/oracle/database

    ./runInstaller -silent -ignoreSysPrereqs -responseFile /home/oracle/db_install.rsp

    接下來,就是默默的等待Oracle自行安裝了,等待一段時間后,如果輸出如下信息,則表明Oracle數據庫已經安裝成功。

    The following configuration scripts need to be executed as the "root" user.
    #!/bin/sh
    #Root scripts to run
    
    /home/oracle/tools/oraInventory/orainstRoot.sh
    /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/root.sh
    To execute the configuration scripts:
    
            1. Open a terminal window
             2. Log in as "root"
             3. Run the scripts
             4. Return to this window and hit "Enter" key to continue
    
    Successfully Setup Software.

    10.安裝完成

    操作用戶:root

    根據上一步完成信息提示,執行以下兩行命令,具體位置需要根據你的安裝位置決定:

    /home/oracle/tools/oraInventory/orainstRoot.sh
    /home/oracle/tools/oracle11g/product/11.2.0/dbhome_1/root.sh

    11.創建連接用戶

    操作用戶:oracle

    sqlplus /nolog
    conn /as sysdba
    startup

    接下來,執行如下命令。

    alter user system identified by system;
    alter user sys identified by sys;

    創建連接用戶。

    create user SYNC identified by SYNC;
    grant connect,resource,dba to SYNC;

    驗證安裝結果

    1.啟動數據庫

    啟動已經安裝的數據庫orcl。

    操作用戶oracle

    sqlplus /nolog

    使用dba權限連接Oralce

    connect / as sysdba

    啟動數據庫

    startup

    確認啟動結果:

    ORACLE instance started.
    
    Total System Global Area  534462464 bytes
    Fixed Size                  2215064 bytes
    Variable Size            373293928 bytes
    Database Buffers          150994944 bytes
    Redo Buffers                7958528 bytes
    Database mounted.
    Database opened.

    2.驗證數據庫

    這里,我們使用Navicat連接Oracle數據庫,如下所示。

    「Oracle」手動安裝和卸載Oracle,這是最全的一篇了

    這里,輸入的用戶名為SYNC,密碼為SYNC。

    接下來,點擊“連接測試”,如下所示。

    「Oracle」手動安裝和卸載Oracle,這是最全的一篇了

    可以看到,Oracle數據庫連接成功。

    手動卸載Oracle

    1.停止監聽

    [oracle@binghe101 ~]$ lsnrctl stop
    [oracle@binghe101 ~]$ lsnrctl status

    2.停止數據庫

    [oracle@binghe101 ~]$ sqlplus / as sysdba
    SQL> shutdown immediate

    3.刪除oracle的inventory 目錄

    [root@binghe101 app]# rm -rf /home/oracle/tools/oraInventory/

    4.刪除Oracle的base目錄下所有的目錄

    [root@binghe101 oracle]# rm -rf /home/oracle/tools/oracle11g/*

    5.刪除臨時目錄/tmp

    [root@binghe101 tmp]# rm -rf /tmp/*

    6.刪除Oracle的配置文件

    [root@binghe101 tmp]# rm -f /etc/ora*

    7.刪除oracle產生命令

    [root@binghe101 tmp]# rm -f /usr/local/bin/*

    8.其他的文件

    [root@binghe101 .oracle]# rm -rf /usr/tmp/.oracle/

    9.刪除用戶和組

    [root@binghe101 tmp]# userdel -r oracle
    [root@binghe101 tmp]# groupdel oper
    [root@binghe101 tmp]# groupdel dba    
    [root@binghe101 tmp]# groupdel oinstall
    [root@binghe101 tmp]# groupdel asmadmin

    10.撤銷oracle的資源限制文件

    [root@binghe101 tmp]# vi /etc/security/limits.conf

    11.內核參數

    [root@binghe101 tmp]# vi /etc/sysctl.conf 
    [root@binghe101 tmp]# sysctl -p

    12.刪除oracle base

    [root@binghe101 ~]# rm -rf /home/oracle/tools/oracle11g

    重磅福利

    關注「 冰河技術 」微信公眾號,后臺回復 “設計模式” 關鍵字領取《深入淺出Java 23種設計模式》PDF文檔?;貜汀?strong>Java8”關鍵字領取《Java8新特性教程》PDF文檔。回復“限流”關鍵字獲取《億級流量下的分布式限流解決方案》PDF文檔,三本PDF均是由冰河原創并整理的超硬核教程,面試必備??!

    好了,今天就聊到這兒吧!別忘了點個贊,給個在看和轉發,讓更多的人看到,一起學習,一起進步?。?/strong>

    版權聲明:本文內容由互聯網用戶自發貢獻,該文觀點僅代表作者本人。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如發現本站有涉嫌抄襲侵權/違法違規的內容, 請發送郵件至 舉報,一經查實,本站將立刻刪除。

    發表評論

    登錄后才能評論
    国产精品区一区二区免费