当前位置:网站首页>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_SID1.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 sysdbadbca 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 sysdba1.3 Check whether the database is a multi tenant database
[email protected]> select name,cdb from v$database;
NAME CDB
--------- ---
ORCL YES1.4 View the currently connected container
[email protected]> show con_name
CON_NAME
------------------------------
CDB$ROOT
[email protected]> show con_id
CON_ID
------------------------------
11.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 NO1.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 pdbs1.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边栏推荐
- Star ring technology data security management platform defender heavy release
- Use of print function in MATLAB
- Image classification, just look at me!
- 较文心损失一点点性能提升很多
- Sophon CE Community Edition is online, and free get is a lightweight, easy-to-use, efficient and intelligent data analysis tool
- 星环科技重磅推出数据要素流通平台Transwarp Navier,助力企业实现隐私保护下的数据安全流通与协作
- 星环科技数据安全管理平台 Defensor重磅发布
- EPM related
- 消除`if()else{ }`写法
- 含重复元素取不重复子集[如何取子集?如何去重?]
猜你喜欢

Ten top automation and orchestration tools

nano的CAN通信

Elk log analysis system

Career advancement Guide: recommended books for people in big factories

神经网络自我认知模型

“12306” 的架构到底有多牛逼?

Can communication of nano

U-Net: Convolutional Networks for Biomedical Images Segmentation

Configure pytorch environment in Anaconda - win10 system (small white packet meeting)

Leetcode daily question: the first unique character in the string
随机推荐
How can cluster deployment solve the needs of massive video access and large concurrency?
ISPRS2020/云检测:Transferring deep learning models for cloud detection between Landsat-8 and Proba-V
Sophon Base 3.1 推出MLOps功能,为企业AI能力运营插上翅膀
Cmake tutorial Step4 (installation and testing)
ELK日志分析系统
从类生成XML架构
Easynmon Usage Summary
小林coding的内存管理章节
Tencent music launched its new product "quyimai", which provides music commercial copyright authorization
Access the database and use redis as the cache of MySQL (a combination of redis and MySQL)
[paddlepaddle] paddedetection face recognition custom data set
ITK Example
Cmake tutorial step5 (add system self-test)
To solve the stubborn problem of Lake + warehouse hybrid architecture, xinghuan Technology launched an independent and controllable cloud native Lake warehouse integrated platform
Why is all (()) true and any (()) false?
修复漏洞 - mysql 、es
JVM第三话 -- JVM性能调优实战和高频面试题记录
职场进阶指南:大厂人必看书籍推荐
「运维有小邓」用于云应用程序的单点登录解决方案
Leetcode daily question: merge two ordered arrays