查看oracle是否正常、表空間 (AIX)


REF

http://blog.itpub.net/23556054/viewspace-1115506/

 

===================================================================

查看 oracle 數據庫是否啟動:

一、LINUX:

1、用  ps -ef|grep ora  查看,是否有oracle的進程,linux下還可以用ipcs查看

2、查看監聽的方法

  cd /oracle/product/10.2.0/db_1/bin/
  lsnrctl status
  啟動監聽
  lsnrctl start


Message 1053 not found; No message file for product=network, facility=TNSMessage 1020 not found; No message file for product=network, facility=TNSMessage 1021 not found; No message file for product=network, facility=TNSMessage 1022 not found; No message file for product=network, facility=TNSMessage 1023 not found; No message file for product=network, facility=TNSMessage 1026 not found; No message file for product=network, facility=TNSMessage 1034 not found; No message file for product=network, facility=TNSMessage 1024 not found; No message file for product=network, facility=TNSMessage 1025 not found; No message file for product=network, facility=TNSMessage 1040 not found; No message file for product=network, facility=TNSMessage 1033 not found; No message file for product=network, facility=TNSMessage 1028 not found; No message file for product=network, facility=TNSMessage 1415 not found; No message file for product=network, facility=TNS  Message 1050 not found; No message file for product=network, facility=TNS
  Message 1050 not found; No message file for product=network, facility=TNS
Message 1029 not found; No message file for product=network, facility=TNSMessage 1411 not found; No message file for product=network, facility=TNS
  Message 1408 not found; No message file for product=network, facility=TNS
  Message 1408 not found; No message file for product=network, facility=TNS
Message 1411 not found; No message file for product=network, facility=TNS
  Message 1408 not found; No message file for product=network, facility=TNS
Message 1411 not found; No message file for product=network, facility=TNS
  Message 1408 not found; No message file for product=network, facility=TNS
Message 1052 not found; No message file for product=network, facility=TNS#

 

===================================================================

二、windows:

進到數據庫里面看數據庫當前狀態
select instance_name,status from v$instance;

如果status = open 就說明oracle服務正常。
查看監聽,執行lsnrctl  status,就可以看監聽所對應的實例。
是否有scott用戶,可以查看dba_users這個表的用戶狀態。

==================================================================

三、檢查操作系統空間使用狀態
   Linux命令:df -h或df -g
   window:查看磁盤管理器

==================================================================

四、表空間檢查

 1、select tablespace_name,sum(bytes)/1024/1024 as total_size
    from dba_data_files
    group by tablespace_name

2、select tablespace_name,sum(bytes)/1024/1024 as total_size
    from dba_free_space

    group by tablespace_name

 

查看Oracle表空間使用率

--查看數據庫表空間使用率
select total.tablespace_name,round(total.MB, 2) as Total_MB,round(total.MB - free.MB, 2) as Used_MB,round((1-free.MB / total.MB)* 100, 2) || '%' as Used_Pct
from (
select tablespace_name, sum(bytes) /1024/1024 as MB
from dba_free_space group by tablespace_name) free,
(select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_data_files group by tablespace_name) total     
where free.tablespace_name = total.tablespace_name
order by used_pct desc;

 

--查看表空間總大小、使用率、剩余空間
select a.tablespace_name, total, free, total-free as used, substr(free/total * 100, 1, 5) as "FREE%", substr((total - free)/total * 100, 1, 5) as "USED%"
from
(select tablespace_name, sum(bytes)/1024/1024 as total from dba_data_files group by tablespace_name) a,
(select tablespace_name, sum(bytes)/1024/1024 as free from dba_free_space group by tablespace_name) b
where a.tablespace_name = b.tablespace_name
order by a.tablespace_name

 

 

 

==================================================================

五、啟動過程:
sqlplus /nolog    or  (sqlplus sys/passwd as sysdba)
conn sys/password as sysdba
SQL> select status from v$instance
ORA-01034: ORACLE not available ------------shutdown
SQL> startup nomount         ------------started
SQL> alter database mount   ------------mounted
SQL> alter database open     ------------open
==================================================================

6、檢查表空間碎片
select tablespace_name, sqrt(MAX(blocks)/sum(blocks))*(100/sqrt(sqrt(COUNT(blocks)))) as

"FSFI%"
 from dba_free_space
 group by tablespace_name

==================================================================


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM