oracle数据库如何删除,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
首先停止用户端连接:
SQL > startup restrict mount;
删除数据库:
SQL> drop database;
Database dropped.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@test ~]$ cd $ORACLE_HOME/deinstall/
[oracle@test deinstall]$ ls
bootstrap.pl deinstall deinstall.pl deinstall.xml jlib readme.txt response sshUserSetup.sh
[oracle@test deinstall]$ ll
total 92
-rwxr-xr-x. 1 oracle oinstall 9780 May 10 2011 bootstrap.pl
-rwxr-xr-x. 1 oracle oinstall 9658 Apr 13 2017 deinstall
-rwxr-xr-x. 1 oracle oinstall 18841 Jan 29 2013 deinstall.pl
-rw-r--r--. 1 oracle oinstall 3466 Aug 18 2010 deinstall.xml
drwxr-xr-x. 2 oracle oinstall 4096 Apr 13 2017 jlib
-rw-r--r--. 1 oracle oinstall 409 Aug 18 2010 readme.txt
drwxr-xr-x. 2 oracle oinstall 4096 Apr 13 2017 response
-rwxr-xr-x. 1 oracle oinstall 32343 Dec 16 2009 sshUserSetup.sh
[oracle@test deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2017-11-24_11-35-44AM/logs/
############ ORACLE DEINSTALL & DECONFIG TOOL START ############
######################### CHECK OPERATION START #########################
## [START] Install check configuration ##
Checking for existence of the Oracle home location /u01/app/oracle/product/11.2.0/db_1
Oracle Home type selected for deinstall is: Oracle Single Instance Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
Checking for sufficient temp space availability on node(s) : 'test'
## [END] Install check configuration ##
Network Configuration check config START
Network de-configuration trace file location: /tmp/deinstall2017-11-24_11-35-44AM/logs/netdc_check2017-11-24_11-35-57-AM.log
Specify all Single Instance listeners that are to be de-configured [LISTENER]:
Network Configuration check config END
Database Check Configuration START
Database de-configuration trace file location: /tmp/deinstall2017-11-24_11-35-44AM/logs/databasedc_check2017-11-24_11-36-02-AM.log
Use comma as separator when specifying list of values as input
Specify the list of database names that are configured in this Oracle home [foglight]:
###### For Database 'foglight' ######
Specify the type of this database (1.Single Instance Database|2.Oracle Restart Enabled Database) [1]:
Specify the diagnostic destination location of the database [/u01/app/oracle/diag/rdbms/foglight]:
Specify the storage type used by the Database ASM|FS []: FS
Specify the list of directories if any database files exist on a shared file system. If 'foglight' subdirectory is found, then it will be deleted. Otherwise, the specified directory will be deleted. Alternatively, you can specify list of database files with full path [ ]:
Specify the fast recovery area location, if it is configured on the file system. If 'foglight' subdirectory is found, then it will be deleted. []:
Specify the database spfile location [ ]:
Database Check Configuration END
Enterprise Manager Configuration Assistant START
EMCA de-configuration trace file location: /tmp/deinstall2017-11-24_11-35-44AM/logs/emcadc_check2017-11-24_11-36-54-AM.log
Checking configuration for database foglight
Enterprise Manager Configuration Assistant END
Oracle Configuration Manager check START
OCM check log file location : /tmp/deinstall2017-11-24_11-35-44AM/logs//ocm_check1819.log
Oracle Configuration Manager check END
######################### CHECK OPERATION END #########################
####################### CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /u01/app/oracle/product/11.2.0/db_1
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Following Single Instance listener(s) will be de-configured: LISTENER
The following databases were selected for de-configuration : foglight
Database unique name : foglight
Storage used : FS
No Enterprise Manager configuration to be updated for any database(s)
No Enterprise Manager ASM targets to update
No Enterprise Manager listener targets to migrate
Checking the config status for CCR
Oracle Home exists with CCR directory, but CCR is not configured
CCR check is finished
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/tmp/deinstall2017-11-24_11-35-44AM/logs/deinstall_deconfig2017-11-24_11-35-56-AM.out'
Any error messages from this session will be written to: '/tmp/deinstall2017-11-24_11-35-44AM/logs/deinstall_deconfig2017-11-24_11-35-56-AM.err'
######################## CLEAN OPERATION START ########################
Enterprise Manager Configuration Assistant START
EMCA de-configuration trace file location: /tmp/deinstall2017-11-24_11-35-44AM/logs/emcadc_clean2017-11-24_11-36-54-AM.log
Updating Enterprise Manager ASM targets (if any)
Updating Enterprise Manager listener targets (if any)
Enterprise Manager Configuration Assistant END
Database de-configuration trace file location: /tmp/deinstall2017-11-24_11-35-44AM/logs/databasedc_clean2017-11-24_11-37-00-AM.log
Database Clean Configuration START foglight
This operation may take few minutes.
Database Clean Configuration END foglight
Network Configuration clean config START
Network de-configuration trace file location: /tmp/deinstall2017-11-24_11-35-44AM/logs/netdc_clean2017-11-24_11-37-09-AM.log
De-configuring Single Instance listener(s): LISTENER
De-configuring listener: LISTENER
Stopping listener: LISTENER
Warning: Failed to stop listener. Listener may not be running.
Deleting listener: LISTENER
Listener deleted successfully.
Listener de-configured successfully.
De-configuring Local Net Service Names configuration file...
Local Net Service Names configuration file de-configured successfully.
De-configuring backup files...
Backup files de-configured successfully.
The network configuration has been cleaned up successfully.
Network Configuration clean config END
Oracle Configuration Manager clean START
OCM clean log file location : /tmp/deinstall2017-11-24_11-35-44AM/logs//ocm_clean1819.log
Oracle Configuration Manager clean END
Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START
Detach Oracle home '/u01/app/oracle/product/11.2.0/db_1' from the central inventory on the local node : Done
Delete directory '/u01/app/oracle/product/11.2.0/db_1' on the local node : Done
Delete directory '/u01/app/oraInventory' on the local node : Done
Delete directory '/u01/app/oracle' on the local node : Done
Oracle Universal Installer cleanup was successful.
Oracle Universal Installer clean END
## [START] Oracle install clean ##
Clean install operation removing temporary directory '/tmp/deinstall2017-11-24_11-35-44AM' on node 'test'
## [END] Oracle install clean ##
######################### CLEAN OPERATION END #########################
####################### CLEAN OPERATION SUMMARY #######################
Successfully de-configured the following database instances : foglight
Following Single Instance listener(s) were de-configured successfully: LISTENER
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
Successfully detached Oracle home '/u01/app/oracle/product/11.2.0/db_1' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/11.2.0/db_1' on the local node.
Successfully deleted directory '/u01/app/oraInventory' on the local node.
Successfully deleted directory '/u01/app/oracle' on the local node.
Oracle Universal Installer cleanup was successful.
Run 'rm -rf /etc/oraInst.loc' as root on node(s) 'test' at the end of the session.
Run 'rm -rf /opt/ORCLfmap' as root on node(s) 'test' at the end of the session.
Run 'rm -rf /etc/oratab' as root on node(s) 'test' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################
############# ORACLE DEINSTALL & DECONFIG TOOL END #############
[oracle@test deinstall]$ exit
logout
[root@test ~]# rm -rf /etc/oraInst.loc
[root@test ~]# rm -rf /opt/ORCLfmap
[root@test ~]# rm -rf /etc/oratab
oracle数据库删除完成。
原先的文件情况:
[root@test shwmsdb]# ls
control01.ctl redo04b.log redo09b.log wmsadmin_dat01.dbf wmwhse2_idx01.dbf wmwhse5_dat01.dbf wmwhse7_idx01.dbf wmwhse9_tmp01.dbf
meta01.dbf redo05a.log redo10a.log wmsadmin_idx01.dbf wmwhse2_tmp01.dbf wmwhse5_dat02.dbf wmwhse7_tmp01.dbf wmwpuser_dat01.dbf
oper01.dbf redo05b.log redo10b.log wmsadmin_tmp01.dbf wmwhse3_dat01.dbf wmwhse5_idx01.dbf wmwhse8_dat01.dbf wmwpuser_idx01.dbf
redo01a.log redo06a.log sce_tools01.dbf wmwhse1_dat01.dbf wmwhse3_dat02.dbf wmwhse5_tmp01.dbf wmwhse8_dat02.dbf wmwpuser_tmp01.dbf
redo01b.log redo06b.log sysaux.276.874082233 wmwhse1_dat02.dbf wmwhse3_idx01.dbf wmwhse6_dat01.dbf wmwhse8_idx01.dbf
redo02a.log redo07a.log system.264.874082189 wmwhse1_idx01.dbf wmwhse3_tmp01.dbf wmwhse6_idx01.dbf wmwhse8_idx02.dbf
redo02b.log redo07b.log temp.303.874085885 wmwhse1_tmp01.dbf wmwhse4_dat01.dbf wmwhse6_tmp01.dbf wmwhse8_tmp01.dbf
redo03a.log redo08a.log undotbs1.263.874082191 wmwhse2_dat01.dbf wmwhse4_data.328.938901673 wmwhse7_dat01.dbf wmwhse9_dat01.dbf
redo03b.log redo08b.log undotbs2.273.874082225 wmwhse2_dat02.dbf wmwhse4_idx01.dbf wmwhse7_dat02.dbf wmwhse9_dat02.dbf
redo04a.log redo09a.log users.289.874082237 wmwhse2_dat03.dbf wmwhse4_tmp01.dbf wmwhse7_dat03.dbf wmwhse9_idx01.dbf
[oracle@test archivelog]$ ls
arc_1_100_961335150.arc arc_1_119_961335150.arc arc_1_27_961335150.arc arc_1_46_961335150.arc arc_1_65_961335150.arc arc_1_84_961335150.arc
arc_1_101_961335150.arc arc_1_120_961335150.arc arc_1_28_961335150.arc arc_1_47_961335150.arc arc_1_66_961335150.arc arc_1_85_961335150.arc
arc_1_102_961335150.arc arc_1_121_961335150.arc arc_1_2_961335150.arc arc_1_48_961335150.arc arc_1_67_961335150.arc arc_1_86_961335150.arc
arc_1_103_961335150.arc arc_1_12_961335150.arc arc_1_29_961335150.arc arc_1_4_961335150.arc arc_1_68_961335150.arc arc_1_87_961335150.arc
arc_1_104_961335150.arc arc_1_13_961335150.arc arc_1_30_961335150.arc arc_1_49_961335150.arc arc_1_6_961335150.arc arc_1_88_961335150.arc
arc_1_105_961335150.arc arc_1_14_961335150.arc arc_1_31_961335150.arc arc_1_50_961335150.arc arc_1_69_961335150.arc arc_1_8_961335150.arc
arc_1_106_961335150.arc arc_1_15_961335150.arc arc_1_32_961335150.arc arc_1_51_961335150.arc arc_1_70_961335150.arc arc_1_89_961335150.arc
arc_1_107_961335150.arc arc_1_16_961335150.arc arc_1_33_961335150.arc arc_1_52_961335150.arc arc_1_71_961335150.arc arc_1_90_961335150.arc
arc_1_108_961335150.arc arc_1_17_961335150.arc arc_1_34_961335150.arc arc_1_53_961335150.arc arc_1_72_961335150.arc arc_1_91_961335150.arc
arc_1_10_961335150.arc arc_1_18_961335150.arc arc_1_35_961335150.arc arc_1_54_961335150.arc arc_1_73_961335150.arc arc_1_92_961335150.arc
arc_1_109_961335150.arc arc_1_1_961335150.arc arc_1_36_961335150.arc arc_1_55_961335150.arc arc_1_74_961335150.arc arc_1_93_961335150.arc
arc_1_110_961335150.arc arc_1_19_961335150.arc arc_1_37_961335150.arc arc_1_56_961335150.arc arc_1_75_961335150.arc arc_1_94_961335150.arc
arc_1_111_961335150.arc arc_1_20_961335150.arc arc_1_38_961335150.arc arc_1_57_961335150.arc arc_1_76_961335150.arc arc_1_95_961335150.arc
arc_1_112_961335150.arc arc_1_21_961335150.arc arc_1_3_961335150.arc arc_1_58_961335150.arc arc_1_77_961335150.arc arc_1_96_961335150.arc
arc_1_113_961335150.arc arc_1_22_961335150.arc arc_1_39_961335150.arc arc_1_5_961335150.arc arc_1_78_961335150.arc arc_1_97_961335150.arc
arc_1_114_961335150.arc arc_1_23440_874531363.arc arc_1_40_961335150.arc arc_1_59_961335150.arc arc_1_7_961335150.arc arc_1_98_961335150.arc
arc_1_115_961335150.arc arc_1_23441_874531363.arc arc_1_41_961335150.arc arc_1_60_961335150.arc arc_1_79_961335150.arc arc_1_9_961335150.arc
arc_1_116_961335150.arc arc_1_23_961335150.arc arc_1_42_961335150.arc arc_1_61_961335150.arc arc_1_80_961335150.arc arc_1_99_961335150.arc
arc_1_117_961335150.arc arc_1_24_961335150.arc arc_1_43_961335150.arc arc_1_62_961335150.arc arc_1_81_961335150.arc arc_2_1_961335150.arc
arc_1_118_961335150.arc arc_1_25_961335150.arc arc_1_44_961335150.arc arc_1_63_961335150.arc arc_1_82_961335150.arc arc_2_21318_874531363.arc
arc_1_11_961335150.arc arc_1_26_961335150.arc arc_1_45_961335150.arc arc_1_64_961335150.arc arc_1_83_961335150.arc arc_2_21319_874531363.arc
这个操作可以删除:
控制文件
redo log
用户数据文件(各类表空间)
temp表空间
但是不会删除归档文件,归档文件需要手工删除。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。