重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1137|回复: 0
打印 上一主题 下一主题

[Oracle] oracle 19c连接pdb的2种方式

[复制链接]
跳转到指定楼层
楼主
发表于 2023-12-13 15:23:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
db:19.3
os:CentOS Linux release 7.8.2003 (Core)

1、tnsname
[oracle@sztech ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 13 15:02:53 2023
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL>  show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         5 ORCL                           READ WRITE NO

SQL> alter system register;
System altered.

[oracle@sztech ~]$ tnsping orcl;

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 13-DEC-2023 15:14:27

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/19.3.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.133.156)(PORT = 5500)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (0 msec)

[oracle@sztech ~]$ sqlplus system/oracle@orcl

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 13 15:16:19 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show con_name;

CON_NAME
------------------------------
ORCL
SQL>



2、alter session
[root@sztech ~]# su - oracle
Last login: Wed Dec 13 15:07:45 CST 2023 on pts/3
[oracle@sztech ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 13 15:22:41 2023
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show con_name;

CON_NAME
------------------------------
CDB$ROOT
SQL> alter session set container=orcl;

Session altered.

SQL>  show con_name;

CON_NAME
------------------------------
ORCL
SQL>


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-1 08:35 , Processed in 0.093661 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表