Clone PDB PtestDEV to Ptestuat in testuat

1)       Clone PtestDEV to Ptestuat

C:\Windows\system32>sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on 星期五 12月 23 13:12:42 2016

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

连接到:

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

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

ions

SQL> select name from v$datafile;

NAME

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

C:\APP\ORACLE\ORADATA\testuat\SYSTEM01.DBF

C:\APP\ORACLE\ORADATA\testuat\PDBSEED\SYSTEM01.DBF

C:\APP\ORACLE\ORADATA\testuat\SYSAUX01.DBF

C:\APP\ORACLE\ORADATA\testuat\PDBSEED\SYSAUX01.DBF

C:\APP\ORACLE\ORADATA\testuat\UNDOTBS01.DBF

C:\APP\ORACLE\ORADATA\testuat\USERS01.DBF

C:\APP\ORACLE\ORADATA\testuat\PtestDEV\SYSTEM01.DBF

C:\APP\ORACLE\ORADATA\testuat\PtestDEV\SYSAUX01.DBF

C:\APP\ORACLE\ORADATA\testuat\PtestDEV\PtestDEV_USERS01.DBF

已选择 9 行。

SQL> show pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

2 PDB$SEED                       READ ONLY  NO

3 PtestDEV                       READ WRITE NO

SQL> alter pluggable database ptestdev close immediate;

插接式数据库已变更。

SQL> show pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

2 PDB$SEED                       READ ONLY  NO

3 PtestDEV                       MOUNTED

SQL>

SQL> alter pluggable database ptestdev open read only;

插接式数据库已变更。

SQL>  create pluggable database ptestuat from ptestdev

FILE_NAME_CONVERT=('C:\APP\ORACLE\ORADATA\testuat\PtestDEV','C:\APP\ORACLE\

ORADATA\testuat\Ptestuat');

插接式数据库已创建。

SQL> show pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

2 PDB$SEED                       READ ONLY  NO

3 PtestDEV                       READ ONLY  NO

4 Ptestuat                       MOUNTED

SQL> alter pluggable database ptestdev close;

插接式数据库已变更。

SQL> show pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

2 PDB$SEED                       READ ONLY  NO

3 PtestDEV                       MOUNTED

4 Ptestuat                       MOUNTED

SQL> alter pluggable database all open;

插接式数据库已变更。

SQL> show pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

2 PDB$SEED                       READ ONLY  NO

3 PtestDEV                       READ WRITE NO

4 Ptestuat                       READ WRITE NO

SQL> select con_name, instance_name,state,restricted from dba_pdb_saved_states;

CON_NAME

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

INSTANCE_NAME

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

STATE                        RESTRI

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

PtestDEV

testuat

OPEN                         NO

SQL>

SQL> alter pluggable database all save state;

插接式数据库已变更。

SQL> select con_name, instance_name,state,restricted from dba_pdb_saved_states;

CON_NAME

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

INSTANCE_NAME

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

STATE                        RESTRI

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

PtestDEV

testuat

OPEN                         NO

Ptestuat

testuat

OPEN                         NO

SQL>

2.

1)    Set correct service for CBD$ROOT and Pluggable DB PtestDEV

SQL> alter session set container=cdb$root;

会话已更改。

SQL> show con_id

CON_ID
------------------------------
1
SQL>
SQL> alter system set service_names=testuat scope=both;

SQL> select name, value, display_value, con_id from v$system_parameter;

NAME
--------------------------------------------------------------------------------
--------------------
VALUE
--------------------------------------------------------------------------------
--------------------
DISPLAY_VALUE
--------------------------------------------------------------------------------
--------------------
    CON_ID
----------
service_names
testuat
testuat
         0
SQL> alter session set container=ptestdev;

会话已更改。

SQL> show con_id

CON_ID
------------------------------
3

SQL> alter system set service_names=ptestdev scope=both;

c:\app\oracle\product\12.1.0\dbhome_1\OPatch>lsnrctl status testuat

LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 - Production on 23-12月-2016 12:0
4:47

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

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=REGISTER_testUAT)))
LISTENER 的 STATUS
------------------------
别名                      testuat
版本                      TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 - Produ
ction
启动日期                  23-12月-2016 11:00:06
正常运行时间              0 天 1 小时 4 分 41 秒
跟踪级别                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
监听程序参数文件          C:\app\oracle\product\12.1.0\dbhome_1\network\admin\li
stener.ora
监听程序日志文件          C:\app\oracle\product\12.1.0\dbhome_1\network\log\test
uat.log
监听端点概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\REGISTER_testUATipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vtest01Uat.cn.test.com)(PORT=15031))
)
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=vtest01Uat.cn.test.com)(PORT=24084)
))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=vtest01Uat.cn.test.com)(PORT=5500))
(Security=(my_wallet_directory=C:\APP\testADMIN\admin\testuat\xdb_wallet))(Prese
ntation=HTTP)(Session=RAW))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
  实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
服务 "PtestDEV" 包含 2 个实例。
  实例 "testUAT", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
  实例 "testuat", 状态 READY, 包含此服务的 1 个处理程序...
服务 "testUAT" 包含 2 个实例。
  实例 "testUAT", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
  实例 "testuat", 状态 READY, 包含此服务的 1 个处理程序...
服务 "testuatXDB" 包含 1 个实例。
  实例 "testuat", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功

3)    Keep ‘save state’ for all the pluggable database instead of creating startup DB triggers

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PtestDEV                       READ WRITE NO
SQL> alter pluggable database all save state;

插接式数据库已变更。

SQL>

4)    Setup sqlnet.ora, tnsnames.ora, listener.ora as below:

C:\app\oracle\product\12.1.0\dbhome_1\network\admin\sqlnet.ora
# sqlnet.ora Network Configuration File: #C:\app\oracle\product\12.1.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NONE,NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

C:\app\oracle\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# tnsnames.ora Network Configuration File: C:\app\oracle\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

testUAT =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = vtest01Uat.cn.test.com)(PORT = 15031))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = testuat)
    )
  )

LISTENER_testUAT=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER_testUAT))
  )

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC15031))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

PtestDEV =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = vtest01Uat.cn.test.com)(PORT = 15031))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ptestdev)
    )
  )

C:\app\oracle\product\12.1.0\dbhome_1\network\admin\listener.ora
# listener.ora Network Configuration File: c:\app\oracle\product\12.1.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SECURE_REGISTER_testUAT = (IPC)
SECURE_CONTROL_testUAT =(TCPS,IPC)
ADMIN_RESTRICTIONS_testUAT = ON

testUAT =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER_testUAT))
      (ADDRESS = (PROTOCOL = TCP)(HOST = vtest01Uat.cn.test.com)(PORT = 15031))
      (ADDRESS = (PROTOCOL = TCPS)(HOST = vtest01Uat.cn.test.com)(PORT = 24084))
    )
  )

DIAG_ADR_ENABLED_testUAT = OFF

SID_LIST_testUAT =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = testUAT)
      (SID_NAME = testUAT)
      (ORACLE_HOME = C:\app\oracle\product\12.1.0\dbhome_1)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = PtestDEV)
      (SID_NAME = testUAT)
      (ORACLE_HOME = C:\app\oracle\product\12.1.0\dbhome_1)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\oracle\product\12.1.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle\product\12.1.0\dbhome_1\bin\oraclr12.dll")
    )
  )

5)    Verify DB parameter (cond_id ‘0’ should be cdb$root)
SQL> l
  1  select name, value, display_value, con_id from v$system_parameter
  2* where name in ('service_names','local_listener','db_name','instance_name')
SQL> /

NAME                                     VALUE                DISPLAY_VALUE
       CON_ID
---------------------------------------- -------------------- ------------------
-- ----------
service_names                            testuat              testuat
            0
instance_name                            testuat              testuat
            0
local_listener                           LISTENER_testUAT     LISTENER_testUAT
            0
db_name                                  testuat              testuat
            0

SQL>

12C CLONE PDB and config service_listener的更多相关文章

  1. oracle 12c 创建PDB用户即Local User (PDB与CDB)

    Oracle 12C用户创建与表空间分配  数据库安装完成后,首先用系统用户链接数据库容器(CDB), 在数据库容器(CDB)中创建表空间‘imei’ SQL>create tablespace ...

  2. Clone PDB from same CDB

    Clone PDB 用途: 1.用于测试,从生产系统clone数据来进行测试 2.诊断性能问题   Clone PDB Using OMF from same CDB 环境信息: DB Version ...

  3. Oracle12c Clone PDB 的方法

    1. 创建PDB的存放路径,举例: 2. 设置 数据库创建数据文件的目录 alter system set db_Create_file_dest='C:\app\Administrator\orad ...

  4. Multitenant best Practice clone pdb seed and Clone a Pluggable Database – 12c Edition

    1. 1.Tnsnames when connecting to either Container or Pluggable instance The tnsnames.ora should be c ...

  5. Oracle 12C -- clone a remote pdb

    Connect to the remote CDB and prepare the remote PDB for cloning. SQL> select con_id,dbid,name,op ...

  6. Oracle 12C -- clone a non-cdb as a pdb

    将non-CDB置为只读模式: $ sqlplus '/as sysdba' SQL> select name, decode(cdb, 'YES', 'Multitenant Option e ...

  7. oracle 12c连接pdb

    12c中,如何连接pluggable database: 使用默认的service连接pdb,创建pdb之后,在监听中自动添加以pdb为名的service: 用户在cluster中创建service, ...

  8. java开发连接Oracle 12c采用PDB遇到问题记录

    今天初次使用java连接Oracle 12c,遇到各种问题,为方便后续查询,在汇总了问题记录及解决方案如下. ORA-28040: No matching authentication protoco ...

  9. 12C cdb/pdb 配置监听

    . PDB is not an instance, so using SID in the connection string will not work. When the database is ...

随机推荐

  1. swift label不同颜色、不同字体

    let string = "点击注册按钮,即表示您已同意隐私条款和服务协议" let ranStr = "同意" let attrstring:NSMutabl ...

  2. Topself 方便调试的Window服务框架

    Installing Topshelf nuget Install-Package Topshelf public class TownCrier { readonly Timer _timer; p ...

  3. Xcode 8 控制台输出大量不用的log的问题解决&&NSLog失效的解决

    Product-->Scheme-->editeScheme中:Auguments中Environment Variable中 Scheme中添加环境变量 "OS_ACTIVIT ...

  4. JMeter+ant+jenkins自动化持续集成

    一.ant安装配置 1.官网下载地址:http://ant.apache.org/bindownload.cgi 对应的操作系统选择对应的版本下载,本文以windows为列,下载后解压到本地 2.设置 ...

  5. 当今Web应用的主要技术

    WWW是World Wide Web的简称,缩写为W3C,称为万维网,也简称为Web.目前Internet已经普及到整个社会,其中Web应用已经称为Internet上最受欢迎的应用之一,正是由于它的出 ...

  6. SPA UI-router

    ------------------------------------------------------------------------------------ SPA SPA(单页面应用): ...

  7. js中三目运算符和&& || 符的个人浅见

    这两天看到别人写的代码,感觉很牛逼,如下,大神请忽视 $(".lgn").on("click", function() { var a = {}; a.logi ...

  8. JavaScript动态加载资源【js|css】示例代码

    在开发过程中会用到各种第三方的插件,或者自己写在单独文件中的js方法库或者css样式,在html头部总是需要写一大堆的script和link标签,如果想要自己实现动态的引入资源文件,可以使用开源的re ...

  9. angularjs uigrid 中celltemplate的写浮动框

    columnDefs: [ {field: 'collegename', enableFiltering: false ,width:"12%",displayName:" ...

  10. 5-jQuery - AJAX get()/post()页面请求即执行

    get 前台页面 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> &l ...