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. HUD 1171 Big Event in HDU(01背包)

    Big Event in HDU Problem Description Nowadays, we all know that Computer College is the biggest depa ...

  2. 关于MPMoviePlayerController类播放视频时,外放没有声音的问题(ios)

    一.导入音频资源类 #import "AVFoundation/AVAudioSession.h" 二.在播放视频的方法中加一句支持外放的代码 [[AVAudioSession s ...

  3. CCF-CSP 最大的矩形

    问题描述 在横轴上放了n个相邻的矩形,每个矩形的宽度是1,而第i(1 ≤ i ≤ n)个矩形的高度是hi.这n个矩形构成了一个直方图.例如,下图中六个矩形的高度就分别是3, 1, 6, 5, 2, 3 ...

  4. Github命令详解

    Git bash: ***创建本地版本库: $ cd d: $ mkdir git $ cd git $ mkdir test $ git init   //初始化本地库 ***创建文件并添加到版本库 ...

  5. Homestead 使用总结

    homestead Laravel Homestead是一个官方预封装的Vagrant"箱子" 内置 Nginx.PHP 5.6.MySQL.Postgres.Redis.Memc ...

  6. SQL语句优化技术分析 整理他人的

    一.操作符优化 1.IN 操作符 用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格.但是用IN的SQL性能总是比较低的,从Oracle执行的步骤来分析用IN的SQL与不用 ...

  7. recycleview

    RecyclerView是什么? RecyclerView是一种新的视图组,目标是为任何基于适配器的视图提供相似的渲染方式.它被作为ListView和GridView控件的继承者,在最新的suppor ...

  8. FR javascript 时间设置上个月最后一天后当月最后一天

    //设置上月最后一天 var date1 =new Date(); date1.setDate(1); //first day; date1.setMonth(date1.getMonth()); / ...

  9. fopen()函数以"a+"方式打开一个不存在的文件后读写出现问题

    问题:在完成课后习题的时候,使用fopen()函数以"a+"方式打开一个不存在的文件时,写入.读取出现错误: //添加用户输入单词后,在单词头加入编号,确保编号跟着前面的开始排序 ...

  10. this笔记

    在js中,如果this在全局变量和函数中this指window,在在对象中至所挂载的这个对象.