熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

Oracle10G常用維護語句

2013-11-13 15:29:55  來源: Oracle 

   創建表空間

  

  CREATE TABLESPACE CPORTAL LOGGING DATAFILE /dev/raw/raw SIZE M REUSE EXTENT MANAGEMENT LOCAL

   創建用戶

  

  CREATE USER CPORTAL PROFILE DEFAULT IDENTIFIED BY CPORTAL  DEFAULT
    TABLESPACE CPORTAL TEMPORARY  TABLESPACE TEMP ACCOUNT UNLOCK;
GRANT CONNECT TO CPORTAL;
GRANT RESOURCE TO CPORTAL;

 

   參數修改

  
ALTER SYSTEM SET sga_target = M SCOPE=SPFILE;
ALTER SYSTEM SET pga_aggregate_target = M SCOPE=SPFILE;
ALTER SYSTEM SET OPEN_CURSORS= SCOPE=SPFILE;
ALTER SYSTEM SET processes= SCOPE=SPFILE;
ALTER SYSTEM SET remote_login_passwordfile = NONE
SCOPE=SPFILE;
create pfile from spfile;
==============================================================
Modify the  other oracle parameter!                        
==============================================================
ALTER DATABASE TEMPFILE /opt/oracle/oradata/cportal/tempdbf RESIZE  M;
ALTER DATABASE DATAFILE /opt/oracle/oradata/cportal/undotbsdbf RESIZE M;
ALTER DATABASE DATAFILE /opt/oracle/oradata/cportal/undotbsdbf AUTOEXTEND ON MAXSIZE M

   查看表空間名稱和大小

  
select ttablespace_nameround(sum(bytes/(*))) ts_size   from dba_tablespaces t dba_data_files d
  where ttablespace_name = dtablespace_name
  group by ttablespace_name;

   查看表空間的使用情況

  

select sum(bytes)/(*) as free_spacetablespace_name
  from dba_free_space
  group by tablespace_name;

  查看表空間物理文件的名稱及大小

  

select tablespace_name file_id file_name
round(bytes/(*)) total_space
from dba_data_files
order by tablespace_name;

  查看數據庫庫對象

  

select owner object_type status count(*) count# from all_objects group by owner object_type status;

  查看控制文件

  

select name from v$controlfile

  查看日志文件

  

select member from v$logfile

   結束用戶會話

  


alter system kill session SIDSERIAL#;
select sidserial#usernameprogrammachinestatus from v$session;


From:http://tw.wingwit.com/Article/program/Oracle/201311/16814.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.