su - oracle
vim .bashrc
exportORACLE_HOME=/opt/oracle/product/21c/dbhomeXE
exportORACLE_SID=XE
exportCHARSET=AL32UTF8
exportPATH=$PATH:$ORACLE_HOME/bin
source .bashrc
连接数据库
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Thu Oct 521:19:33 2023
Version 21.3.0.0.0
Copyright (c)1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
查询数据库信息
SQL> col name for a30
SQL>select con_id,name,open_mode from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 XEPDB1 READ WRITE