一个Oracle Application Container的示例

2023-12-13 03:39:51

本例基本涵盖了Oracle Multitenant功能中application container的以下内容:

  • 创建application container/root
  • 创建application PDB
  • 创建application SEED
  • 在application root中安装application
  • 在application root中升级application
  • 同步application

整个过程如下
创建application container/root

create pluggable database app1_root as application container
admin user admin identified by Welcome1
roles=(connect);

alter session set container=app1_root;

alter pluggable database open;

创建两个application PDB:

create pluggable database app1_pdb1 
admin user admin identified by Welcome1
roles=(connect);

alter pluggable database app1_pdb1 open;

create pluggable database app1_pdb2 
admin user admin identified by Welcome1
roles=(connect);

alter pluggable database app1_pdb2 open;

创建application SEED:

create pluggable database as seed 
admin user admin identified by Welcome1;

alter pluggable database app1_root$seed open;
alter pluggable database app1_root$seed close immediate;
alter pluggable database app1_root$seed open read only;

安装application,版本1.0:

alter session set container=app1_root;
alter pluggable database application APP1_USER_APP begin install '1.0';
create user user1 identified by Welcome1 container=all;
alter pluggable database application APP1_USER_APP end install '1.0';

两个application PDB与application root同步应用:

alter session set container=app1_pdb1;
alter pluggable database application APP1_USER_APP sync;
alter session set container=app1_pdb2;
alter pluggable database application APP1_USER_APP sync;

升级应用到2.0:

alter session set container=app1_root;
alter pluggable database application APP1_USER_APP begin upgrade '1.0' to '2.0';
grant create session to user1;
alter pluggable database application APP1_USER_APP end upgrade to '2.0';

其中一个application PDB与application root同步应用:

alter session set container=app1_pdb1;
alter pluggable database application APP1_USER_APP sync;

测试:

SQL> connect user1/Welcome1@//localhost/app1_root
Connected.
SQL> connect user1/Welcome1@//localhost/app1_pdb1
Connected.
SQL> connect user1/Welcome1@//localhost/app1_pdb2
ERROR:
ORA-01045: user USER1 lacks CREATE SESSION privilege; logon denied

可以看到,只有同步了应用的PDB具有连接权限。

参考

文章来源:https://blog.csdn.net/stevensxiao/article/details/134895282
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。