时间:2021-05-02
1.查询表空间使用情况:
sqlplus system/manager@topprod
复制代码 代码如下:
SQL>@q_tbsFREE
复制代码 代码如下:
SQL>SELECT
d.tablespace_name tablespace_name
, d.status tablespace_status
, NVL(a.bytes, 0) tablespace_size
, NVL(t.bytes, 0) used
, TRUNC(NVL(t.bytes / a.bytes * 100, 0)) used_pct
, NVL(s.current_users, 0) current_users
FROM
sys.dba_tablespaces d
, ( select tablespace_name, sum(bytes) bytes
from dba_temp_files
group by tablespace_name
) a
, ( select tablespace_name, sum(bytes_cached) bytes
from v$temp_extent_pool
group by tablespace_name
) t
, v$sort_segment s
WHERE
d.tablespace_name = a.tablespace_name(+)
AND d.tablespace_name = t.tablespace_name(+)
AND d.tablespace_name = s.tablespace_name(+)
AND d.extent_management like 'LOCAL'
AND d.contents like 'TEMPORARY';
复制代码 代码如下:
#重启数据库
sqlplus '/as sysdba'
SQL>shutdown immediate
SQL>startup
#创建一个临时表空间temp02,用作临时替换
SQL>create temporary tablespace temp02 tempfile '/u2/oradb/oradata/topprod/temp02.dbf' size 10M autoextend on next 10M;
#将系统临时表空间指向temp02
SQL>alter database default temporary tablespace temp02;
#删除原来的临时表空间temp
SQL>drop tablespace temp including contents and datafiles;
#创建新的临时表空间temp
SQL>create temporary tablespace temp tempfile '/u2/oradb/oradata/topprod/temp01.dbf' size 4096M autoextend on next 100M;
#将系统临时表空间指回temp
SQL>alter database default temporary tablespace temp;
#删除临时表空间temp02
SQL>drop tablespace temp02 including contents and datafiles;
复制代码 代码如下:
#重启数据库
sqlplus '/as sysdba'
SQL>shutdown immediate
SQL>startup
#创建一个UNDO表空间undotbs2,用作临时替换
SQL>create undo tablespace undotbs2 datafile '/u2/oradb/oradata/topprod/undotbs02.dbf' size 10M autoextend on next 10M;
#将系统UNDO表空间指向undotbs2
SQL>alter system set undo_tablespace=undotbs2 scope=both;
#确保所有在UNDOTBS1的undo segment都已offline
SQL> select SEGMENT_NAME ,STATUS ,TABLESPACE_NAME from dba_rollback_segs;
#删除原来的UNDO表空间undotbs1
SQL>drop tablespace undotbs1 including contents and datafiles;
#创建新的临时表空间undotbs1
SQL>create undo tablespace undotbs1 datafile '/u2/oradb/oradata/topprod/undotbs01.dbf' size 4096M;
#将系统UNDO表空间指回undotbs1
SQL>alter system set undo_tablespace=undotbs1 scope=both;
#删除UNDO表空间undotbs2
SQL>drop tablespace undotbs2 including contents and datafiles;
复制代码 代码如下:
#删除TEMPTABS表空间
SQL>drop tablespace temptabs including contents and datafiles;
#创建TEMPTABS表空间
SQL>create tablespace temptabs datafile '/u2/oradb/oradata/topprod/temptabs.dbf' size 4096M autoextend on next 100M;
或者删除表
[code]
select 'drop table '||segment_name ||';' from dba_segments where tablespace_name='TEMPTABS' and segment_name like 'TT%' and segment_name not like '%_FILE';
复制代码 代码如下:
alter tablespace SYSTEM add datafile '/u2/oradb/oradata/topprod/system02.dbf' size 2000M autoextend on next 10M;
alter tablespace SYSAUX add datafile '/u2/oradb/oradata/topprod/sysaux02.dbf' size 2000M autoextend on next 10M;
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
11goracle导出表时会默认不导出数据为空1、Oracle11g默认对空表不分配segment,故使用exp导出Oracle11g数据库时,空表不会导出。2
update:单表的更新不用说了,两者一样,主要说说多表的更新复制代码代码如下:Oracle>Oracle的多表更新要求比较严格,所以有的时候不是很好写,我们可
oracle的逻辑结构包括表空间(tablespace),段(segment),区(extent),数据块(datablock)oracle数据库在逻辑上是由多
线性表线性表是最简单和最常用的一种数据结构,它是有n个体数据元素(节点)组成的有限序列。其中,数据元素的个数n为表的长度,当n为零时成为空表,非空的线性表通常记
复制代码代码如下:'数据库表行数函数,这是取表的行数FunctionGetTblRows(TblName)'如果TblName表名值为空,则ifTblName=