oracle 查看监听命令_linux下使用Oracle常用命令
進(jìn)入Oracle用戶
1 | su - oracle |
以dba身份進(jìn)入sql語句
1 | sqlplus / as sysdba |
啟動數(shù)據(jù)庫相關(guān)命令
啟動數(shù)據(jù)庫
1 | startup |
啟動監(jiān)聽(關(guān)閉監(jiān)聽的命令lsnrctl stop),退出sql編寫界面
1 | lsnrctl start |
關(guān)閉數(shù)據(jù)庫服務(wù),在sql編寫界面
1 | shutdown immediate |
常看當(dāng)前連接用戶的信息?
1 | select * from user_users; |
查看數(shù)據(jù)庫的啟動狀態(tài) (查看進(jìn)程里面有沒 有Oracle數(shù)據(jù)庫這個進(jìn)程)
1 | ps -ef|grep oracle |
表空間相關(guān)命令
Sql語句執(zhí)行的時候要加上分號
創(chuàng)建表空間:
查詢當(dāng)前所有的表空間:
1 | select *from DBA_TABLESPACES |
分類別查看當(dāng)前的表空間:
1 2 3 4 5 | SQL> select tablespace_name, 2 file_name, 3 round(bytes / (1024 * 1024), 0) total_space(顯示出來的數(shù)字是以M為單位的) 4 from dba_data_files 5 order by tablespace_name; |
刪除相應(yīng)的表空間
drop tablespace xxx including contents and datafiles;查看詳細(xì)數(shù)據(jù)文件:
SQL> select file_name,tablespace_name from dba_data_files;擴(kuò)展表空間?
1 | alter database datafile '/u01/app/oracle/oradata/abc.dbf' resize 20M; |
查看表空間的名字及文件所在位置
select tablespace_name,file_id,
file_name,
round(bytes / (1024 * 1024), 0) total_spacefrom sys.dba_data_files
order by tablespace_name
-查詢當(dāng)前表空間下使用情況
select a.tablespace_name,a.bytes / 1024 / 1024 "sum MB",
(a.bytes - b.bytes) / 1024 / 1024 "used MB",
b.bytes / 1024 / 1024 "free MB",
round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "used%"from (select tablespace_name, sum(bytes) bytesfrom dba_data_files
group by tablespace_name) a,
(select tablespace_name, sum(bytes) bytes, max(bytes) largestfrom dba_free_space
group by tablespace_name) bwhere a.tablespace_name = b.tablespace_name
order by ((a.bytes - b.bytes) / a.bytes) desc;
總結(jié)
以上是生活随笔為你收集整理的oracle 查看监听命令_linux下使用Oracle常用命令的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 获取两个圆的重合部分的经纬度_(2)万向
- 下一篇: linux下openldap版本查询,用