oracle 查看监听命令_linux下使用Oracle常用命令
進入Oracle用戶
1 | su - oracle |
以dba身份進入sql語句
1 | sqlplus / as sysdba |
啟動數據庫相關命令
啟動數據庫
1 | startup |
啟動監聽(關閉監聽的命令lsnrctl stop),退出sql編寫界面
1 | lsnrctl start |
關閉數據庫服務,在sql編寫界面
1 | shutdown immediate |
常看當前連接用戶的信息?
1 | select * from user_users; |
查看數據庫的啟動狀態 (查看進程里面有沒 有Oracle數據庫這個進程)
1 | ps -ef|grep oracle |
表空間相關命令
Sql語句執行的時候要加上分號
創建表空間:
查詢當前所有的表空間:
1 | select *from DBA_TABLESPACES |
分類別查看當前的表空間:
1 2 3 4 5 | SQL> select tablespace_name, 2 file_name, 3 round(bytes / (1024 * 1024), 0) total_space(顯示出來的數字是以M為單位的) 4 from dba_data_files 5 order by tablespace_name; |
刪除相應的表空間
drop tablespace xxx including contents and datafiles;查看詳細數據文件:
SQL> select file_name,tablespace_name from dba_data_files;擴展表空間?
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
-查詢當前表空間下使用情況
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;
總結
以上是生活随笔為你收集整理的oracle 查看监听命令_linux下使用Oracle常用命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 获取两个圆的重合部分的经纬度_(2)万向
- 下一篇: linux 其他常用命令