oracle 如何将数据文件添加到已经满的表空间?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43670517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add the datafile to tablespace which is already full?
提问by JLP
Consider the Initial Tablespace declared as
考虑声明为的初始表空间
CREATE TABLESPACE tbs_perm_02
DATAFILE 'tbs_perm_02.dat'
SIZE 10M
REUSE
AUTOEXTEND ON NEXT 10M MAXSIZE 200M;
The declared space is exhausted and i need to add more datafile.
声明的空间已用完,我需要添加更多数据文件。
As
作为
ALTER TABLESPACE tbs_perm_02
ADD DATAFILE 'tbs_perm_02.dat'
SIZE 20M
AUTOEXTEND ON;
The point here is that the table place is already exhausted its initially declared value of 10M Plus 200M. But When We ALTER the tablespace with extended datafile, wll that work out? Or is there another way to extend or alter in this case.
这里的重点是桌位已经用完了其最初声明的价值 10M 加 200M。但是当我们用扩展数据文件 ALTER 表空间时,会成功吗?或者在这种情况下有另一种扩展或改变的方法。
回答by miracle173
That will not work because the datafile you add has the same name as the first data file. The size/autoextend/maxsize - clause refers to the data file, not to the tablespace. So the datafile is exhausted, not the tablespace. You can either add a second datafile to your tablespace
这将不起作用,因为您添加的数据文件与第一个数据文件同名。size/autoextend/maxsize - 子句是指数据文件,而不是表空间。所以数据文件耗尽,而不是表空间。您可以向表空间添加第二个数据文件
ALTER TABLESPACE tbs_perm_02 ADD DATAFILE 'tbs_perm_02_02.dat'
SIZE 20M AUTOEXTEND ON NEXT 10M MAXSIZE 200M;
or you can change the MAXSIZE of the datafile of your tablespace
或者您可以更改表空间的数据文件的 MAXSIZE
ALTER DATABASE DATAFILE 'tbs_perm_02.dat' RESIZE
AUTOEXTEND ON NEXT 10M MAXSIZE 400M;
回答by santosh tiwary
Datafiles can be a part of file system or ASM Storage. If database is using ASM storage then you need to check the diskgroup name to add the datafiles.
数据文件可以是文件系统或 ASM 存储的一部分。如果数据库使用 ASM 存储,则需要检查磁盘组名称以添加数据文件。
Steps to add datafilein ASM:
在 ASM 中添加数据文件的步骤:
Check diskgroup location to add datafiles:
检查磁盘组位置以添加数据文件:
show parameter db_create_filedest;
显示参数 db_create_filedest;
ALTER TABLESPACE tablespace_name ADD DATAFILE 'LOCATION' SIZE 10M AUTOEXTEND ON MAXSIZE 10G;
Maxsize: upto 32G for 8k blocksize and 64G for 16K block size.
Maxsize:8k 块大小可达 32G,16K 块大小可达 64G。
To add Datafiles located on file_system:
添加位于 file_system 上的数据文件:
select file_name, bytes/1024/1024/1024,MAXBYTES/1024/1024/1024, autoextensible from dba_data_files where TABLESPACE_NAME='&TABLESPACE_NAME';
ALTER TABLESPACE tablespace_name ADD DATAFILE 'location' SIZE 10M AUTOEXTEND ON MAXSIZE 10G;
ex:
前任:
ALTER TABLESPACE tablespace_name ADD DATAFILE '/U01/ORACLE/DATAFILES/TESTDB/users02.dbf' SIZE 10M AUTOEXTEND ON MAXSIZE 10G;