【oracle】drop database

Posted on 2011-11-15 23:46  雅飞士  阅读(1562)  评论(0编辑  收藏  举报

1.drop database 的使用:
SQL> conn / as sysdba
Connected.
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> drop database;
drop database
*
ERROR at line 1:
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation


SQL> alter database close;
alter database close
*
ERROR at line 1:
ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected


SQL> alter database close;

Database altered
SQL> drop database;
drop database
*
ERROR at line 1:
ORA-12719: operation requires database is in RESTRICTED mode


SQL> alter system enable restricted session;

System altered..
/*上面这几步可以合并成一句话:startup restrict mount*/

SQL> drop database;

Database dropped.

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

2.查看alert_PROD.log 文件中drop database 进行的操作:
drop database
Tue Nov 8 00:28:16 2011
Deleted file /opt/oradata/prod/disk4/system01.dbf
Deleted file /opt/oradata/prod/disk4/undotbs01.dbf
Deleted file /opt/oradata/prod/disk4/sysaux01.dbf
Deleted file /opt/oradata/prod/disk4/users.dbf
Deleted file /opt/oradata/prod/disk4/transpt.dbf
Deleted file /opt/oradata/prod/disk4/lob_data1.dbf
Deleted file /opt/oradata/prod/disk4/lob_data2.dbf
Deleted file /home/oracle/datafile/exp_datafile1.dbf
Deleted file /home/oracle/datafile/sys_dbf4.dbf
Deleted file /home/oracle/datafile/exp_datafile3.dbf
Deleted file /home/oracle/datafile/exp_datafile4.dbf
Deleted file /home/oracle/datafile/exp_datafile5.dbf
Deleted file /home/oracle/datafile/exp_datafile6.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf1.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf2.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf3.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf4.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf5.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf6.dbf
Deleted file /home/oracle/dangimp/sys_tbs_dbf1.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf7.dbf
Deleted file /home/oracle/datafile/crm1_dbf8.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf8.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf9.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf10.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf11.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf17.dbf
Deleted file /home/oracle/datafile/crm1_dbf15.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf18.dbf
Deleted file /home/oracle/datafile/crm1_dbf17.dbf
Deleted file /home/oracle/datafile/crm1_dbf18.dbf
Deleted file /home/oracle/datafile/crm1_dbf19.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf19.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf20.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf21.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf22.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf23.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf24.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf25.dbf
Deleted file /home/oracle/datafile/crm1_dbf27.dbf
Deleted file /home/oracle/dangimp/crm1_tb_dbf1.dbf
Deleted file /home/oracle/dangimp/crm1_ind_dbf1.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf26.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf27.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf28.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf29.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf30.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf31.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf32.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf33.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf34.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf35.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf36.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf37.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf38.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf39.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf40.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf41.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf42.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf43.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf44.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf45.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf46.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf47.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf49.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf50.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf51.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf52.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf53.dbf
Deleted file /home/oracle/datafile/PROD/datafile/crm1_dbf54.dbf
Deleted file /opt/oradata/prod/disk2/redo41.log
Deleted file /opt/oradata/prod/disk3/redo42.log
Deleted file /opt/oradata/prod/disk2/redo51.log
Deleted file /opt/oradata/prod/disk3/redo52.log
Deleted file /opt/oradata/prod/disk2/redo61.log
Deleted file /opt/oradata/prod/disk3/redo62.log
Deleted file /opt/oradata/prod/disk4/temp01.dbf
Deleted file /opt/oradata/prod/disk4/temp1
Deleted file /opt/oradata/prod/disk4/temp2
Deleted file /home/oracle/datafile/ucr_param_temp.dbf
Termination issued to instance processes. Waiting for the processes to exit
Instance terminated by USER, pid = 3919
Tue Nov 8 00:28:30 2011
Deleted file /opt/oradata/prod/disk1/control1.ctl
Deleted file /opt/oradata/prod/disk1/control2.ctl
Completed: drop database
Tue Nov 8 00:28:31 2011
Shutting down instance (abort)
License high water mark = 5

从日志中可以看出,删除了 数据文件,控制文件,日志文件。
3.drop database 成功执行后 相应的spfile 文件也被删除。

4.修改环境变量:
.bash_profile 文件中的 export ORACLE_SID=PROD 注释掉即可。

 

 

原文地址:http://www.yafeishi.net/blog/2011/11/15/oracle-drop-database.html

菊子曰 本文用菊子曰发布

Copyright © 2024 雅飞士
Powered by .NET 9.0 on Kubernetes