【Oracle】使用字典表获取一些数据库的基础信息
1.获得数据库名,创建日期等。
SQL:
select name,created,log_mode,open_mode from v$database;
执行:
SQL> select name,created,log_mode,open_mode from v$database; NAME CREATED LOG_MODE ------------------ -------------- ------------------------ OPEN_MODE ---------------------------------------- ORCL 12-8月 -22 NOARCHIVELOG READ WRITE
2.获得主机名、实例名、版本号
SQL:
select host_name,instance_name,version from v$instance;
执行:
SQL> select host_name,instance_name,version from v$instance; HOST_NAME -------------------------------------------------------------------------------- INSTANCE_NAME VERSION -------------------------------- ---------------------------------- DESKTOP-ID262L5 orcl 19.0.0.0.0
3.获得刚进入Sqlplus时显示的版本信息:
SQL:
select banner from v$version;
执行:
SQL> select banner from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
4.查系统表空间信息
SQL:
select file_id,file_name,tablespace_name,bytes/1024/1024 from dba_data_files
SQL> select file_id,file_name,tablespace_name,bytes/1024/1024 from dba_data_files; FILE_ID FILE_NAME TABLESPACE_NAME BYTES/1024/1024 ---------- ------------------------------ -------------------- --------------- 7 C:\ORACLE19C\ORADATA\ORCL\USER USERS 5 S01.DBF 4 C:\ORACLE19C\ORADATA\ORCL\UNDO UNDOTBS1 65 TBS01.DBF 1 C:\ORACLE19C\ORADATA\ORCL\SYST SYSTEM 900 EM01.DBF 3 C:\ORACLE19C\ORADATA\ORCL\SYSA SYSAUX 600 UX01.DBF
END