12c dbca silent delete cdb

1   描述

在已有CDB orcl12c,且CDB orcl12c下已经创建了PDB pdb1基础之上,利用dbca 删除CDB orcl12c数据库。

2   操作环境

2.1  OS info

[oracle@host01 ~]$ lsb_release -a

LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Distributor ID: OracleServer

Description:    Oracle Linux Server release 6.5

Release:        6.5

Codename:       n/a

[oracle@host01 ~]$ uname -a

Linux host01.example.com 2.6.32-431.el6.x86_64 #1 SMP Wed Nov 20 23:56:07 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

2.2  DB info

[oracle@host01 ~]$ export ORACLE_SID=orcl12c

[oracle@host01 ~]$ export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

[oracle@host01 ~]$ sqlplus / as sysdba <<EOF

set lines 150

COL PRODUCT FORMAT A55

COL VERSION FORMAT A15

COL STATUS FORMAT A15

Col parameter for a30

SELECT * FROM PRODUCT_COMPONENT_VERSION;

col value for a50

set pages 50

select * from nls_database_parameters;

 

archive log list;

EOF

 

SQL*Plus: Release 12.1.0.2.0 Production on Tue Mar 29 14:23:13 2016

 

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

SQL> SQL> SQL> SQL> SQL> SQL>

PRODUCT                                                 VERSION         STATUS

------------------------------------------------------- --------------- ---------------

NLSRTL                                                  12.1.0.2.0      Production

Oracle Database 12c Enterprise Edition                  12.1.0.2.0      64bit Productio

                                                                        n

 

PL/SQL                                                  12.1.0.2.0      Production

TNS for Linux:                                          12.1.0.2.0      Production

 

SQL> SQL> SQL>

PARAMETER                      VALUE

------------------------------ --------------------------------------------------

NLS_RDBMS_VERSION              12.1.0.2.0

NLS_NCHAR_CONV_EXCP            FALSE

NLS_LENGTH_SEMANTICS           BYTE

NLS_COMP                       BINARY

NLS_DUAL_CURRENCY              $

NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR

NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR

NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM

NLS_TIME_FORMAT                HH.MI.SSXFF AM

NLS_SORT                       BINARY

NLS_DATE_LANGUAGE              AMERICAN

NLS_DATE_FORMAT                DD-MON-RR

NLS_CALENDAR                   GREGORIAN

NLS_NUMERIC_CHARACTERS         .,

NLS_NCHAR_CHARACTERSET         AL16UTF16

NLS_CHARACTERSET               WE8MSWIN1252

NLS_ISO_CURRENCY               AMERICA

NLS_CURRENCY                   $

NLS_TERRITORY                  AMERICA

NLS_LANGUAGE                   AMERICAN

 

20 rows selected.

 

SQL> SQL> Database log mode            No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     7

Current log sequence           9

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

[oracle@host01 ~]$

 

3   相关信息

利用数据库软件安装包中的dbca.rsp文件,构建删除CDB的response文件。如下(因del CDB的部分内容较少,此部分注释得以保留):

[oracle@host01 ~]$ cat responsole_del_cdb.txt

#-----------------------------------------------------------------------------

# GENERAL section is required for all types of database creations.

#-----------------------------------------------------------------------------

[GENERAL]

 

#-----------------------------------------------------------------------------

# Name          : RESPONSEFILE_VERSION

# Datatype      : String

# Description   : Version of the database to create

# Valid values  : "12.1.0"

# Default value : None

# Mandatory     : Yes

#-----------------------------------------------------------------------------

RESPONSEFILE_VERSION = "12.1.0"

 

#-----------------------------------------------------------------------------

# Name          : OPERATION_TYPE

# Datatype      : String

# Description   : Type of operation

# Valid values  : "createDatabase" \ "createTemplateFromDB" \ "createCloneTemplate" \ "deleteDatabase" \ "configureDatabase" \ "addInstance" (RAC-only) \ "deleteInstance" (RAC-only) \ "createPluggableDatabase" \ "unplugDatabase" \ "deletePluggableDatabase" \ "configurePluggableDatabase"

# Default value : None

# Mandatory     : Yes

#-----------------------------------------------------------------------------

OPERATION_TYPE = "deleteDatabase"

 

#-----------------------*** End of GENERAL section ***------------------------

 

#-----------------------------------------------------------------------------

# DELETEDATABASE section is used when DELETE_TYPE is defined as "deleteDatabase".

#-----------------------------------------------------------------------------

[DELETEDATABASE]

#-----------------------------------------------------------------------------

# Name          : SOURCEDB

# Datatype      : String

# Description   : The source database is the SID

#                 This database must be local and on the same ORACLE_HOME.

# Default value : none

# Mandatory     : YES

#-----------------------------------------------------------------------------

SOURCEDB = "orcl12c"

 

#-----------------------------------------------------------------------------

# Name          : SYSDBAUSERNAME

# Datatype      : String

# Description   : A user with DBA role.

# Default value : none

# Mandatory     : YES, if no OS authentication

#-----------------------------------------------------------------------------

#SYSDBAUSERNAME = "sys"

 

#-----------------------------------------------------------------------------

# Name          : SYSDBAPASSWORD

# Datatype      : String

# Description   : The password of the DBA user.

#                 You can also specify the password at the command prompt instead of here.

# Default value : none

# Mandatory     : YES, if no OS authentication

#-----------------------------------------------------------------------------

#SYSDBAPASSWORD = "password"

#-----------------------*** End of deleteDatabase section ***------------------------

 

4   详细步骤操作

前提PDB pdb1已经建成且处于open状态,如下:

[oracle@host01 ~]$ export ORACLE_SID=orcl12c

[oracle@host01 ~]$ sqlplus  / as sysdba

 

SQL*Plus: Release 12.1.0.2.0 Production on Wed Mar 30 14:20:41 2016

 

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

SQL> show pdbs

 

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 PDB1                           READ WRITE NO

SQL> select name from v$datafile;

 

NAME

--------------------------------------------------------------------------------

/u01/app/oracle/oradata/orcl12c/system01.dbf

/u01/app/oracle/oradata/orcl12c/sysaux01.dbf

/u01/app/oracle/oradata/orcl12c/undotbs01.dbf

/u01/app/oracle/oradata/orcl12c/pdbseed/system01.dbf

/u01/app/oracle/oradata/orcl12c/users01.dbf

/u01/app/oracle/oradata/orcl12c/pdbseed/sysaux01.dbf

/u01/app/oracle/oradata/orcl12c/PDB1/system01.dbf

/u01/app/oracle/oradata/orcl12c/PDB1/sysaux01.dbf

/u01/app/oracle/oradata/orcl12c/PDB1/PDB1_users01.dbf

 

9 rows selected.

 

SQL>

 

执行删除CDB orcl12c操作

[oracle@host01 ~]$ dbca -silent -responseFile responsole_del_cdb.txt

Connecting to database

4% complete

9% complete

14% complete

19% complete

23% complete

28% complete

47% complete

Updating network configuration files

48% complete

52% complete

Deleting instance and datafiles

76% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl12c.log" for further details.

[oracle@host01 ~]$ ps -ef |grep smon

oracle    21132  19547  0 14:45 pts/0    00:00:00 grep smon

[oracle@host01 ~]$ export ORACLE_SID=orcl12c

[oracle@host01 ~]$ sqlplus  / as sysdba

 

SQL*Plus: Release 12.1.0.2.0 Production on Wed Mar 30 14:45:45 2016

 

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

SQL>! du -sh  /u01/app/oracle/oradata/orcl12c/

12K     /u01/app/oracle/oradata/orcl12c/

 

dbca删除CDB后,该CDB所包含的PDB一并删除,仅留下目录结构。

5   个人总结

cdb可以使用dbca,也可以使用drop statement删除,此处官方无建议要求。若非操作系统验证方式,需在response文件中提供具有dba role的数据库用户名及密码。

6   资料参考引用

Database Administration

 

Administrator's Guide

2 Creating and Configuring an Oracle Database

 

http://docs.oracle.com/database/121/ADMIN/create.htm#i1017640

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

转载于:http://blog.itpub.net/11780477/viewspace-2072397/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值