lsnrctl start #打开oracle监听
sqlplus #进入oracle
sqlplus / as sysdba #以dba身份连接到sql控制台
shutdown immediate #停止服务
startup #启动服务
#oracle查看表空间:
SELECT a.tablespace_name "表空间名",
total "表空间大小",
free "表空间剩余大小",
(total - free) "表空间使用大小",
total / (1024 * 1024 * 1024) "表空间大小(G)",
free / (1024 * 1024 * 1024) "表空间剩余大小(G)",
(total - free) / (1024 * 1024 * 1024) "表空间使用大小(G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
#oracle表空间扩容:
select * from dba_data_files where tablespace_name = 'SD_TABLE_SD_0211300003';
alter tablespace SD_TABLE_SD_0211300003 add datafile '/home/oracle/oracle10g/db_files/SD/SD_TABLE_sd_02113000033.dbf' size 10240M autoextend on;
#查询所有表空间名
select tablespace_name from dba_tablespaces
#删除表空间和数据文件
drop tablespace space_name including contents and datafiles
运维笔记-Oracle
最新推荐文章于 2024-06-12 07:22:08 发布