database's docs

2.2.0 oracle sql语句之删除数据库


1. 删除数据库实例

-- "sqlplus / as sysdba"连接oracle
-- 关闭库时,提示需要清除所有会话
SQL> alter database close;
alter database close
*
ERROR at line 1:
ORA-01093: ALTER DATABASE CLOSE only permitted with no sessions connected

-- 关闭数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
-- 挂载数据库
SQL> startup mount;
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size                  2232960 bytes
Variable Size             507514240 bytes
Database Buffers          318767104 bytes
Redo Buffers                6590464 bytes
Database mounted.

-- 查看数据库状态
SQL> select status from v$instance;

STATUS
------------
MOUNTED

SQL> alter system enable restricted session;

System altered.


-- 删除数据库
SQL> drop database;

Database dropped.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> connect / as sysdba
Connected to an idle instance.
SQL> show parameter db_name
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0