oracle 查看监听命令_linux下使用Oracle常用命令

 
更多

进入Oracle用户

su – oracle

以dba身份进入sql语句

sqlplus / as sysdba

启动数据库相关命令
启动数据库

startup

启动监听(关闭监听的命令lsnrctl stop),退出sql编写界面

lsnrctl start

关闭数据库服务,在sql编写界面

shutdown immediate

常看当前连接用户的信息 

select * from user_users;

查看数据库的启动状态 (查看进程里面有没 有Oracle数据库这个进程)

ps -ef|grep oracle

表空间相关命令
Sql语句执行的时候要加上分号
创建表空间:

SQL>createtablespace test_work2 datafile’/u01/app/oracle/oradata/abc.dbf’3size10M AUTOEXTENDON;
查询当前所有的表空间:

select *from DBA_TABLESPACES

分类别查看当前的表空间:

SQL> select tablespace_name,
file_name,
round(bytes / (1024 * 1024), 0) total_space(显示出来的数字是以M为单位的)
from dba_data_files
order by tablespace_name;
删除相应的表空间

droptablespace xxx including contentsanddatafiles;
查看详细数据文件:

SQL>selectfile_name,tablespace_namefromdba_data_files;
扩展表空间 

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_filesorder 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_filesgroup by tablespace_name) a,(select tablespace_name,sum(bytes)bytes,max(bytes) largestfrom dba_free_spacegroup by tablespace_name) bwhere a.tablespace_name = b.tablespace_nameorder by ((a.bytes- b.bytes) / a.bytes) desc;

2a8d1d26a79b825a59ed3353bc97efb2.png

打赏

本文固定链接: https://www.cxy163.net/archives/1926 | 绝缘体

该日志由 绝缘体.. 于 2022年06月19日 发表在 首页 分类下,
原创文章转载请注明: oracle 查看监听命令_linux下使用Oracle常用命令 | 绝缘体

报歉!评论已关闭.