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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- PostgreSQL DBA(138) - PG 13(Drop database force)SQLDatabase
- 6、MySQL刪除資料庫(DROP DATABASE語句)MySql資料庫Database
- GTID複製報錯處理:Last_Error: Error 'Can't drop database 'test';ASTErrorDatabase
- SQL__DROPSQL
- JavaScript drop 事件JavaScript事件
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- drag &drop 拖拽事件事件
- drag & drop 拖拽事件事件
- torch--drop out
- Oracle Database Cloud - Database as a Service Quick StartOracleDatabaseCloudUI
- Error querying database. XXXXXXXXXXXXX, No database selected。ErrorDatabase
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- drop apply INSTANTIATION for one tableAPP
- HTML5 : Drag & DropHTML
- Drag & Drop 拖拽詳解
- DROP AND RECREATE ONLINE REDOLOG FILES
- Quality Inspection in drop shipment process
- Database TimeoutDatabase
- Database OverallDatabase
- database no shardingDatabase
- Oracle 12.2 使用Database Link優化Standby Database WorkloadOracleDatabase優化
- PostgreSQL DBA(164) - pgAdmin(Drop column)SQL
- tarui drop失效,解決配置UI
- alter table drop unused columns checkpoint
- ORACLE database vaultOracleDatabase
- Relationship Database DesignDatabase
- 3.4 Quiescing a DatabaseUIDatabase
- idea--DatabaseIdeaDatabase
- Oracle clone databaseOracleDatabase
- database的connectDatabase
- Password is required when adding a database to AG group if the database has a master keyUIDatabaseAST
- ORA-16649: possible failover to another database prevents this database from beiAIDatabase
- sql:delete if exists還是drop if exists?SQLdelete
- HTML5 Drag和Drop 拖拽HTML
- dnd.js 拖放庫 Drag and DropJS
- Guide to Database as a Service (DBaaS)GUIIDEDatabase
- Oracle Database Scheduler整理OracleDatabase
- 3.4.1 About Quiescing a DatabaseUIDatabase
- 3.3 Shutting Down a DatabaseDatabase