表空間和資料檔案的離線是分開的

psufnxk2000發表於2013-09-15
1 使表中(所有)資料檔案offline時,表空間不會offline
2 離線表空間時,資料檔案會offile

SQL> alter database  datafile '/u01/apppp/oradata/ogg1/users01.dbf' offline;

Database altered.

SQL> select tablespace_name , status from dba_tablespaces;

TABLESPACE_NAME                STATUS
------------------------------ ---------
SYSTEM                         ONLINE
SYSAUX                         ONLINE
UNDOTBS1                       ONLINE
TEMP                           ONLINE
USERS                          ONLINE
SONG_TS                        ONLINE
TBS_COMPRESS                   ONLINE
TBS_SONG02                     ONLINE

8 rows selected.

SQL> alter database  datafile '/u01/apppp/oradata/ogg1/users01.dbf' online;
alter database  datafile '/u01/apppp/oradata/ogg1/users01.dbf' online
*
ERROR at line 1:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/u01/apppp/oradata/ogg1/users01.dbf'


SQL> recover datafile '/u01/apppp/oradata/ogg1/users01.dbf'
Media recovery complete.
SQL> alter database  datafile '/u01/apppp/oradata/ogg1/users01.dbf' online;

Database altered.

SQL> select count(*) from dba_data_files where tablespace_name='USERS';

  COUNT(*)
----------
         1




SQL> select tablespace_name,status,online_status from dba_data_files;

TABLESPACE_NAME                STATUS    ONLINE_
------------------------------ --------- -------
USERS                          AVAILABLE ONLINE
UNDOTBS1                       AVAILABLE ONLINE
SYSAUX                         AVAILABLE ONLINE
SYSTEM                         AVAILABLE SYSTEM
SONG_TS                        AVAILABLE ONLINE
TBS_COMPRESS                   AVAILABLE ONLINE
TBS_SONG02                     AVAILABLE ONLINE
SONG_TS                        AVAILABLE ONLINE

8 rows selected.

SQL> ALTER TABLESPACE users OFFLINE ;

Tablespace altered.

SQL> select tablespace_name,status,online_status from dba_data_files;

TABLESPACE_NAME                STATUS    ONLINE_
------------------------------ --------- -------
USERS                          AVAILABLE OFFLINE
UNDOTBS1                       AVAILABLE ONLINE
SYSAUX                         AVAILABLE ONLINE
SYSTEM                         AVAILABLE SYSTEM
SONG_TS                        AVAILABLE ONLINE
TBS_COMPRESS                   AVAILABLE ONLINE
TBS_SONG02                     AVAILABLE ONLINE
SONG_TS                        AVAILABLE ONLINE

8 rows selected.

SQL> ALTER TABLESPACE users onLINE ;

Tablespace altered.
by song

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-772739/,如需轉載,請註明出處,否則將追究法律責任。

相關文章