oracle常用查看命令
阅读原文时间:2023年07月08日阅读:2

select sum(bytes/1024/1024/1024) from dba_segments;   #注:查看表空间大小,除以3个1024后的大小为GB

du instance_name(实例名);  查看实际数据库大小

SQL> show parameter db_recover

NAME TYPE VALUE


db_recovery_file_dest string +RECOC1
db_recovery_file_dest_size big integer 10T

SQL> select sum(bytes/1024/1024/1024/1024) from dba_segments;

SUM(BYTES/1024/1024/1024/1024)

        1.66453058

SQL>
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +RECOC1
Oldest online log sequence 40718
Next log sequence to archive 40722
Current log sequence 40722
SQL>
SQL> host
[oracle@dm02dbadm01 ~]$
[oracle@dm02dbadm01 ~]$ exit
exit

SQL>
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.0.0
[oracle@dm02dbadm01 ~]$ exit
logout
[root@dm02dbadm01 RMAN]#
[root@dm02dbadm01 RMAN]# su - grid
Last login: Wed Oct 26 13:26:37 CST 2022
Last login: Wed Oct 26 13:41:55 CST 2022 on pts/0
[grid@dm02dbadm01 ~]$ asmcmd
ASMCMD>
ASMCMD> lsdg
State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED HIGH N 512 512 4096 4194304 242122752 199969776 36318412 54550454 0 Y DATAC1/
MOUNTED HIGH N 512 512 4096 4194304 60566688 27841164 9085003 6252053 0 N RECOC1/
ASMCMD> cd datac1
ASMCMD> ls
ASM/
CDB1DB1/
CWDB/
CWDBEXA/
Cluster-c1/
DB_UNKNOWN/
JQDB/
orapwasm
orapwasm_backup
ASMCMD>
ASMCMD> du CWDB
Used_MB Mirror_used_MB
2697028 8091084
ASMCMD> exit
[grid@dm02dbadm01 ~]$ exit

select * from v$recovery_file_dest;     #查看归档日志大小及使用情况

alter system set recovery_file_dest_size=50G #设置归档日志大小

select instance_name from v$database;   #查看实例名

select cdb from v$database;  #查看是否开启cdb

select tablespace_name,file_name,table_id from dba_data_files order by file_id;  #查看数据库文件

select name from v$ datafile;   #查看数据文件