You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -642,53 +677,87 @@ ALTER USER brian IDENTIFIED BY brianpassword;
642
677
```
643
678
644
679
### 查看表空间的名称以及大小
680
+
<!--rehype:wrap-class=col-span-2-->
681
+
645
682
```sql
646
-
selectt.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size from dba_tablespaces t, dba_data_files d wheret.tablespace_name=d.tablespace_namegroup byt.tablespace_name;
683
+
SELECTt.table_name,
684
+
ROUND(SUM(bytes / (1024*1024)), 0) AS ts_size
685
+
FROM dba_tablespaces t,
686
+
dba_data_files d
687
+
WHEREt.table_name=d.table_name
688
+
GROUP BYt.table_name;
647
689
```
648
690
649
691
### 查看还没提交的事务
692
+
650
693
```sql
651
694
select*from v$locked_object;
652
695
select*from v$transaction;
653
696
```
654
697
655
698
### 查看数据库库对象
699
+
<!--rehype:wrap-class=col-span-2-->
700
+
656
701
```sql
657
-
select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, OJIB status;
702
+
SELECT owner, object_type, status, COUNT(*) AS count#
703
+
FROM all_objects
704
+
GROUP BY owner, object_type, status;
658
705
```
659
706
660
707
### 查看数据库的版本
708
+
661
709
```sql
662
-
Select version FROM Product_component_version where SUBSTR(PRODUCT,1,6) ='Oracle';
710
+
SELECT version
711
+
FROM Product_component_version
712
+
WHERE SUBSTR(PRODUCT, 1, 6) ='Oracle';
663
713
```
664
714
665
715
### 查看数据库的创建日期和归档方式
716
+
666
717
```sql
667
-
select created, Log_Mode, Log_Mode From v$Database;
718
+
SELECT created, Log_Mode, Log_Mode
719
+
FROM v$Database;
668
720
```
669
721
670
722
### 查看控制文件
723
+
671
724
```sql
672
725
select name from v$controlfile;
673
726
```
674
727
675
728
### 查看日志文件
729
+
676
730
```sql
677
731
select member from v$logfile;
678
732
```
679
733
680
734
### 查看表空间的使用情況
735
+
<!--rehype:wrap-class=col-span-2-->
736
+
681
737
```sql
682
-
selectsum (bytes)/(1024*1024) as free_space, tablespace_name from dba_free_space group by tablespace_name;
738
+
SELECTSUM(bytes)/(1024*1024) AS free_space,
739
+
tablespace_name
740
+
FROM dba_free_space
741
+
GROUP BY tablespace_name;
683
742
```
684
743
685
744
### 捕捉运行很久的SOL
686
-
```sql
687
-
column username format a12
688
-
column opname format a16
689
-
column progress format a8
690
745
691
-
select username,sid,opname,round(sofar*100/ totalwork,0) ||'%'as progress,time_remaining,sqL_text from v$session_longops,v$sql where time_remaining <>0and sql_address = address and sql_hash_value = hash_value
0 commit comments