`

check table space sql

阅读更多
SQL> select tablespace_name,
  2         sum(free_space) as free_space,
  3         sum(data_files) as data_files,
  4         round(sum(free_space)/sum(data_files)*100,2) as percent
  5  from
  6  (
  7  select tablespace_name, sum(bytes)/1048576 as free_space, 0 as data_files
  8  from dba_free_space
  9  group by tablespace_name
10  union all
11  select tablespace_name, 0, sum(bytes)/1048576 as data_files
12  from dba_data_files
13  group by tablespace_name
14  )
15  group by tablespace_name
16  order by 1
17  /

TABLESPACE_NAME                FREE_SPACE DATA_FILES    PERCENT
------------------------------ ---------- ---------- ----------
CHG_IDX_TS1                      9545.375      16136      59.16
CHG_IDX_TS2                      942.6875       8192      11.51
CHG_TS1                           5141.75      21504      23.91
CHG_TS2                            986.75       1024      96.36
CONV                           12425.0625      16384      75.84
COR_IDX_TS1                     1063.9375      25088       4.24
COR_IDX_TS2                       1366.75       6656      20.53
COR_IDX_TS3                       495.875      11364       4.36
COR_TS1                         1105.3125      25856       4.27
COR_TS2                           900.875       4096      21.99
COR_TS3                            778.75       3072      25.35

TABLESPACE_NAME                FREE_SPACE DATA_FILES    PERCENT
------------------------------ ---------- ---------- ----------
CWMLITE                          150.9375        300      50.31
ECC_TS1                           432.875       1024      42.27
FND_IDX_TS1                      518.4375       3584      14.47
FND_TS1                          936.3125       4096      22.86
GLO_IDX_TS1                     1259.0625       2560      49.18
GLO_TS1                            940.75       3072      30.62
HIS_TS1                            844.75       6784      12.45
OUTLN                              9.9375         10      99.38
PERF                            1570.6875       2304      68.17
SYSTEM                             731.25       1500      48.75
TOOLS                             27.9375         50      55.88

TABLESPACE_NAME                FREE_SPACE DATA_FILES    PERCENT
------------------------------ ---------- ---------- ----------
UNDOTBS_A                       6939.4375       7168      96.81
UNDOTBS_B                          6869.5       7168      95.84
UNDOTBS_C                       4667.4375       4768      97.89
USERS                            2455.625      14336      17.13
WOA_IDX_TS1                      353.1875       1024      34.49
WOA_TS1                         1964.0625       2048       95.9
WOI_IDX_TS1                      985.0625       2048       48.1
WOI_TS1                         1468.0625       2048      71.68
WOM_IDX_TS1                      519.4375       9984        5.2
WOM_TS1                          670.5625       8192       8.19

32 rows selected.


SQL> select df.NAME,dfs.BYTES,df.CREATE_BYTES From dba_free_space dfs,v$datafile
df,V$TABLESPACE ts
  2  where dfs.TABLESPACE_NAME = ts.NAME
  3  and ts.TS#=df.TS#;

NAME                                          BYTES CREATE_BYTES
---------------------------------------- ---------- ------------
/app/oradata/feng/system01.dbf             89718784    262144000
/app/oradata/feng/system01.dbf                65536    262144000
/app/oradata/feng/undotbs01.dbf           137297920    209715200
/app/oradata/feng/drsys01.dbf              20905984     20971520
/app/oradata/feng/indx01.dbf               26148864     26214400
/app/oradata/feng/tools01.dbf              10420224     10485760
/app/oradata/feng/users01.dbf              26083328     26214400
/app/oradata/feng/xdb01.dbf                20905984     20971520

8 rows selected.

分享到:
评论

相关推荐

    SQL Assistant v5.0

    For example, SQL Assistant does not insert references to "timestamp" columns in SQL server when generating code for table INSERT and UPDATE statements. Improved control of column name popups. You ...

    SqlServer2005日志清理方法

    6. **使用T-SQL脚本清理**:编写T-SQL脚本,结合DBCC CHECKLOG和DBCC LOGINFO等命令,可以获取日志信息并执行清理操作。这种方法需要对SQL Server内部工作原理有深入理解。 7. **使用SQL Server Management Studio ...

    常用SQL语句oracle

    - `SELECT tablespace_name, SUM(bytes) as total_free, MAX(bytes) as max_free, COUNT(*) FROM dba_free_space GROUP BY tablespace_name;`:统计每个表空间的总空闲空间、最大空闲块和空闲块数量,这对于空间管理...

    用Nagios监控SQL数据库【技术文档】

    2. 修改服务描述和命令:将服务描述从默认的"c:\DriveSpace"修改为"CheckSQLPort",并更改编查命令为"check_tcp!1433",使其适配SQL数据库的监控需求。 3. 检查端口状态:通过"check_tcp!1433"命令检查SQL数据库的...

    微软内部资料-SQL性能优化3

    Intent locks improve performance because SQL Server examines intent locks only at the table level to determine whether a transaction can safely acquire a lock on that table. This removes the ...

    微软内部资料-SQL性能优化2

    Although 2 GB of address space may seem like a large amount of memory, application such as SQL Server could leverage more memory if it were available. The boot.ini option /3GB was created for those ...

    微软内部资料-SQL性能优化5

    SQL Server keeps track of which pages belong to a table or index by using IAM pages. If there is no clustered index, there is a sysindexes row for the table with an indid value of 0, and that row will...

    Oracle事例

    alter table TABLE_NAME add constraint KEY_NAME primary key (TABLE_COLUMN) using index tablespace TABLE_SPACE_NAME; 2.增加外键 alter table TABLE_NAME add constraint FK_NAME foreign key (TABLE_COLUMN)...

    住宅小区物业管理系统

    create table parking_space( --停车位信息 pno char(4)primary key, fno char(2), hno char(4), carno char(8), park_fee int check(park_fee>0) not null, foreign key(fno,hno)references household(fno,...

    Oracle 系统表大全

    FROM dba_free_space GROUP BY tablespace_name; ``` - **特定表空间的数据文件**: - **示例查询**: ```sql SELECT * FROM dba_data_files WHERE tablespace_name = 'RBS'; ``` - **表空间中的段**: -...

    OCP考试资料-OCP-19c-082.docx

    ROLLBACK语句后,再执行DML语句。...综上所述,这些题目涉及到Oracle数据库管理、空间优化、视图操作和SQL查询的使用,以及事务处理的概念。理解这些知识点对于准备OCP(Oracle Certified Professional)考试至关重要。

    [itpub.net]ORACLE备份与恢复(包括RMAN) by yangtingkun BLOG(精)

    SQL> CREATE TABLESPACE TEST DATAFILE 'E:\ORACLE\ORADATA\TEST\TEST.DBF' SIZE 1M EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT MANUAL; SQL> CREATE TABLE TEST(ID NUMBER, NAME VARCHAR2(30)...

    oracle 90条基本语句

    ALTER TABLE TBL_YHJBXX ADD CONSTRAINT CK_XB CHECK (XB IN ('男', '女')); -- 限制性别只能为"男"或"女" ``` 以上就是根据提供的文件信息所整理出来的Oracle基本语句知识点,涵盖了数据库的创建、管理、数据表的...

    Sybase IQ数据的导入与导出

    - `CHECK CONSTRAINTS {ON | OFF}`: 控制是否检查约束条件。 - `COMPUTES {ON | OFF}`: 控制是否计算统计数据。 - `DEFAULTS {ON | OFF}`: 控制当字段缺失时是否使用默认值。 - `DELIMITED BY string`: 指定字段之间...

    非常全的oracal讲稿

    - **使用CHECK作限制约束**:使用`CHECK`约束确保数据符合特定条件。 - **使用UNRECOVERABLE创建表**:创建一个不可恢复的表。 ##### 4.3 表结构的其他操作 - **将表移动到新的数据段或新的表空间**:使用`MOVE`...

    Oracle8i_9i数据库基础.txt

    - **2.5.7 SPACE 设置间距**:设置输出结果的列间间距。 - **2.5.8 Termout 控制终端输出**:控制是否显示某些输出。 - **2.5.9 ECHO 控制回显**:控制命令是否回显。 - **2.5.10 TRANSACTION() 事务控制**:...

    dbcc语句结果

    - 使用`DBCC CHECKTABLE`针对具体的表进行深入检查。 - 执行`REPAIR_ALLOW_DATA_LOSS`尝试修复损坏的表,但可能会丢失数据。 - 如果可能,从备份中恢复数据库,特别是如果备份是在错误发生之前创建的。 - 审查和更新...

Global site tag (gtag.js) - Google Analytics