
26,修改表空间名字
alter tablespace 表空间名1 rename to 表空间名2;
27,利用数据字典查看空闲空间信息
SELECT *
FROM dba_free_space
WHERE tablespace_name = '表空间名称';
28,利用数据字典查看表空间数据文件信息
SELECT *
FROM dba_data_files
WHERE tablespace_name = '表空间名称';
29,修改表空间对应的数据文件大小
alter database
datafile '表空间文件路径名称'
resize 大小
30,为表空间增加新的数据文件
alter tablespace myspace
add datafile '数据文件路径名称'
size 大小
autoextend on next 自增大小 maxsize 最大值;
31,删除myspace表空间数据文件
alter tablespace myspace
drop datafile '数据文件名称';
32,修改myspace表空间中数据文件的自动扩展性
alter database
datafile '表空间文件路径名称'
autoextend off;
33,设置表空间文件状态为offline drop
alter database
datafile '表空间路径名称'
offline drop;
34,移动表空间中的数据文件
(1)alter tablespace 表空间名称 offline;先设置表空间状态为offline
(2)手动操作,将磁盘中的表空间数据文件移动到新的路径
(3)使用alter tablespace语句修改表空间文件路径名称
alter tablespace myspace
rename datafile '表空间路径名称'
to
'新的表空间路径名称';
(4)修改myspace表空间状态
alter tablespace 表空间名称 online;
35,删除表空间
drop tablespace 表空间名称
including contents and datafiles;
36,创建临时表空间
create temporary tablespace 表空间名称
tempfile '表空间路径名称'
size 大小
autoextend on next 自增大小 maxsize 最大大小;
37, 创建临时表空间,将所在组指定为group1
create temporary tablespace 表空间名称
tempfile '表空间路径名称'
size 大小
tablespace group group1;
38,修改临时表空间组
alter tablespace 临时表空间名称 tablespace group group2;
39,创建大文件表空间
create bigfile tabliespace mybigspace
datafile '表空间路径名称'
size 大小;
40,修改默认表空间
alter database default tablespace 表空间名称;
41,创建事物级临时表
create global temporary table temp_student(
)
on commit delete rows(事物级别的意思);
42,使用事物级别临时表
select * from temp_student;
commit;提交事物。
提交后表还在,但数据被清除
43,创建会话临时表
create global temporary table temp_book(
)
on commit preserve rows(会话级别的意思);
commit;
断开该用户连接才会清除数据
44,读取外部文件
首先要在对应路径下有文件
然后 create directory external_card as'E:\external';
创建对应路径
接下来就是创建外部表
create table e_card(
对应的数据
)organization external(
//里边这一团是什么东西噢
type oracle_loader//指定访问外部数据文件的驱动程序,oracle默认为oracle_loader
default directory external_card //对应上一步路径
access parameters(
fields terminated by ',')
location ('card.txt')
);
45,reject limit句子的使用
外部表易出错,用这个就允许有无数个错误
create table e_card(
对应的数据
)organization external(
type oracle_loader
default directory external_card
access parameters(
fields terminated by ',')
location ('card.txt')
)reject limit unlimited;
46,将错误数据存储到指定文件
create table e_card(
对应的数据
)organization external(
type oracle_loader
default directory external_card
access parameters(
records delimited by newline
badfile 'card_bad.txt'
fields terminated by ',')
location ('card.txt')
);
47,错误信息日志文件
create table e_card(
对应的数据
)organization external(
type oracle_loader
default directory external_card
access parameters(
records delimited by newline
badfile 'card_bad.txt'
logfile 'card_log.txt'
fields terminated by ',')
location ('card.txt')
);
48,创建范围分区表
create table part_book(
数据库内容
)partition by range(booktime)(
partition part1 values less than ('01-1月-2008')tablespacemytemp1,
partition part2 values less than ('01-1月-2009')tablespacemytemp2,
partition part1 values less than (maxvalue)tablespacemytemp3
)
49,创建散列分区表
create table part_book(
数据库内容
)partition by hash(bid)(
partition part1 tablespace mytemp1,
partition part2 tablespace mytemp2,
)
50,创建列表分区表
create table part_book(
数据库内容
)partition by list(bookpress)(
partition part1 values ('清华大学出版社') tablespace mytemp1,
partition part1 values ('岭南师范出版社') tablespace mytemp2
)
51,创建组合范围散列分区表
create table part_book(
数据库内容
)partition by range(booktime)
subpartition by hash(bid)
subpartitions 2 store in(mytemp1,mytemp2)
(
partition part1 values less than ('01-1月-2008'),
partition part1 values less than ('01-1月-2009'),
partition part1 values less than (maxvalue)
);
http://www.7daysgps.com/
微信:13366811225
本文分享自微信公众号 - Oracle优化大师,如有侵权,请联系 service001@enmotech.com 删除。




