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 configured , for eg to add a tns entry for pluggable database PDB_OMF_1
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 :
SYS@mfarag-oel/PDB_OMF_1>CONN A/A@mfarag-oel/PDB_OMF_1
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
set sqlprompt "_USER'@'_CONNECT_IDENTIFIER'>'"
2.Always use OMF pluggable Database when the Container is Pluggable :
SYS@CDB>create pluggable database pdbomf admin user a identified by a ;
CREATE PLUGGABLE DATABASE pdb2 ADMIN USER pdb_adm IDENTIFIED BY Password1 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdbseed/','/u01/app/oracle/oradata/cdb1/pdb2/');
Please note FILE_NAME_CONVERT(filename_pattern ,replacement_filename_pattern) 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.
SYS@CDB>select CON_ID,DBID,GUID,NAME,OPEN_MODE
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
SYS@CDB>conn sys@pdb_omf_1 as sysdba
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 close immediate ;
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 :
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
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 :
$cd $ORACLE_HOME/rdbms/admin
$ 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
SQL>alter system set "_datafile_write_errors_crash_instance"=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 PDB_NAME format a20
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/
__
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;
Multitenant best Practice clone pdb seed and Clone a Pluggable Database – 12c Edition的更多相关文章
- Clone a Pluggable Database – 12c Edition
1. 1.Tnsnames when connecting to either Container or Pluggable instance The tnsnames.ora should be c ...
- Oracle Multitenant Environment (五) Create PDB
Creating and Removing PDBs with SQL*Plus This chapter contains the following topics: About Creating ...
- Clone PDB from same CDB
Clone PDB 用途: 1.用于测试,从生产系统clone数据来进行测试 2.诊断性能问题 Clone PDB Using OMF from same CDB 环境信息: DB Version ...
- 12C CLONE PDB and config service_listener
Clone PDB PtestDEV to Ptestuat in testuat 1) Clone PtestDEV to Ptestuat C:\Windows\system32> ...
- Oracle12c Clone PDB 的方法
1. 创建PDB的存放路径,举例: 2. 设置 数据库创建数据文件的目录 alter system set db_Create_file_dest='C:\app\Administrator\orad ...
- 深拷贝(deep clone)与浅拷贝(shallow clone)
深拷贝(deep clone)与浅拷贝(shallow clone) 浅复制(浅克隆):被复制对象的所有变量都含有与原来的对象相同的值,而所有的对其他对象的引用仍然指向原来的对象.换言之,浅复制仅仅复 ...
- git clone 和 download 不一样,能用git clone 就用git clone,download的代码,经常出现安装bug
git clone 和 download 不一样,能用git clone 就用git clone,download的代码,经常出现安装bug
- oracle12c新特点之可插拔数据库(Pluggable Database,PDB)
1. 12c PDB新特点的优势 1) 可以把多个PDB集成进一个平台. 2) 可以快速提供一个新的PDB或一个已有PDB的克隆. 3) 通过拔插技术,可以快速把存在的数据库重 ...
- [翻译] Oracle Database 12c 新特性Multitenant
译自官方白皮书http://www.oracle.com/technetwork/database/plug-into-cloud-wp-12c-1896100.pdf,包含新的云计算相关技术的介绍. ...
随机推荐
- Android与设计模式——代理(Proxy)模式
在阎宏博士的<JAVA与模式>一书中开头是这样描写叙述代理(Proxy)模式的: 代理模式是对象的结构模式.代理模式给某一个对象提供一个代理对象,并由代理对象控制对原对象的引用. 代理模式 ...
- SQL2012 尝试读取或写入受保护的内存。这通常指示其它内存已损坏
今天打开SQL2012,突然就连接不了数据库.一開始还以为是某个server崩溃了.结果试了好几个.都还是如此,弹出提演示样例如以下: 尝试读取或写入受保护的内存.这通常仅仅是其它内存已损坏.(Sys ...
- js和jquery实现回到顶层
js <!DOCTYPE html> <html> <head> <title>返回顶部</title> <style> bod ...
- RSA私钥加密公钥解密、各种密钥格式转换
此随笔解决RSA加解密相关的3个问题,详情可以查看源码. 1.公钥加密.私钥解密2.各种格式RSA密钥之间的转换3.不限制加密原文的长度
- break return continue
1.return 语句的作用 (1) return 从当前的方法中退出,返回到该调用的方法的语句处,继续执行 (2) return 返回一个值给调用该方法的语句,返回值的数据类型必须与方法的声明中的返 ...
- web 界面设计---大道至简
http://www.cnblogs.com/coder2012/p/4023442.html 一个非常精简的webpy页面博客 qing.weibo.com 新浪的轻微博也不错精简
- oracle 12c的数据库导进 11g
从oracle 12c 备份(expdp)出来的包,还原到11g里,想想都知道会有兼容性问题. 果不其然,报错了: ORA-39142: 版本号 4.1 (在转储文件 "叉叉叉.expdp& ...
- jquery中的工具函数 Utilities
noConflict(deep) 释放$和Jquery的控制权 isFunction(obj) isArray(obj) isWindow(obj) isNumeric(obj) type(obj) ...
- PHPExcel使用收藏
注意:PHP7版本中phpexcel导出文件是提示找不到文件,需修改PHPExcel目录下的calculation目录下的Functions.php的581行 去掉break; 下面是总结的几个使用 ...
- BZOJ3282:Tree(TCL基础题)
给定N个点以及每个点的权值,要你处理接下来的M个操作. 操作有4种.操作从0到3编号.点从1到N编号. 0:后接两个整数(x,y),代表询问从x到y的路径上的点的权值的xor和. 保证x到y是联通的. ...