drop database

drop database[@more@]

今天手动建库,正执行catproc 脚本,突然停电了。悲催呀。需要重新删除库重建。

在oracle 10g里,有一条新特性是使用drop database命令可以删除数据库的数据文件,联机日志文件,控制文件,spfile.使用drop database命令需要以下三个条件:

  • database moust be closed
  • exclusively mounted
  • restricted mode

下面是实验的过程:

Enter user-name: / as sysdba
Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 314572800 bytes
Fixed Size 1248720 bytes
Variable Size 134218288 bytes
Database Buffers 171966464 bytes
Redo Buffers 7139328 bytes
Database mounted.
Database opened.
SQL>

在数据库完全打开的情况下使用drop database命令
SQL>
SQL> drop database;
drop database
*
ERROR at line 1:
ORA-01586: database must be mounted EXCLUSIVE and not open for this operation

将数据库关闭,重新启动到mount状态
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount;
ORACLE instance started.

Total System Global Area 314572800 bytes
Fixed Size 1248720 bytes
Variable Size 138412592 bytes
Database Buffers 167772160 bytes
Redo Buffers 7139328 bytes
Database mounted.

再次执行drop database命令,执行命令出现错误
SQL> drop database;
drop database
*
ERROR at line 1:
ORA-12719: operation requires database is in RESTRICTED mode

将数据库模式置为restricted模式
SQL> alter system enable restricted session;

System altered.

执行drop database删除数据库命令成功
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

看来要正确执行这条命令,这三个条件都要满足。我查看了一下数据文件,日志文件,控制文件,spfile确实不存在了。我是在Windows上做的测试,操作系统上ORACLE实例的服务还存在着,如果想完全清楚oracle,再用oradim -delete -sid sidname命令。

接下来,我要重新创建数据库了!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/309902/viewspace-1060408/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/309902/viewspace-1060408/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值