oracle19c_rac远程连接pdb配置

1、在oracle用户,添加如下内容
vim /opt/oracle/app/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan80)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

pdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan80)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1)
)

XPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan80)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XPDB)


2、监听在grid用户,添加如下内容
vim /opt/oracle/app/19c/grid/network/admin/listener.ora

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /opt/oracle/app/oracle/product/19c/dbhome_1)
(SID_NAME = orcl1)
)

(SID_DESC =
(GLOBAL_DBNAME = PDB1)
(SID_NAME = PDB1)
)

(SID_DESC =
(GLOBAL_DBNAME = XPDB)
(SID_NAME = XPDB)
)
)

3、重启监听

lsnrctl stop
lsnrctl start

4、远程连接

sqlplus pdb1admin/pdb1admin@192.168.1.80:1521/pdb1



无法创建PDB,cdb这一项查到为NO,应该为YES(界面选择创建一个空的容器数据库).

select cdb from v$database; CDB — YES

创建PDB:

create pluggable database pdb1 admin user pdb1admin identified by pdb1admin;

CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb1_admin IDENTIFIED BY pdb1_admin
file_name_convert=(’/opt/oracle/oradata/ORA19C/pdbseed/’,’/opt/oracle/oradata/ORA19C/pdb1/’);

连接:

sqlplus pdb1_admin/pdb1_admin@192.168.1.123:1521/pdb1

sqlplus /nolog
conn / as sysdba
 
CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdb1_admin IDENTIFIED BY pdb1_admin ROLES=(DBA) \
    DEFAULT TABLESPACE USERS DATAFILE '/opt/oracle/oradata/ORA19C/pdb1/users01.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M LOGGING \
    FILE_NAME_CONVERT=('/opt/oracle/oradata/ORA19C/pdbseed/sysaux01.dbf','/opt/oracle/oradata/ORA19C/pdbseed/sysaux01.dbf', \
        '/opt/oracle/oradata/ORA19C/pdbseed/system01.dbf','/opt/oracle/oradata/ORA19C/pdb1/system01.dbf',\
        '/opt/oracle/oradata/ORA19C/pdbseed/undotbs01.dbf','/opt/oracle/oradata/ORA19C/pdb1/undotbs01.dbf',\
        '/opt/oracle/oradata/ORA19C/pdbseed/temp012020-06-22_15-50-04-339-PM.dbf','/opt/oracle/oradata/ORA19C/pdb1/temp01.dbf');
 
ALTER PLUGGABLE DATABASE pdb1 OPEN;
 
exit;

oracle pdb其他命令

查看容器:

show con_name
select name from v$containers ;
SELECT SYS_CONTEXT(‘USERENV’,‘CON_NAME’) FROM dual;
show pdbs ;
SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
/---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
4 XPDB READ WRITE NO
5 PDB0 MOUNTED

打开pdb:

SQL> alter pluggable database pdb1 open;

Pluggable database altered.

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
/---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 XPDB READ WRITE NO
5 PDB0 MOUNTED

关闭pdb:

SQL> alter pluggable database XPDB close;

Pluggable database altered.

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
/---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 XPDB MOUNTED
5 PDB0 MOUNTED

切换容器:

SQL>alter session set container=XPDB;
SQL>startup

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一生要强的Zz

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值