Oracle 运维篇+应用容器数据库的install、upgrade、patch、uninstall

★ 知识点
※ DEFAULT_SHARING参数的取值

  • METADATA: 元数据链接共享数据库对象的元数据,但其数据对于每个容器是唯一的。这些数据库对象被称为元数据链接的应用程序公共对象。此设置为默认设置。
  • DATA: 数据链接共享数据库对象,其数据对于应用程序容器中的所有容器都是相同的。它的数据只存储在应用程序根目录中。这些数据库对象称为数据链接应用程序公共对象.
  • EXTENDED DATA: 扩展数据链接共享数据库对象,其在应用程序根目录中的数据对于应用程序容器中的所有容器都是相同的。但是,应用程序容器中的每个应用程序PDB都可以存储该应用程序PDB独有的数据。对于这种类型的数据库对象,数据存储在应用程序根目录中,也可选地存储在每个应用程序PDB中。这些数据库对象被称为扩展数据链接应用程序公共对象.
  • NONE: 不共享数据库对象

✔ 安装
alter session set container=APP1_ROOT;
alter system set default_sharing='METADATA' scope=both;
alter pluggable database application app1_root begin install '1';
drop   user zzt_pub cascade;
create user zzt_pub identified by zzt;
grant  dba,unlimited tablespace to zzt_pub;
create table zzt_pub.t(id int,name varchar2(9));
alter pluggable database application app1_root end install '1';
insert into  zzt_pub.t values(1,'a');
commit;
--将应用容器中的Application Release同步到应用PDB中
alter session set container=APP1_pdb1;
alter pluggable database application all sync;
select * from zzt_pub.t;
alter session set container=APP1_pdb2;
alter pluggable database application all sync;
select * from zzt_pub.t;
alter session set container=APP1_ROOT;
select * from zzt_pub.t;


✔ 升级
--版本 1 to 2
alter session set container=app1_root;
alter system set default_sharing='METADATA' scope=both;
alter pluggable database application app1_root begin upgrade '1' to '2';
alter table zzt_pub.t add(ver int);
update zzt_pub.t set ver=1;
commit;
alter pluggable database application app1_root end upgrade to '2';
--版本 2 to 3
alter session set container=app1_root;
alter system set default_sharing='METADATA' scope=both;
alter pluggable database application app1_root begin upgrade '2' to '3';
alter table zzt_pub.t add(country varchar2(9));
update zzt_pub.t set country='china';
commit;
alter pluggable database application app1_root end upgrade to '3';
--将应用容器中的版本同步到应用pdb中
alter session set container=app1_root;
select * from zzt_pub.t;
alter session set container=app1_pdb1;
alter pluggable database application app1_root sync to '2';
select * from zzt_pub.t;
alter session set container=app1_pdb2;
alter pluggable database application app1_root sync to '3';
select * from zzt_pub.t;


✔ 打补丁
--给2打补丁
alter session set container=APP1_ROOT;
alter system set default_sharing='METADATA' scope=both;
alter pluggable database application app1_root begin patch 222 minimum version '2';
update zzt_pub.t set ver=2;
commit;
alter pluggable database application app1_root end patch 222;
--给3打补丁
alter session set container=APP1_ROOT;
alter system set default_sharing='METADATA' scope=both;
alter pluggable database application app1_root begin patch 333 minimum version '3';
update zzt_pub.t set ver=3;
commit;
alter pluggable database application app1_root end patch 333;
--同步
alter session set container=app1_root;
select * from zzt_pub.t;
alter session set container=app1_pdb1;
alter pluggable database application app1_root sync to patch 222;
select * from zzt_pub.t;
alter session set container=app1_pdb2;
alter pluggable database application app1_root sync to patch 333;
select * from zzt_pub.t;


✔ 卸载
alter session set container=app1_root;
alter system set default_sharing='METADATA' scope=both;
alter pluggable database application app1_root begin uninstall;
drop  user zzt_pub cascade;
alter pluggable database application app1_root end uninstall;
--同步
alter session set container=app1_pdb1;
alter pluggable database application app1_root sync;
alter session set container=app1_pdb2;
alter pluggable database application app1_root sync;
--删除application root
alter session set container=cdb$root;
alter  pluggable database APP1_ROOT close;
drop   pluggable database APP1_PDB1 including datafiles;
drop   pluggable database APP1_PDB2 including datafiles;
drop   pluggable database APP1_ROOT including datafiles;
--查验application root clone是否被删除
alter session set container=cdb$root;
show pdbs;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值