oracle表空间可以自动添加小文件数据文件吗?

发布于 2024-10-19 15:57:26 字数 324 浏览 2 评论 0原文

使用 Oracle 托管文件,我可以像这样创建表空间:

CREATE TABLESPACE users;

它将自动扩展,但据我了解,小文件数据文件具有最大大小。所以我需要做:

ALTER TABLESPACE users ADD DATAFILE;
ALTER TABLESPACE users ADD DATAFILE;
ALTER TABLESPACE users ADD DATAFILE;

只是想知道是否有一种方法可以让oracle在尝试自动扩展超过其最大可能大小时自动添加另一个数据文件?

Using Oracle managed files I can create my tablespace like this:

CREATE TABLESPACE users;

It will autoextend but as I understand it smallfile datafiles have a maximum size. So I then need to do:

ALTER TABLESPACE users ADD DATAFILE;
ALTER TABLESPACE users ADD DATAFILE;
ALTER TABLESPACE users ADD DATAFILE;

Just wondering if there was a way to get oracle to automatically add another datafile when it tries to autoextend past its largest possible size?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

述情 2024-10-26 15:57:26

Oracle 中没有真正的限制

更改数据库数据文件 <'data_file_name' | data_file_number>
自动扩展 K|M|G|T|P|E
最大尺寸<无限制 | K|M|G|T|P|E>;

操作系统或操作系统操作员可以停止您和数据库。
您可以编写在使用百分比后自动将新文件添加到表空间的作业。像这样的东西(伪代码)。

SELECT tablespace_name,maxbytes,bytes INTO v_tbs_info FROM dba_data_files;

FOR tbs_inf IN v_tbs_info LOOP
  IF tbs_inf.bytes/tbs_inf.maxbytes > 0.99
  excecute immediate 'ALTER TABLESPACE '|| tbs_inf.tablespcae_name ||' ADD DATAFILE SIZE 1M aUTOEXTEND ON NEXT 10M MAXSIZE 10G';
END LOOP;

当然,您不应该编写这个作业并使用它。您应该提供数据占用的空间量,并向表空间分配适当数量的文件。

There is no real limit in Oracle

ALTER DATABASE DATAFILE <'data_file_name' | data_file_number>
AUTOEXTEND K|M|G|T|P|E
MAXSIZE <UNLIMITED | K|M|G|T|P|E>;

OS or os operator can stop You and database.
Than You can write job that wiil be automaticly add new files to tablespace after % of usage. Something like this (pseudo code).

SELECT tablespace_name,maxbytes,bytes INTO v_tbs_info FROM dba_data_files;

FOR tbs_inf IN v_tbs_info LOOP
  IF tbs_inf.bytes/tbs_inf.maxbytes > 0.99
  excecute immediate 'ALTER TABLESPACE '|| tbs_inf.tablespcae_name ||' ADD DATAFILE SIZE 1M aUTOEXTEND ON NEXT 10M MAXSIZE 10G';
END LOOP;

Of course You shouldn't write this job and use it. You should provide the amount of space occupied by the data and allocate the appropriate number of files to the tablespace.

浪漫人生路 2024-10-26 15:57:26

oracle没有内置的方法来自动添加数据文件。

注意:oracle 中的“无限”运算符实际上并不是无限的。它仅意味着不超过 Oracle 对数据文件大小的硬上限,这取决于您的 db_block_size 参数。默认数据库将具有 8k 块大小并使用小文件表空间,这意味着数据文件不会增长到超过 32GB。

一旦数据文件达到硬限制,即使您设置了AUTOEXTEND MAXSIZE UNLIMITED,您仍然需要手动添加新的数据文件。

有关更多信息,请参阅本文中的表格:

https://community.oracle.com/message/1900237 #1900237

There is no built-in method for oracle to auto-add datafiles.

BEWARE: The "unlimited" operator in oracle is not actually unlimited. It only means unlimited up to oracle's hard cap on datafile sizes, which depends on your db_block_size parameter. A default database is going to have an 8k block size and use smallfile tablespaces, which means the datafiles won't grow past 32GB.

Once the datafile reaches the hard limit, even when you have AUTOEXTEND MAXSIZE UNLIMITED set, you will still have to add a new datafile by hand.

For more information see the table in this post:

https://community.oracle.com/message/1900237#1900237

撩动你心 2024-10-26 15:57:26

当然我们可以,但是为什么我们应该这样做呢?
通常情况下,限制是有原因的。对于数据文件的最大大小,我们可以创建一个大文件表空间,稍微扩展了文件大小限制。这对备份/恢复有影响,但从 11gR2 开始,我们可以并行备份这些文件,其中大文件被切成块并分布在各个通道上。

还有一个问题,最大可能的尺寸是多少?是文件系统、ASM、数据库支持的大小还是 dba 设置的 maxsize?

罗纳德.

sure we can but why should we?
Normally there is a reason for a limit. And for the max sizes of the datafiles, we can create a bigfile tablespace that has stretched the filesize limits a bit. This has impact on backup/recovery but since 11gR2 we can have those files backedup in parallel, where the bigfiles are chopped in chunks and distributed over the various channels.

Also, a question what is the largest possible size? Is it the size that is supported by the filesystem, by ASM, by the database or is it the maxsize that is set by the dba?

Ronald.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文