Drop Database
今天手動建庫,正執行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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- flashback drop/query/table/database/archiveDatabaseHive
- How to drop Oracle RAC database manually?OracleDatabase
- alter database drop datafile 與 drop tablespace file 的區別Database
- drop database---ora-01586Database
- PostgreSQL DBA(138) - PG 13(Drop database force)SQLDatabase
- alter database datafile 4 offline drop;Database
- Oracle 10g新增DROP DATABASE命令Oracle 10gDatabase
- alter database datafile offline drop 與 alter tablespace drop datafile 區別Database
- alter database offline 與 alter database offline drop效果比對Database
- MySQL 5.6 drop database時,table metadata lock等待MySqlDatabase
- alter database datafile .... offline drop的問題Database
- 6、MySQL刪除資料庫(DROP DATABASE語句)MySql資料庫Database
- alter database datafile offline drop相關問題Database
- Msg 3702:Cannot drop the database 'gcard' because it is currently in use.DatabaseGC
- How To Drop, Create And Recreate DB Control In A 10g DatabaseDatabase
- GTID複製報錯處理:Last_Error: Error 'Can't drop database 'test';ASTErrorDatabase
- drop asm disk、撤銷drop asm diskASM
- [20111227]Alter database datafile offline drop後的恢復.txtDatabase
- JavaScript drop 事件JavaScript事件
- SQL__DROPSQL
- windows drop emWindows
- oracle drop columnsOracle
- mysql drop keyMySql
- Oracle中drop user和drop user cascade的區別Oracle
- drag &drop 拖拽事件事件
- drag & drop 拖拽事件事件
- drop materialized view hung !!!ZedView
- drop、delete 與truncatedelete
- KEEP INDEX | DROP INDEXIndex
- Drag & Drop 拖拽詳解
- HTML5 : Drag & DropHTML
- mysql恢復drop表MySql
- 快速drop mysql大表MySql
- truncate delete drop 區別delete
- 【Flashback】使用Flashback Drop技術閃回被DROP表的指定版本資料
- standby database to primary database.Database
- Quality Inspection in drop shipment process
- 簡述truncate、delete和dropdelete