Clone a Pluggable Database – 12c Edition
1.
1.Tnsnames when connecting to either Container or Pluggable instance
The tnsnames.ora should be configured , for eg to add a tns entry for pluggable database PDB_OMF_1
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = MFarag-OEL)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pdb_omf_1)
)
)
Alternatively the easy connect syntax could be used as follow :
Connected.
A@mfarag-oel/PDB_OMF_1>conn xx/xx@mfarag-oel/XX
Connected.
XX@mfarag-oel/XX>
Add the following entry to the glogin.sql script under $ORACLE_HOME/sqlplus/admin
2.Always use OMF pluggable Database when the Container is Pluggable :
pdb_adm IDENTIFIED BY Password1
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdbseed/','/u01/app/oracle/oradata/cdb1/pdb2/');
clause is required if you are not using OMF. If you omit this clause,
then the database first attempts to use Oracle Managed Files to generate
file names. If you are not using Oracle Managed Files, then the
database uses the PDB_FILE_NAME_CONVERT initialization parameter to
generate file names. If this parameter is not set, then an error occurs.
from V_$CONTAINERS ;
CON_ID DBID GUID
---------- ---------- --------------------------------
NAME OPEN_MODE
------------------------------ ----------
1 1949193435 DD7C48AA5A4504A2E04325AAE80A403C
CDB$ROOT READ WRITE
2 4075234582 EC25D0EC10347332E043CC8DAB0A7AE1
PDB$SEED READ ONLY
3 3255612964 EC25E0FB670B76A8E043CC8DAB0A08D8
PDB READ WRITE
CON_ID DBID GUID
---------- ---------- --------------------------------
NAME OPEN_MODE
------------------------------ ----------
4 3244820336 EC276A999A790163E043CC8DAB0AD357
PDBOMF MOUNTED
.
.
SYS@CDB>alter session set container=pdbomf ;
Session altered.
SYS@CDB>alter pluggable database open ;
Pluggable database altered.
3.Open the Pluggable Database in Restricted mode before Renaming it
Enter password:
Connected.
SYS@pdb_omf_1>alter pluggable database close ;
SYS@pdb_omf_1>alter pluggable database open restricted;
SYS@pdb_omf_1>alter pluggable database pdbomf rename global_name to pdb_omf_1 ;
4.unplug and Plug a Database :
SYS@CDB1>alter pluggable database y unplug into '/home/oracle/XDESC.xml' ;
SYS@CDB1>drop pluggable database y ;
SYS@CDB1>create pluggable database y using '/home/oracle/XDESC.xml' nocopy ;
5. startup the Pluggable database in single step :
from V$containers;
CON_ID GUID NAME
---------- -------------------------------- ------------------------------
OPEN_MODE
----------
1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT
READ WRITE
2 EC25D0EC10347332E043CC8DAB0A7AE1 PDB$SEED
READ ONLY
3 EC2B4C003E221F09E0438636AF0AA57B X
MOUNTED
CON_ID GUID NAME
---------- -------------------------------- ------------------------------
OPEN_MODE
----------
4 EC276A999A790163E043CC8DAB0AD357 PDB_OMF_1
MOUNTED
SYS@CDB>alter pluggable database all open ;
SYS@CDB>select CON_ID,GUID,NAME,OPEN_MODE
from V$containers
CON_ID GUID NAME
---------- -------------------------------- ------------------------------
OPEN_MODE
----------
1 DD7C48AA5A4504A2E04325AAE80A403C CDB$ROOT
READ WRITE
2 EC25D0EC10347332E043CC8DAB0A7AE1 PDB$SEED
READ ONLY
3 EC2B4C003E221F09E0438636AF0AA57B X
READ WRITE
CON_ID GUID NAME
---------- -------------------------------- ------------------------------
OPEN_MODE
----------
4 EC276A999A790163E043CC8DAB0AD357 PDB_OMF_1
READ WRITE
Note : the startup of the Container CDB will place all the pdb in mount status by Defualt
6.Use catcon perl script to run scripts for selective or all pluggable and container database :
E.g Run the awrinfo script to have information about the awr usage under sysaux for all the databases :
$ perl catcon.pl -u SYS -U SYS -d $ORACLE_HOME/rdbms/admin -l '/home/oracle' -b catblock_output awrinfo.sql
--Confirm that the script run against all the databases :
$cd /home/oracle
$ grep -i "CURRENT CONTAINER" *
catblock_output0.log:==== Current Container = CDB$ROOT ====
catblock_output0.log:==== Current Container = PDB$SEED ====
catblock_output1.log:==== Current Container = XX ====
catblock_output2.log:==== Current Container = PDB_OMF_1 ====
Note : use the -c option tpo specify certain databases to have this script run against
7.How to use non-seed template to create CDB + Pluggable database :
dbca -silent -createDatabase -templateName Custom_DB_.dbt -gdbName FOFO
-sid FOFO -createAsContainerDatabase true -numberOfPDBs 1 -pdbName
pdb_silent -sysPassword <password> -systemPassword
<password> -listeners listener
Enter PDBADMIN
Note
: the above command used the non-seed Custome_DB_ template to create
CDB names FOFO with a PDB database named pdb_silent in silent mode .
8. Modify the Value "_datafile_write_errors_crash_instance" to be FALSE
**This
has to be set at CDB level. This is to allow the Container CDB to
continue running if one of its Pdb lost one of the datafiles for any
reason
NOTE:This is only Valid for the non system datafiles for the pdb container .
9.How To check if a parameter have been modified within the PDB?
SYS@CDB>column NAME format a20
SYS@CDB>column VALUE$ format a20
SYS@CDB>select p.PDB_NAME,s.name,s.value$
from cdb_pdbs p , pdb_spfile$ s
where p.CON_UID=s.PDB_UID
PDB_NAME NAME VALUE$
-------------------- -------------------- --------------------
XX cursor_sharing 'SIMILAR'
YY_NEW cursor_sharing 'SIMILAR'
**Note This could never be checked for non default pdb init parameters valunes using alertlog .
2. Clone a Pluggable Database – 12c Edition
With the introduction of Pluggable Databases in Oracle Database 12c, there is going to be questions on how to clone a pluggable database (PDB) either from the seed PDB or an existing PDB. In the testing that I have done both in the beta program and with the general release creating a clone is fairly simple depending on the settings of your database. The simplest way is using Oracle Managed Fils (OMF).
Using OMF, all we need to do is specify the PDB name that we want to create.
CREATE PLUGGABLE DATABASE pdb2 FROM pdb1;
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
PATH_PREFIX = '/oracle/app/oradata'
FILE_NAME_CONVERT = ('/oracle/app/oradata/ora12c/pdb1', '/oracle/app/oradata/ora12c/pdb2');
You will notice the difference in the syntax is that we needed to add PATH_PREFIX and FILE_NAME_CONVERT to the CREATE PLUGGABLE DATABASE sql. The PATH_PREFIX option is used to ensure that all relative directory object paths and relative paths contain certain initialization parameters associated with the PDB are treated as relative to the specified directory or subdirectories. The FILE_NAME_CONVERT option is used to specify the target location of the files based on the file locations of the source.
There are multiple ways of performing the SQL commands above. Oracle has done a very good job at enabling their tools to perform the tasks of cloning a PDB. Cloning can be done from the SQL*Plus prompt (above commands), Oracle Enterprise Manager 12c Cloud Control and SQLDeveloper. I encourage you to give it a go; I’m positive you will like provisioning a database in under two (2) minutes*!
Enjoy!
https://dbasolved.com/2013/07/01/clone-a-pluggable-database-12c-edition/
__
more inof ref http://www.cnblogs.com/feiyun8616/p/6223045.html
D:\dba\change\env>sqlplus sys/oracle123@testuat12c as sysdba
CREATE PLUGGABLE DATABASE PtestDEV FROM PtestUAT;
SQL> select con_id,name, OPEN_MODE from v$pdbs;
CON_ID NAME
---------- ----------------------------------------------------------
OPEN_MODE
--------------------
2 PDB$SEED
READ ONLY
3 PtestUAT
READ WRITE
4 PtestDEV
MOUNTED
alter pluggable database PtestDEV close;
alter pluggable database PtestDEV open read write;
tips
CONTAINERS
1.view 当前登陆的container. login in no system user. give
http://www.linuxidc.com/Linux/2015-01/111928.htm
SQL> select con_id,name from v$CONTAINERS;
CON_ID NAME
---------- ------------------------------------------------------------
3 PIVRSUAT
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL>
Clone a Pluggable Database – 12c Edition的更多相关文章
- 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 ...
- RMAN RECOVER TABLE 功能是 Oracle Database 12c 的新增功能 (Doc ID 1521524.1)
RMAN RECOVER TABLE Feature New to Oracle Database 12c (Doc ID 1521524.1) APPLIES TO: Oracle Database ...
- Windows下安装Oracle Database 12c Release 1(12.1.0.2.0) - Enterprise Edition
Windows下安装Oracle Database 12c Release 1(12.1.0.2.0) 最近因需要在Oracle 数据库上建立ODI的资料档案库,需要安装Oracle Database ...
- Oracle Database 12c 新特性 - Pluggable Database
在Oracle Database 12c中,可组装式数据库 - Pluggable Database为云计算而生.在12c以前,Oracle数据库是通过Schema来进行用户模式隔离的,现在,可组装式 ...
- 转: Windows下安装Oracle Database 12c Release 1(12.1.0.2.0) - Enterprise Edition
http://www.cnblogs.com/xqzt/p/4395053.html Windows下安装Oracle Database 12c Release 1(12.1.0.2.0) - Ent ...
- Oracle 12c: RMAN restore/recover pluggable database
查看数据库状态 运行在归档模式,可拔插数据库name=pdborcl SQL> archive log list; Database log mode Archive Mode Automati ...
- Oracle 12C pluggable database自启动
实验环境创建了两个PDB,本实验实现在开启数据库时,实现pluggable database PDB2自启动: 原始环境: SQL> shu immediateDatabase closed.D ...
- Quick and Easy Installation of Oracle Database 12c on Oracle Linux in Oracle VM VirtualBox
发贴人 Sergio-Oracle 于2018-4-18 23:10:15在Oracle Linux Introduction How Does This Work? Requirements Bef ...
- Oracle Database 12c Using duplicate standby database from active database Created Active DataGuard
primary database db_name=zwc, db_unique_name=zwc standby database db_name=zwc, db_unique_name=standb ...
随机推荐
- 谈谈java垃圾回收机制
近期看了一些关于垃圾回收机制的文章,总结一下. 垃圾回收器回收程序不在使用的对象占用的内存,也就是对象不可达,比方说对象被置为null. 要回到java的垃圾回收机制,从下面三个方面去回答: 1.哪些 ...
- ECMAScript 实现继承的几种方式
1. 原形链 function Father() { this.fatherName = "licus"; } function Children() { this.chidr ...
- lc.exe 已退出 代码为 -1
地址:http://jingyan.baidu.com/article/91f5db1bd0ace31c7f05e321.html
- 关于jquery中attr和prop的用法
在项目开发中,遇到过这个情况,做一个全选的功能,通过点击一个checkbox实现下面的checkbox全选,用attr设置的checked属性,只可以生效一次,再次点击就不起作用了,但确实触发了事件, ...
- super究竟是个啥?
引子: 一直以为oc的super跟java中的super是一回事,没有去深究它的本质,直到工作的时候遇到一个并不能按我的理解能解释的情况. 剖析: 在此之前先看一段代码: 有两个类 SuperClas ...
- maven依赖排除
单依赖过滤 同依赖过滤直接处理:可以过滤一个或者多个,如果过滤多个要写多个<exclusion>. <dependency> <groupId>org.apache ...
- 用Delphi7 调用.NET 2.0的WebService 所要注意的问题(Document格式和UTF8编码)
Delphi7 调用VS.NET 2005开发的基于.NET 2.0的WebService时发生了错误.查阅资料 http://www.community.borland.com/article/bo ...
- JAVASCRIPT技术 表达式验证
失去焦点时,调用方法: <html> <head><script type="text/javascript">function upperCa ...
- hdu1226
hdu1226 :点击打开题目链接 本题目由于题目意思,容易得知是一道广搜的题目. 首先. 我们需要知道 ,大数取模,比如 如何判断1234567 对15 取模的数为多少?答案是7,但是如果他是大数怎 ...
- SPOJ:Lexicographically Smallest(并查集&排序)
Taplu and Abhishar loved playing scrabble. One day they thought of inventing a new game using alphab ...