Oracle Delete Database

2024-12-30 Oracle

Oracle 刪除資料庫

  1. 先查詢資料庫名稱
select name, open_mode from v$database;
SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
TEST    READ WRITE
  1. 關閉資料庫
SQL> shut immediate;

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down
  1. 刪除資料庫
dbca -silent -deleteDatabase -sourceDB TEST -sysDBAUserName SysPassword1 -sysDBAPassword SysPassword1 -forceArchiveLogDeletion
[oracle@oracle-19c listener]$ dbca -silent -deleteDatabase -sourceDB TEST -sysDBAUserName SysPassword1 -sysDBAPassword SysPassword1 -forceArchiveLogDeletion
[WARNING] [DBT-05513] Failed to connect to the database (TEST).
   CAUSE: Specified database credential is not valid to connect to the database (TEST).
   ACTION: Specify a valid sysdba user name and password to connect to the database.
[WARNING] [DBT-11503] The instance (TEST) is not running on the local node. This may result in partial delete of Oracle database.
   CAUSE: A locally running instance is required for complete deletion of Oracle database instance and database files.
   ACTION: Specify a locally running database, or execute DBCA on a node where the database instance is running.
[WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
Prepare for db operation
32% complete
Connecting to database
35% complete
39% complete
42% complete
[WARNING] The data files for database with SID "TEST" could not be determined because the database could not be started. DBCA will proceed with the service deletion.
65% complete
Updating network configuration files
68% complete
Deleting instance and datafiles
84% complete
100% complete
Database deletion completed.
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/TEST/TEST.log" for further details.