143.You execute a command to resize a data file, sales.dbf, of size 200 MB in your database:
ALTER DATABASE DATAFILE '/remorse/sales.dbf' RESIZE 150M;
Which statement is true about this command?
A.The command must be issued in MOUNT state.
B.The command succeeds only if the data file is offline.
C.The command must be issued when the database is in the archivelog mode.
D.The command succeeds if no extent in the tablespace is currently allocated above the 150 MB boundary of the file.
答案:D
解析:
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
--说明数据库是open的
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /home/oracle/lebaishi
Oldest online log sequence 98
Current log sequence 100
--说明是非归档的
SQL> select bytes/1024/1024 M from dba_data_files where tablespace_name='USERS';
M
----------
97.5
--看下目前大小
SQL> alter database datafile '/u01/oracle/oradata/wahaha3/users01.dbf' resize 90M;
alter database datafile '/u01/oracle/oradata/wahaha3/users01.dbf' resize 90M
*
ERROR at line 1:
ORA-03297: file contains used data beyond requested RESIZE value
--看这个提示,说明目前占用的已经超过了90M
SQL> alter database datafile '/u01/oracle/oradata/wahaha3/users01.dbf' resize 95M;
Database altered.
--调整成95
SQL> select bytes/1024/1024 M,online_status from dba_data_files where tablespace_name='USERS';
M ONLINE_
---------- -------
95 ONLINE
--验证成功
说明:A,B,C是错误的
ALTER DATABASE DATAFILE '/remorse/sales.dbf' RESIZE 150M;
Which statement is true about this command?
A.The command must be issued in MOUNT state.
B.The command succeeds only if the data file is offline.
C.The command must be issued when the database is in the archivelog mode.
D.The command succeeds if no extent in the tablespace is currently allocated above the 150 MB boundary of the file.
答案:D
解析:
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
--说明数据库是open的
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /home/oracle/lebaishi
Oldest online log sequence 98
Current log sequence 100
--说明是非归档的
SQL> select bytes/1024/1024 M from dba_data_files where tablespace_name='USERS';
M
----------
97.5
--看下目前大小
SQL> alter database datafile '/u01/oracle/oradata/wahaha3/users01.dbf' resize 90M;
alter database datafile '/u01/oracle/oradata/wahaha3/users01.dbf' resize 90M
*
ERROR at line 1:
ORA-03297: file contains used data beyond requested RESIZE value
--看这个提示,说明目前占用的已经超过了90M
SQL> alter database datafile '/u01/oracle/oradata/wahaha3/users01.dbf' resize 95M;
Database altered.
--调整成95
SQL> select bytes/1024/1024 M,online_status from dba_data_files where tablespace_name='USERS';
M ONLINE_
---------- -------
95 ONLINE
--验证成功
说明:A,B,C是错误的