12c dbca silent delete pdb

1   描述

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

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文件,构建删除pdb的response文件。如下(因del pdb的部分内容较少,此部分注释得以保留):

[oracle@host01 ~]$ cat responsole_del_pdb.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 = "deletePluggableDatabase"

 

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

 

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

# DELETEPLUGGABLEDATABASE section is used when OPERATION_TYPE is defined as "deletePluggableDatabase".

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

[DELETEPLUGGABLEDATABASE]

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

# 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          : PDBNAME

# Datatype      : String

# Description   : The name of new pluggable database

#                 This pdb name must not be same as sourcedb name.

# Default value : none

# Mandatory     : YES

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

PDBNAME = "PDB1"

 

#-----------------------*** End of deletePluggableDatabase 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>

 

执行删除pdb操作

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

Deleting Pluggable Database

10% complete

20% complete

80% complete

90% complete

100% complete

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

[oracle@host01 ~]$ cat /u01/app/oracle/cfgtoollogs/dbca/orcl12c/PDB1/orcl12c2.log

Deleting Pluggable Database

DBCA_PROGRESS : 10%

DBCA_PROGRESS : 20%

DBCA_PROGRESS : 80%

DBCA_PROGRESS : 90%

DBCA_PROGRESS : 100%

Pluggable database "PDB1" deleted successfully.

[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:31:28 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

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

 

6 rows selected.

 

SQL> !ls /u01/app/oracle/oradata/orcl12c/

control01.ctl  PDB1  pdbseed  redo01.log  redo02.log  redo03.log  sysaux01.dbf  system01.dbf  temp01.dbf  undotbs01.dbf  users01.dbf

 

SQL> !ls /u01/app/oracle/oradata/orcl12c/PDB1

 

SQL>

 

dbca删除pdb后,相应pdb数据文件也一并删除。

5   个人总结

pdb可以使用dbca,也可以使用drop statement删除,此处官方无建议要求。

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-2072374/,如需转载,请注明出处,否则将追究法律责任。

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值