IZ0-053 Q699(臨時表空間臨時檔案被刪除恢復)
699. Your database is using a default temporary tablespace that contains the temp01.tmp temporary file.
All the users on the database use the default temporary tablspace. A user issues a query on the ORDERS
table and receives the following error:
What would be the most efficient way to rectify this error?
A.Add a new tempfile to the user’s temporary tablespace and drop the tempfile that produced the error.
B.Shut down the database instance, restore the temp01.tmp file from the backup, and then restart the
database.
C.Allow the database to continue running, drop the temp01.tmp temporary file, and then re-create it with
new tempfiles.
D.Take the temporary tablespace offline, recover the missing tempfile by applying redo logs, and then
bring the temporary tablespace online.
Answer:A
SQL> select * from v$tempfile;
FILE# CREATION_CHANGE# CREATION_ TS# RFILE# STATUS ENABLED
---------- ---------------- --------- ---------- ---------- ------- ----------
BYTES BLOCKS CREATE_BYTES BLOCK_SIZE
---------- ---------- ------------ ----------
NAME
--------------------------------------------------------------------------------
1 925793 02-MAR-16 3 1 ONLINE READ WRITE
30408704 3712 20971520 8192
/u01/app/oracle/oradata/inst1/temp01.dbf
SQL> conn scott/tiger
Connected.
SQL> show user;
USER is "SCOTT"
SQL> create global temporary table test_del(col1 varchar2(20)) on commit preserve rows;
Table created.
SQL> host rm /u01/app/oracle/oradata/inst1/temp01.dbf
SQL> insert into test_del values('a');
insert into test_del values('a')
*
ERROR at line 1:
ORA-01116: error in opening database file 201
ORA-01110: data file 201: '/u01/app/oracle/oradata/inst1/temp01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
接下來恢復臨時表空間:
SQL> alter tablespace temp offline;
alter tablespace temp offline
*
ERROR at line 1:
ORA-03217: invalid option for alter of TEMPORARY TABLESPACE
SQL> ALTER TABLESPACE TEMP DROP TEMPFILE '/u01/app/oracle/oradata/inst1/temp01.dbf';
ALTER TABLESPACE TEMP DROP TEMPFILE '/u01/app/oracle/oradata/inst1/temp01.dbf'
*
ERROR at line 1:
ORA-03261: the tablespace TEMP has only one file
SQL> alter tablespace temp add tempfile '/u01/app/oracle/oradata/inst1/temp02.dbf' size 50m reuse autoextend on next 1m maxsize 500m;
Tablespace altered.
SQL> ALTER TABLESPACE TEMP DROP TEMPFILE '/u01/app/oracle/oradata/inst1/temp01.dbf';
Tablespace altered.
SQL> insert into test_del values('a');
1 row created.
All the users on the database use the default temporary tablspace. A user issues a query on the ORDERS
table and receives the following error:
What would be the most efficient way to rectify this error?
A.Add a new tempfile to the user’s temporary tablespace and drop the tempfile that produced the error.
B.Shut down the database instance, restore the temp01.tmp file from the backup, and then restart the
database.
C.Allow the database to continue running, drop the temp01.tmp temporary file, and then re-create it with
new tempfiles.
D.Take the temporary tablespace offline, recover the missing tempfile by applying redo logs, and then
bring the temporary tablespace online.
Answer:A
SQL> select * from v$tempfile;
FILE# CREATION_CHANGE# CREATION_ TS# RFILE# STATUS ENABLED
---------- ---------------- --------- ---------- ---------- ------- ----------
BYTES BLOCKS CREATE_BYTES BLOCK_SIZE
---------- ---------- ------------ ----------
NAME
--------------------------------------------------------------------------------
1 925793 02-MAR-16 3 1 ONLINE READ WRITE
30408704 3712 20971520 8192
/u01/app/oracle/oradata/inst1/temp01.dbf
SQL> conn scott/tiger
Connected.
SQL> show user;
USER is "SCOTT"
SQL> create global temporary table test_del(col1 varchar2(20)) on commit preserve rows;
Table created.
SQL> host rm /u01/app/oracle/oradata/inst1/temp01.dbf
SQL> insert into test_del values('a');
insert into test_del values('a')
*
ERROR at line 1:
ORA-01116: error in opening database file 201
ORA-01110: data file 201: '/u01/app/oracle/oradata/inst1/temp01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
接下來恢復臨時表空間:
SQL> alter tablespace temp offline;
alter tablespace temp offline
*
ERROR at line 1:
ORA-03217: invalid option for alter of TEMPORARY TABLESPACE
SQL> ALTER TABLESPACE TEMP DROP TEMPFILE '/u01/app/oracle/oradata/inst1/temp01.dbf';
ALTER TABLESPACE TEMP DROP TEMPFILE '/u01/app/oracle/oradata/inst1/temp01.dbf'
*
ERROR at line 1:
ORA-03261: the tablespace TEMP has only one file
SQL> alter tablespace temp add tempfile '/u01/app/oracle/oradata/inst1/temp02.dbf' size 50m reuse autoextend on next 1m maxsize 500m;
Tablespace altered.
SQL> ALTER TABLESPACE TEMP DROP TEMPFILE '/u01/app/oracle/oradata/inst1/temp01.dbf';
Tablespace altered.
SQL> insert into test_del values('a');
1 row created.
可以看到,臨時表空間臨時檔案的臨時檔案被刪除,可以通過先增加新的臨時檔案,再drop原被刪除的臨時檔案的方式來恢復。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-2051872/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 刪除臨時表空間組
- Oracle臨時表空間檢視、新增臨時表空間資料檔案、修改預設臨時表空間 方法!Oracle
- oracle建立臨時表空間和資料表空間以及刪除Oracle
- mysql臨時表,臨時表空間,ibtmp1表空間暴增原因初探MySql
- oracle 臨時表空間的增刪改查Oracle
- win10如何刪除系統更新臨時檔案_windows10更新刪除臨時檔案操作方法Win10Windows
- 臨時表空間被佔滿的原因查詢
- oracle臨時表空間相關Oracle
- 4.2.1.8規劃臨時表空間
- MySQL InnoDB臨時表空間配置MySql
- MySQL 5.7 新特性 共享臨時表空間及臨時表改進MySql
- 2.5.7 建立預設臨時表空間
- 消除臨時表空間暴漲的方法
- SQLServer如何釋放tempdb臨時表空間SQLServer
- 臨時表空間和回滾表空間使用率查詢
- MYSQL造資料佔用臨時表空間MySql
- oracle11g 查詢臨時表空間的使用率和正在使用臨時表空間的使用者Oracle
- 臨時表空間ORA-1652問題解決
- [20190410]dg建立臨時表檔案資料檔案.txt
- 隨身碟被刪除的檔案如何恢復?
- 恢復EXT3下被刪除的檔案
- 被360防毒刪除的檔案怎麼恢復防毒
- 檢視oracle臨時表空間佔用率的檢視Oracle
- win10系統無法刪除Internet臨時檔案怎麼辦Win10
- win10磁碟清理臨時檔案無法刪除的解決方法Win10
- MySQL臨時表MySql
- PostgreSQL:臨時表SQL
- Jenkins臨時空間不足處理辦法Jenkins
- Git恢復刪除的檔案Git
- oracle建立使用者,表空間,臨時表空間,分配許可權步驟詳解Oracle
- pycharm建立臨時檔案scatch filePyCharm
- Yoink for Mac(臨時檔案拖放助手)Mac
- Linux刪除指定時間之前的檔案Linux
- 臨時表空間使用率過高的解決辦法
- Oracle 12C RMAN備份佔用大量臨時表空間Oracle
- dbms_lob儲存過程導致臨時表空間100%儲存過程
- 行動硬碟刪除的檔案能恢復嗎,怎麼恢復硬碟刪除的檔案硬碟
- 如何恢復被刪除的 GitLab 專案?Gitlab
- MySQL之臨時表MySql