作家
登录

送你51个Oracle常用语句,看了绝不后悔~

作者: 来源: 2017-10-17 09:15:36 阅读 我要评论

alter database

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

alter tablespace 表空间名称 online;

35, 删除表空间

drop tablespace 表空间名称

including contents and datafiles;

36, 创建临时表空间

create temporary tablespace 表空间名称

tempfile '表空间路径名称'

size 大年夜小

autoextend on next 自增大年夜小 maxsize 最大年夜大年夜小;

create temporary tablespace 表空间名称

tempfile '表空间路径名称'

size 大年夜小

select * from dba_data_files wheretablespace_name='表空间名称';

tablespace group group1;

41, 创建事物级临时表

38, 修改临时表空间组

alter tablespace 临时表空间名称 tablespace group group2;

39, 创建大年夜文件表空间

create bigfile tabliespace mybigspace

datafile '表空间路径名称'

size 大年夜小;

40, 修改默认表空间

alter database default tablespace 表空间名称;

create global temporary table temp_student(

)on commit delete rows(事物级其余意思);

select * from temp_student;

commit; 提交事物。

提交后表还在,但数据被清除

)on commit preserve rows(会话级其余意思);

11, 带两个变量的语句(一次输入)

commit;

断开该用户连接才会清除数据

42, 应用事物级别临时表

44,攫取外部文件

起重要在对应路径下有文件

然后 create directory external_card as'E:\external';

创建对应路径

接下来就是创建外部表

create table e_card(

43, 创建会话临时表

对应的数据

)organization external(

// 里边这一团是什么器械噢

type oracle_loader// 指定拜访外部数据文件的驱动法度榜样,oracle 默认为 oracle_loader

default directory external_card // 对应上一步路径

access parameters(

fields terminated by ',')

location ('card.txt')

);

45,reject limit 句子的应用

外部表易掉足,用这个就许可有无数个缺点

partition part1 values less than ('01-1 月 - 2008'),

create table e_card(

partition part1 values ('清华大年夜学出版社') tablespace mytemp1,

对应的数据

)organization external(

type oracle_loader

default directory external_card

)partition by range(booktime)

access parameters(

'新的表空间路径名称';

fields terminated by ',')

location ('card.txt')

)reject limit unlimited;

46, 将缺点数据存储到指定文件

create table e_card(

对应的数据

)organization external(

location ('card.txt')

type oracle_loader

default directory external_card

access parameters(

records delimited by newline

badfile 'card_bad.txt'

fields terminated by ',')

);

47, 缺点信息日记文件

对应的数据

)organization external(

type oracle_loader

(4) 修改 myspace 表空间状况

access parameters(

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)(

default directory external_card

partition part1 values ('岭南师范出版社') tablespace mytemp2

datafile '表空间文件路径名称'

records delimited by newline

)

51,创建组合范围散列分区表

create table part_book(

数据库内容

subpartition by hash(bid)

subpartitions 2 store in(mytemp1,mytemp2)

alter tablespace 表空间名 1 rename to 表空间名 2;

(

partition part1 values less than ('01-1 月 - 2009'),

partition part1 values less than (maxvalue)

);

【编辑推荐】

  1. 深度解读 | 阿里云新一代关系型数据库 PolarDB
  2. SQL Server 2017正式宣布;Oracle宣布开源Fn project

  3.   推荐阅读

      Oracle数据库数据丢失?这几种方法教你来恢复~

    沙龙晃荡 | 去哪儿、陌陌、ThoughtWorks在主动化运维中的实践!10.28不见不散! 无论是开辟、测试照样运维过程中,大年夜家都可能会因为误操作、连错数据库、用错用户、语句前提有误等原因>>>详细阅读


    本文标题:送你51个Oracle常用语句,看了绝不后悔~

    地址:http://www.17bianji.com/lsqh/37968.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)