OCP-1Z0-052-V8.02-150题

150. The user HR receives the following error while inserting data into the TTK table:

ERROR at line 1:

ORA-01653: unable to extend table HR.TTK by 128 in tablespace SMD

Upon investigation, you find that SMD is a small file tablespace. Which three action would allow the user

to insert data? (Choose three.)

A.Add a data file to the SMD tablespace.

B.Add a data file to the temporary tablespace associated with the user HR.

C.Resize the data file associated with the SMD tablespace to make it larger.

D.Alter the data file associated with the SMD tablespace to grow automatically.

E.Change the segment space management for the SMD tablespace to automatic.

n segments is managed through free lists.

Answer: ACD

答案解析:

此题考怎么增加表空间的大小,有三种方法

1、增加一个文件:ALTER TABLESPACE lmtbsb ADD DATAFILE '/u02/oracle/data/lmtbsb02.dbf' SIZE 1M;

2、改变原来数据文件的大小:ALTER DATABASE DATAFILE '/u02/oracle/rbdb1/stuff01.dbf' RESIZE 300M;

3、设置自动增长:ALTER TABLESPACE users ADD DATAFILE '/u02/oracle/rbdb1/users03.dbf' SIZE 10M AUTOEXTEND ON NEXT 512K MAXSIZE 250M;

故答案选ACD

Increasing the Size of a Tablespace

You can increase the size of a tablespace by either increasing the size of a data file in the tablespace or adding one. See "Creating Data Files and Adding Data Files to a Tablespace" for more information.

Additionally, you can enable automatic file extension (AUTOEXTEND) to data files and bigfile tablespaces. See "Enabling and Disabling Automatic Extension for a Data File".

Manually Resizing a Data File

You can manually increase or decrease the size of a data file using the ALTER DATABASE statement. Therefore, you can add more space to your database without adding more data files. This is beneficial if you are concerned about reaching the maximum number of data files allowed in your database.

For a bigfile tablespace you can use the ALTER TABLESPACE statement to resize a data file. You are not allowed to add a data file to a bigfile tablespace.

Manually reducing the sizes of data files enables you to reclaim unused space in the database. This is useful for correcting errors in estimates of space requirements.

In the next example, assume that the data file /u02/oracle/rbdb1/stuff01.dbf has extended up to 250M. However, because its tablespace now stores smaller objects, the data file can be reduced in size.

The following statement decreases the size of data file /u02/oracle/rbdb1/stuff01.dbf:

ALTER DATABASE DATAFILE '/u02/oracle/rbdb1/stuff01.dbf'
RESIZE 100M;

Note:

It is not always possible to decrease the size of a file to a specific value. It could be that the file contains data beyond the specified decreased size, in which case the database will return an error.

Enabling and Disabling Automatic Extension for a Data File

You can create data files or alter existing data files so that they automatically increase in size when more space is needed in the database. The file size increases in specified increments up to a specified maximum.

Setting your data files to extend automatically provides these advantages:

  • Reduces the need for immediate intervention when a tablespace runs out of space

  • Ensures applications will not halt or be suspended because of failures to allocate extents

To determine whether a data file is auto-extensible, query the DBA_DATA_FILES view and examine the AUTOEXTENSIBLE column.

You can specify automatic file extension by specifying an AUTOEXTEND ON clause when you create data files using the following SQL statements:

  • CREATE DATABASE

  • ALTER DATABASE

  • CREATE TABLESPACE

  • ALTER TABLESPACE

You can enable or disable automatic file extension for existing data files, or manually resize a data file, using the ALTER DATABASE statement. For a bigfile tablespace, you are able to perform these operations using the ALTER TABLESPACE statement.

The following example enables automatic extension for a data file added to the users tablespace:

ALTER TABLESPACE users
ADD DATAFILE '/u02/oracle/rbdb1/users03.dbf' SIZE 10M
AUTOEXTEND ON
NEXT 512K
MAXSIZE 250M;

The value of NEXT is the minimum size of the increments added to the file when it extends. The value of MAXSIZE is the maximum size to which the file can automatically extend.

The next example disables the automatic extension for the data file.

ALTER DATABASE DATAFILE '/u02/oracle/rbdb1/users03.dbf'
AUTOEXTEND OFF;

官方参考:http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces.htm#BABDFCAE

原文地址:https://www.cnblogs.com/hzcya1995/p/13317152.html