Oracle入门(四)之查询基本信息
一、查詢基本信息
(1)?查詢實例服務
SQL> show parameter instance name
(2)查詢數據庫名字
SQL> show parameter db_name;
(3)查詢數據庫名字
SQL>select name from v$database;
(4)顯示SGA參數大小
SQL> show sga
(5)查詢當前實際大小
SQL> Select name,current_size from v$buffer_pool;
? ? ? ?
二、數據文件、控制文件、日志文件
(1)查詢數據文件
SQL>Select name,bytes,status from v$datafile;
(2)查詢控制文件
SQL>select status,?name from v$controlfile;
(3)查詢日志文件,分組和文件名
SQL>select ?group#,member from v$logfile;
(4)查詢臨時文件
SQL>select ?file#,name from v$tempfile;
??
三、表空間
(1)查詢表空間
SQL>select file_name,tablespace_name from dba_data_files order by tablespace_name;
(2)查詢表空間與數據文件對應
? ? ? ? ? ? SQL>select?b.file_name 物理文件名,b.tablespace_name 表空間,
? ? ? ? ? ? ? ? ? ? ? b.bytes/1024/1024 大小M,
? ? ? ? ? ? ? ? ? ? ? (b.bytes-sum(nvl(a.bytes,0)))/1024/1024 已使用M,
? ? ? ? ? ? ? ? ? ? ? substr((b.bytes-sum(nvl(a.bytes,0)))/(b.bytes)*100,1,5) 利用率
? ? ? ? ? ? ? ? ? from dba_free_space a,dba_data_files b
? ? ? ? ? ? ? ? ? where a.file_id=b.file_id
? ? ? ? ? ? ? ? ? group by b.tablespace_name,b.file_name,b.bytes
? ? ? ? ? ? ? ? ? order by b.tablespace_name;
(3)擴大表空間增加數據文件
? ? ? ? ?SQL>alter tablespace system add datafile 'filename01.dbf';
? ? ? ? ? ?或者 ?alter database datafile 'filename01.dbf' autoextend on next 20m maxsize 10m;
(4)創建表空間? ? ? ? ??
? ? ? ? SQL>create tablespace tpname ?datafile 'filename02.dbf';
? ? ? ? ? 或者create tablespace tpname datafile ‘tpname02.dbf’ size 10m autoextend on next 10m maxsize 1g;
(5)刪除表空間
SQL>drop tablespace tpname including contents and datafiles
(6)設置表空間只讀
?SQL>alter tablespace ?tpname read only;
(7)設置表空間離線在線
SQL>alter tablespace tpname offline/online;
(8)表空間文件離線刪除
SQL>alter tablespace tpname datafile 'tpname.dbf' offline drop;
? ? ? ? ??
?
總結
以上是生活随笔為你收集整理的Oracle入门(四)之查询基本信息的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 心酸歌词 心酸完整歌词
- 下一篇: 数据结构(一)之链表