Clone PDB PtestDEV to Ptestuat in testuat
1) Clone PtestDEV to Ptestuat
C:Windowssystem32>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:APPORACLEORADATA estuatSYSTEM01.DBF C:APPORACLEORADATA estuatPDBSEEDSYSTEM01.DBF C:APPORACLEORADATA estuatSYSAUX01.DBF C:APPORACLEORADATA estuatPDBSEEDSYSAUX01.DBF C:APPORACLEORADATA estuatUNDOTBS01.DBF C:APPORACLEORADATA estuatUSERS01.DBF C:APPORACLEORADATA estuatPtestDEVSYSTEM01.DBF C:APPORACLEORADATA estuatPtestDEVSYSAUX01.DBF C:APPORACLEORADATA estuatPtestDEVPtestDEV_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; 插接式数据库已变更。 ( If we are not using the OMF, the SQL syntax is bit drawn out; yet still simple enough to use for creating a PDB. CREATE PLUGGABLE DATABASE pdb2 FROM pdb1 ) SQL> create pluggable database ptestuat from ptestdev FILE_NAME_CONVERT=('C:APPORACLEORADATA estuatPtestDEV','C:APPORACLE ORADATA estuatPtestuat'); 插接式数据库已创建。 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> select CON_ID,GUID,NAME,OPEN_MODE |
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:apporacleproduct12.1.0dbhome_1OPatch>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:apporacleproduct12.1.0dbhome_1
etworkadminli
stener.ora
监听程序日志文件 C:apporacleproduct12.1.0dbhome_1
etworklog est
uat.log
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeREGISTER_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 estADMINadmin estuatxdb_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:apporacleproduct12.1.0dbhome_1
etworkadminsqlnet.ora
# sqlnet.ora Network Configuration File: #C:apporacleproduct12.1.0dbhome_1
etworkadminsqlnet.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:apporacleproduct12.1.0dbhome_1
etworkadmin nsnames.ora
# tnsnames.ora Network Configuration File: C:apporacleproduct12.1.0dbhome_1
etworkadmin nsnames.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:apporacleproduct12.1.0dbhome_1
etworkadminlistener.ora
# listener.ora Network Configuration File: c:apporacleproduct12.1.0dbhome_1
etworkadminlistener.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:apporacleproduct12.1.0dbhome_1)
)
(SID_DESC =
(GLOBAL_DBNAME = PtestDEV)
(SID_NAME = testUAT)
(ORACLE_HOME = C:apporacleproduct12.1.0dbhome_1)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:apporacleproduct12.1.0dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:apporacleproduct12.1.0dbhome_1inoraclr12.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>