重启和卸载linux上部署的oracle数据库

  1. 重启数据库

    在oracle用户下,跳转到配置文件所在的文件目录,执行配置文件

    [root@iZuf62q9sqpx7kwg0m00tiZ /]# su - oracle
    Last login: Mon Jun 10 14:26:34 CST 2019 on pts/3
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ cd /home/oracle
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ ll -a
    total 68
    drwxr-xr-x  10 oracle oinstall 4096 Jun 10 14:29 .
    drwxr-xr-x.  5 root   root     4096 Jun 10 13:24 ..
    drwxr-xr-x   4 oracle oinstall 4096 Jun 10 14:05 app
    -rwxr-xr-x   1 oracle oinstall  602 Jun 10 12:01 .bash_history
    -rwxr-xr-x   1 oracle oinstall   18 Oct 31  2018 .bash_logout
    -rwxr-xr-x   1 oracle oinstall  451 Jun  3 16:23 .bash_profile
    -rwxr-xr-x   1 oracle oinstall  231 Oct 31  2018 .bashrc
    drwxr-xr-x  12 oracle oinstall 4096 Jun 10 12:01 .cache
    drwxr-xr-x  11 oracle oinstall 4096 Jun 10 12:01 .config
    drwxr-xr-x   3 oracle oinstall 4096 Jun 10 12:00 .dbus
    drwxr-xr-x   2 oracle oinstall 4096 Jun 10 14:05 Desktop
    -rwxr-xr-x   1 oracle oinstall   16 Jun 10 12:00 .esd_auth
    -rwxr-xr-x   1 oracle oinstall  310 Jun 10 12:00 .ICEauthority
    drwxr-xr-x   3 oracle oinstall 4096 Jun 10 12:00 .local
    drwxr-x---   3 oracle oinstall 4096 Jun 10 14:29 oradiag_oracle
    drwxr-xr-x   2 oracle oinstall 4096 Jun  3 15:53 oraInventory
    -rwxr-xr-x   1 oracle oinstall  480 Jun 10 12:00 .xsession-errors
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ source ./.bash_profile 
    **检查配置文件是否生效**
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ env | grep ORA
    ORACLE_OWNER=oracle
    ORACLE_SID=ORCL
    ORACLE_BASE=/home/oracle/app/oracle
    ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
    

    用sqlplus登录数据库,进行启停数据库服务

    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ sqlplus /nolog
    
    SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 10 15:39:14 2019
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    SQL> connect / as sysdba
    Connected.
    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 3273641984 bytes
    Fixed Size		    2217792 bytes
    Variable Size		 1811941568 bytes
    Database Buffers	 1442840576 bytes
    Redo Buffers		   16642048 bytes
    Database mounted.
    Database opened.
    SQL> 
    

    用exit退出sqlplus交互命令行,查看监听状态启停监听

    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ lsnrctl status
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-JUN-2019 15:48:08
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=iZuf62q9sqpx7kwg0m00tiZ)(PORT=1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date                10-JUN-2019 14:24:38
    Uptime                    0 days 1 hr. 23 min. 29 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/iZuf62q9sqpx7kwg0m00tiZ/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iZuf62q9sqpx7kwg0m00tiZ)(PORT=1521)))
    Services Summary...
    Service "ORCL" has 1 instance(s).
      Instance "ORCL", status READY, has 1 handler(s) for this service...
    Service "ORCLXDB" has 1 instance(s).
      Instance "ORCL", status READY, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ lsnrctl stop
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-JUN-2019 15:48:25
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=iZuf62q9sqpx7kwg0m00tiZ)(PORT=1521)))
    The command completed successfully
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ lsnrctl start
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-JUN-2019 15:48:34
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
    
    TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    Log messages written to /home/oracle/app/oracle/diag/tnslsnr/iZuf62q9sqpx7kwg0m00tiZ/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iZuf62q9sqpx7kwg0m00tiZ)(PORT=1521)))
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=iZuf62q9sqpx7kwg0m00tiZ)(PORT=1521)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date                10-JUN-2019 15:48:34
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
    Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/iZuf62q9sqpx7kwg0m00tiZ/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iZuf62q9sqpx7kwg0m00tiZ)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ 
    
    
  2. 删除数据库
    1> 停止数据库服务

    [root@iZuf62q9sqpx7kwg0m00tiZ ~]# su - oracle
    Last login: Mon Jun 10 15:38:21 CST 2019 on pts/3
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ sqlplus /nolog
    
    SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 10 15:52:51 2019
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    SQL> connect / as sysdba
    Connected.
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ 
    
    

    2> 停止监听

    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ lsnrctl stop
    
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 10-JUN-2019 15:54:24
    
    Copyright (c) 1991, 2009, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=iZuf62q9sqpx7kwg0m00tiZ)(PORT=1521)))
    The command completed successfully
    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ 
    

    3> 停止Http服务

    [oracle@iZuf62q9sqpx7kwg0m00tiZ ~]$ su - root
    Password: 
    Last login: Mon Jun 10 15:49:43 CST 2019 on pts/3
    [root@iZuf62q9sqpx7kwg0m00tiZ ~]# service http stop
    Redirecting to /bin/systemctl stop http.service
    Failed to stop http.service: Unit http.service not loaded.
    [root@iZuf62q9sqpx7kwg0m00tiZ ~]# 
    
    

    4> 删除安装目录

    [root@iZuf62q9sqpx7kwg0m00tiZ ~]# rm -rf /home/oracle
    [root@iZuf62q9sqpx7kwg0m00tiZ ~]# cd /home
    [root@iZuf62q9sqpx7kwg0m00tiZ home]# ll
    total 11295612
    drwxr-xr-x 8 root root       4096 Aug 21  2009 database
    -rwxrwxr-x 1 root root 1239269270 Jun  3 15:34 linux.x64_11gR2_database_1of2.zip
    -rwxrwxr-x 1 root root 1111416131 Jun  3 15:33 linux.x64_11gR2_database_2of2.zip
    drwxrwxr-x 4 root root       4096 Jun 10 13:55 oracle_dependent_package
    -rw-r--r-- 1 root root 9216000000 Jun 10 12:41 swap
    [root@iZuf62q9sqpx7kwg0m00tiZ home]# 
    

    5> 将/usr/local/bin下的文件全部删除

    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# cd /usr/local/bin
    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# ll
    total 20
    -rwxr-xr-x 1 oracle root 4143 Jun 10 14:18 coraenv
    -rwxr-xr-x 1 oracle root 2415 Jun 10 14:18 dbhome
    -rwxr-xr-x 1 oracle root 5036 Jun 10 14:18 oraenv
    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# rm -f coraenv 
    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# rm -f dbhome 
    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# rm -f oraenv 
    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# 
    

    6> 删除相关配置文件

    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# rm -f /etc/oratab 
    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# rm -f /etc/oraInst.loc 
    [root@iZuf62q9sqpx7kwg0m00tiZ bin]# 
    

    7> 删除用户和用户组

    [root@iZuf62q9sqpx7kwg0m00tiZ /]# userdel -r oracle
    userdel: oracle home directory (/home/oracle) not found
    [root@iZuf62q9sqpx7kwg0m00tiZ /]# groupdel oinstall
    [root@iZuf62q9sqpx7kwg0m00tiZ /]# groupdel dba
    [root@iZuf62q9sqpx7kwg0m00tiZ /]# userdel oracle
    userdel: user 'oracle' does not exist
    [root@iZuf62q9sqpx7kwg0m00tiZ /]# 
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值