当前位置:网站首页>Login and connect CDB and PDB
Login and connect CDB and PDB
2022-07-05 18:05:00 【User 8006012】
[email protected]> select name from v$datafile;
NAME
------------------------------------------------------------------------------------------------------------------------
/oradata/ORCL/system01.dbf
/oradata/ORCL/sysaux01.dbf
/oradata/ORCL/undotbs01.dbf
/oradata/ORCL/pdbseed/system01.dbf
/oradata/ORCL/pdbseed/sysaux01.dbf
/oradata/ORCL/users01.dbf
/oradata/ORCL/pdbseed/undotbs01.dbf
7 rows selected.
[email protected]> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
[email protected]>
1 Connect CDB and PDB
1.1 Set up ORACLE_SID
To configure ORACLE_SID, Use OS Verify connection cdb1
[[email protected]:/home/oracle]$ export ORACLE_SID=cdb1
[[email protected]:/home/oracle]$ echo $ORACLE_SID
1.2 Connect to the multi tenant database cdb1
Set up ORACLE_SID After the environment variable , Use it directly sqlplus Local operating system authentication login
[[email protected]:/home/oracle]$ sqlplus / as sysdba
dbca After the establishment of the database , tnsnames.ora Has been added to ORCL
[[email protected]:/home/oracle]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19.3.0/db/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = orcl19C)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = orcl19C)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Use tnsnames Service name login
[[email protected]:/home/oracle]$ sqlplus sys/[email protected] as sysdba
1.3 Check whether the database is a multi tenant database
[email protected]> select name,cdb from v$database;
NAME CDB
--------- ---
ORCL YES
1.4 View the currently connected container
[email protected]> show con_name
CON_NAME
------------------------------
CDB$ROOT
[email protected]> show con_id
CON_ID
------------------------------
1
1.5 View pluggable database pdb state
[email protected]> select name,con_id,open_mode from v$pdbs;
NAME CON_ID OPEN_MODE
------------------------------ ---------- ----------
PDB$SEED 2 READ ONLY
[email protected]> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
1.6 Connect to pluggable database pdb
Method 1 :alter session set container
[email protected]> alter session set container=pdb1;
[email protected]> show con_name
Method 2 : Use the service name to connect
see pdb1 service name
[email protected]> select name,con_id from v$services;
ezconnect The way
Use ezconnect The way , Specify the hostname explicitly (ip Address )、 Port number 、 service name
[[email protected] ~]$ sqlplus sys/[email protected]:1521/pdb1 as sysdba
To configure tnsnames.ora increase pdb1
Write client network configuration file tnsnames.ora, increase pdb1 Configuration of
[[email protected] ~]$ cd $ORACLE_HOME/network/admin
[[email protected] admin]$ vi tnsnames.ora
pdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = orcl19C)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
sqlplus Connect through the service name pdb1
[[email protected] ~]$ sqlplus sys/[email protected] as sysdba
[email protected]> show con_name
[email protected]> show pdbs
cdb Use connect Command switch to pdb
View current container
[email protected]> show pdbs
sqlplus Use in connect The command switches directly to pdb1
[email protected]> conn sys/[email protected] as sysdba
[email protected]> show pdbs
1.7 pdb Switch back to the cdb
1.7.1 Method 1 :alter session set container
[email protected]> alter session set container=cdb$root;
[email protected]> show pdbs
It is recommended to switch or connect through the service name
[email protected]> conn sys/[email protected] as sysdba
边栏推荐
- 热通孔的有效放置如何改善PCB设计中的热管理?
- Introduction to VC programming on "suggestions collection"
- Record a case of using WinDbg to analyze memory "leakage"
- 小白入门NAS—快速搭建私有云教程系列(一)[通俗易懂]
- How to improve the thermal management in PCB design with the effective placement of thermal through holes?
- About Estimation with Cross-Validation
- Matlab reference
- 第十一届中国云计算标准和应用大会 | 云计算国家标准及白皮书系列发布 华云数据全面参与编制
- RSE2020/云检测:基于弱监督深度学习的高分辨率遥感图像精确云检测
- Mask wearing detection based on yolov3
猜你喜欢
Record a case of using WinDbg to analyze memory "leakage"
星环科技数据安全管理平台 Defensor重磅发布
第十一届中国云计算标准和应用大会 | 华云数据成为全国信标委云计算标准工作组云迁移专题组副组长单位副组长单位
Thesis reading_ Medical NLP model_ EMBERT
Sophon KG升级3.1:打破数据间壁垒,解放企业生产力
Memory management chapter of Kobayashi coding
Cmake tutorial Step2 (add Library)
JVM third talk -- JVM performance tuning practice and high-frequency interview question record
[JMeter] advanced writing method of JMeter script: all variables, parameters (parameters can be configured by Jenkins), functions, etc. in the interface automation script realize the complete business
Why is all (()) true and any (()) false?
随机推荐
Sophon kg upgrade 3.1: break down barriers between data and liberate enterprise productivity
[BeanShell] there are many ways to write data locally
华夏基金:基金行业数字化转型实践成果分享
Simulate the hundred prisoner problem
《2022中国信创生态市场研究及选型评估报告》发布 华云数据入选信创IT基础设施主流厂商!
Size_ T is unsigned
LeetCode笔记:Weekly Contest 300
Unicode processing in response of flash interface
Configure pytorch environment in Anaconda - win10 system (small white packet meeting)
2022新版PMP考试有哪些变化?
mybash
集群部署如何解决海量视频接入与大并发需求?
登录连接 CDB 和 PDB
U-Net: Convolutional Networks for Biomedical Images Segmentation
matlab内建函数怎么不同颜色,matlab分段函数不同颜色绘图
小白入门NAS—快速搭建私有云教程系列(一)[通俗易懂]
神经网络自我认知模型
Image classification, just look at me!
第十一届中国云计算标准和应用大会 | 云计算国家标准及白皮书系列发布 华云数据全面参与编制
Huaxia Fund: sharing of practical achievements of digital transformation in the fund industry