查看存储情况:df -h
查看seed pdb:cdb下查询dba_data_files
查看pdb数据文件存放路径:可以切换到其他pdb结合存储情况确认新建的pdb存放路径
SQL> create pluggable database pdb_test
2 admin user test identified by oracle
3 FILE_NAME_CONVERT =('/oradata/sys/pdbseed','/oradata/data01/pdb_test/')
4 default tablespace TBS_DATA datafile '/oradata/data01/pdb_test/TEST_DATA_01.dbf' size 30G autoextend off;
Pluggable database created.
统计各节点的连接数,可以只开启部分节点(连接数较少的)的pdb
查看rac节点数:gv$instance
统计连接数:
# 连接数使用率
select resource_name, trunc(current_utilization * 100 / limit_value) Result_Number
from v$resource_limit
where resource_name in ('processes');
--3号节点
SQL> select instance_number,instance_name from v$instance;
INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
3 prod3
SQL> alter pluggable database pdb_test open;
--4号节点
SQL> select instance_number,instance_name from v$instance;
INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
4 prod4
SQL> alter pluggable database pdb_test open;
SQL> alter session set container=pdb_cxrh;
Session altered.
SQL> alter tablespace TBS_DATA add datafile '/oradata/data01/pdb_test/TEST_DATA_02.dbf' size 30G autoextend off;
Tablespace altered.
SQL> alter tablespace TBS_DATA add datafile '/oradata/data01/pdb_test/TEST_DATA_03.dbf' size 30G autoextend off;
Tablespace altered.
SQL> alter database datafile '/oradata/data01/pdb_test/system01.dbf' resize 2G;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/system02.dbf' resize 2G;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/system03.dbf' resize 2G;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/system01.dbf' autoextend off;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/system02.dbf' autoextend off;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/system03.dbf' autoextend off;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/sysaux01.dbf' resize 2G;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/sysaux02.dbf' resize 2G;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/sysaux03.dbf' resize 2G;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/sysaux01.dbf' autoextend off;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/sysaux01.dbf' autoextend off;
Database altered.
SQL> alter database datafile '/oradata/data01/pdb_test/sysaux03.dbf' autoextend off;
Database altered.
SQL> alter database tempfile '/oradata/data53/pdb_cxrh/temp01.dbf' autoextend off;
Database altered.
SQL> alter database tempfile '/oradata/data53/pdb_cxrh/temp02.dbf' autoextend off;
Database altered.
SQL> alter database tempfile '/oradata/data53/pdb_cxrh/temp03.dbf' autoextend off;
Database altered.
SQL> create user test identified by oracle default tablespace TBS_DATA;
User created.
SQL> grant connect,resource to test;
Grant succeeded.
注意:oracle12c resource角色已不包括unlimited on tablespace的权限,需要额外授予
SQL> ALTER USER test quota unlimited on tbs_data;
User altered.
# 应用使用
pdb_test =
(DESCRIPTION_LIST =
(LOAD_BALANCE = off)
(FAILOVER = on)
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE=OFF)
(FAILOVER=ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.78.237.56)(PORT = 1521)) #VIP
)
(CONNECT_DATA =
(SERVICE_NAME = pdb_test)
(FAILOVER_MODE=(TYPE=session)(METHOD=basic)(RETRIES=4)(DELAY=1))
)
)
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE=OFF)
(FAILOVER=ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.78.237.58)(PORT = 1521)) #VIP
)
(CONNECT_DATA =
(SERVICE_NAME = pdb_test)
(FAILOVER_MODE=(TYPE=session)(METHOD=basic)(RETRIES=4)(DELAY=1))
)
)
)
# 个人使用
pdb_test_inst1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =10.70.98.44)(PORT = 1521)) #VIP
)
(CONNECT_DATA =
(SERVICE_NAME = pdb_test)
)
)
pdb_test_inst2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =10.70.98.50)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = pdb_test)
)
)
# 删除PDB
drop pluggable database test including datafiles
# 关闭PDB
alter pluggable database pdb_pub close;
# 开启PDB
alter pluggable database pdb_pub open;
# 切换到指定PDB
alter session set container=pdb_test;