环境:
DB:10.2.0.1
以前删除数据库的通常方法有两种,一种是使用DBCA删除数据库,另外一种是停掉数据库后删除该数据库的相应目录.最近发现有一种方法比较直接,就是使用drop database.
SQL> startup mount exclusive -- 数据库必须在mount exclusive模式
ORACLE instance started.
SQL> alter system enable restricted session; -- 数据库必须在restricted模式
System altered.
SQL> drop database;
Database dropped.
执行该操作后,数据库相应的控制文件,日志文件,数据文件会自动删除,spfile也会删除(归档日志不会删除).
从alert日志可以发现drop database做了如下操作:
drop database
Mon Feb 6 07:44:06 2012
Deleted file /u01/mydb/oradata/oracl/system01.dbf
Deleted file /u01/mydb/oradata/oracl/undotbs01.dbf
Deleted file /u01/mydb/oradata/oracl/sysaux01.dbf
Deleted file /u01/mydb/oradata/oracl/users01.dbf
Deleted file /u01/mydb/oradata/oracl/hxl01.dbf
Deleted file /u01/mydb/oradata/oracl/redo01.log
Deleted file /u01/mydb/oradata/oracl/redo02.log
Deleted file /u01/mydb/oradata/oracl/redo03.log
Deleted file /u01/mydb/oradata/oracl/temp01.dbf
Instance terminated by USER, pid = 13869
Deleted file /u01/mydb/oradata/oracl/control01.ctl
Deleted file /u01/mydb/oradata/oracl/control02.ctl
Deleted file /u01/mydb/oradata/oracl/control03.ctl
Completed: drop database
Mon Feb 6 07:44:13 2012
--The End--
阅读(428) | 评论(0) | 转发(0) |